{"id":18138019,"url":"https://github.com/louis-aime/calendrical-javascript","last_synced_at":"2025-04-19T17:45:23.470Z","repository":{"id":48103313,"uuid":"312376315","full_name":"Louis-Aime/calendrical-javascript","owner":"Louis-Aime","description":"Routines for computations on calendars. Extend Date and Intl.DateTimeFormat. Allow custom calendars. Add historical gregorian calendars with custom switching date. Specify date in custom calendar. Helps creating calendars for Ecma TC39's Temporal. Handle week figures. Enhance Intl.DateTimeFormat. Extend Unicode CLDR and ICUs.","archived":false,"fork":false,"pushed_at":"2025-02-25T15:33:51.000Z","size":939,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T11:04:36.152Z","etag":null,"topics":["calendar","calendar-computation-engine","calendars","calendrical-computations","cldr","date","date-format","datetime","icu4j","intl","javascript","temporal"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Louis-Aime.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-12T19:30:55.000Z","updated_at":"2025-03-12T01:39:36.000Z","dependencies_parsed_at":"2023-01-22T02:00:34.100Z","dependency_job_id":null,"html_url":"https://github.com/Louis-Aime/calendrical-javascript","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Louis-Aime%2Fcalendrical-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Louis-Aime%2Fcalendrical-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Louis-Aime%2Fcalendrical-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Louis-Aime%2Fcalendrical-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Louis-Aime","download_url":"https://codeload.github.com/Louis-Aime/calendrical-javascript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249751975,"owners_count":21320404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar","calendar-computation-engine","calendars","calendrical-computations","cldr","date","date-format","datetime","icu4j","intl","javascript","temporal"],"created_at":"2024-11-01T15:08:03.764Z","updated_at":"2025-04-19T17:45:23.452Z","avatar_url":"https://github.com/Louis-Aime.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# calendrical-javascript\nBasic routines in javascript for calendrical computations.\n## Module architecture\nThis module uses ES6 module syntax (export / import).\n## GitHub Page site for software documentation, usage comments, tests and demos\nhttps://louis-aime.github.io/calendrical-javascript/\n\n## Purpose\n\n### `ExtDate` object\nExtends the built-in `Date` object, making it possible to specify dates in custom-made calendars. \nThis foreshadows some features of `Temporal` initiative of Ecma TC39.\n| Purpose | `Date` | `ExtDate` |\n|:--- |:---:|:---:|\n|Number for the first month|0|1|\n|Create date from now|+|+|\n|Create date from timestamp|+|+|\n|Create date from ISO 8601 date expression|+|+|\n|Create date from ISO 8601 date fields | Except in 1st century | All dates |\n|Specify date from date fields of another calendar |0|+|\n|Obtain date fields of another calendar |0|+|\n|Handle week figures|0|+|\n|Obtain real time zone offset in ms|0|+|\n### `ExtDateTimeFormat` object\nExtends `Intl.DateTimeFormat`. Enables usage of calendars that are not defined in Unicode, and foreshadows some proposed enhancements. \n`ExtDateTimeFormat` is called with the same parameters as `Intl.DateTimeFormat`, plus a calendar object or calendar name. \nThe methods have the same names, but yield more focused results.\nAn additional option `eraDisplay` is available.\n| Purpose | `Intl.DateTimeFormat` | `ExtDateTimeFormat` |\n|:--- |:---:|:---:|\n|Display or hide era automatically|0|+|\n|Use variants to Unicode's CLDR (using a PLDR)|0|+|\n|Differentiate `2-digit` from `numeric` for time representation|0|+|\n|Customise intercalary month marker for chinese and dangi calendars|0|+|\n### Custom calendars\nThe general structure of a custom calendar is documented as a type in `customcalendarmodel.js` module. \nSome useful examples are given in `calendars.js`.\nThe calendar of any European country that used the Julian calendar and switched some day to the Gregorian one \nmay easily be specified and used.\n| Purpose | Unicode | calendrical-javascript |\n|:--- |:---:|:---:|\n|ISO 8601 proleptic Gregorian calendar with algebraic year|0|+|\n|Julian calendar|0|+|\n|Customisable Gregorian calendar with switchover date|0|+|\n|French revolutionary calendar|0|+|\n|Milesian calendar|0|+|\n|Persian calendar (33 years cycle)|+|+|\n\nTentative new week numbering systems are also possible.\n### `timeUnits` object (time-units.js)\nConvert simple durations to and from milliseconds, using coefficients defined once for all.\n### `Cbcce` class (chronos.js)\nDefine almost any algorithmic calendar with a simple object, see `chronos.js` or the JSDoc documentation:\nthe Cycle Based Calendar Computation Engine (Cbcce) will convert between timestamp and date-time fields.\nBasic solid-state integer division and modulo routines are also available.\nThese tools provide a general framework to deal with most algorithmic calendars, \nincluding Julian,  Gregorian, Coptic, Ethiopic, Meton-cycle implied with the Hebrew calendar, etc.\nSee implementation examples in `calendars.js`.\n### `WeekClock` class (chronos.js)\nDefine special week rules, with more or less than 7 days, epagomenal days at end of year, or an intercalation day anywhere in the year.\nThe WeekClock instantiated object will compute day sequential number to and from week figures. \nThe rules for the week are specified in an object, see `chronos.js` or the JSDoc documentation.\nSee implementation examples in `calendars.js`.\n### IsoCounter class (chronos.js)\nConvert a set of ISO 8601 date fields to and from a sequential day number relative to a given epoch,\nby default 1970-01-01. Useful for computations on Julian Day, Modified JD, Microsoft base, etc.\n### `fetchDOM` promise generator function (fetchdom.js)\nOpen access to an external XML resource and convert it to a document (DOM) object. \nThis function works like `import()` but establishes a document object rather than an access to a module.\nThis function is a general purpose object. It is here used to fetch the Private Locale Data Repository (PLDR) used with calendars.\n### pldr.js\nA simplified and stringified version of our Private Locale Data Repository, \nto be used when the access to the XML PLDR file is not available.\n## Demonstration and documentation files\nThe calendrical-\\*.js and calendrical-demo\\*.html files are for test and demonstrating purposes. \nThe JSDoc documentation and the demo are available from GitHub Pages.\nAll other \\*.html files are JSDoc generated files.\n### calendrical-init.js\nAn example of initialisation of the complete package. This file may be tailored to specific applications.\n### calendrical-demo-en.html, calendrical-demo-fr.html\nDemonstration pages in English resp. French.\nThey use calendrical-demo.js and calendrical-init.js as script files.\n### calendrical.demo.js \nEvent listeners for the calendrical-demo pages. Most global objects of the demo pages are documented as *Global* by JSDoc.\n### Calendars used in the demonstration site.\nAs defined in calendrical-demo.js, some calendars are instantiated from the classes of calendars.js when the page is loaded. Here are their id:  :\n * **milesian**: the Milesian calendar, as defined at www.calendriermilesien.org; if you use ExtDateTimeFormat, pldr is required.\n * **iso_8601**: the proleptic Gregorian calendar as specified by ISO 8601, with week computations and with algebraic year display.\n * **julian**: the julian calendar. You can display date with ExtDateTimeFormat, using CLDR's names for days, months, eras.  \n * **gregorian** : you instantiate the *GregorianCalendar* with a user-defined switching date to Gregorian reckoning. The *era* field is used to diffentiate \"os\" (Old Style, meaning Julian reckoning) from \"ns\" (New Style, Gregorian reckoning). pldr is required, in order to display these eras in a few languages.\n * **frenchRev**: the calendar defined by the French Convention in 1793. pldr is required.\n * **persian 33**: the official algorithmic calendar used in Iran and Afghanistan, same effect as Unicode's.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouis-aime%2Fcalendrical-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouis-aime%2Fcalendrical-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouis-aime%2Fcalendrical-javascript/lists"}