{"id":27376976,"url":"https://github.com/algoristic/chrono-40k","last_synced_at":"2026-02-15T05:32:45.442Z","repository":{"id":284287162,"uuid":"954449585","full_name":"algoristic/chrono-40k","owner":"algoristic","description":"A consistent dating system for \"Warhammer 40,000\"","archived":false,"fork":false,"pushed_at":"2025-04-02T01:37:00.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-21T06:13:25.848Z","etag":null,"topics":["date","fun-project","warhammer","warhammer-40k"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/algoristic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-25T05:19:59.000Z","updated_at":"2025-04-02T01:36:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"034edb52-5be4-46c3-9658-a69e6bab2726","html_url":"https://github.com/algoristic/chrono-40k","commit_stats":null,"previous_names":["algoristic/chrono-40k"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/algoristic/chrono-40k","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algoristic%2Fchrono-40k","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algoristic%2Fchrono-40k/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algoristic%2Fchrono-40k/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algoristic%2Fchrono-40k/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/algoristic","download_url":"https://codeload.github.com/algoristic/chrono-40k/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algoristic%2Fchrono-40k/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29470626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T05:26:30.465Z","status":"ssl_error","status_checked_at":"2026-02-15T05:26:21.858Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["date","fun-project","warhammer","warhammer-40k"],"created_at":"2025-04-13T12:57:51.848Z","updated_at":"2026-02-15T05:32:45.434Z","avatar_url":"https://github.com/algoristic.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chrono 40k\n\n\u003e A consistent dating system for \"Warhammer 40,000\"\n\nIf you are not familiar with the imperial dating system in Warhammer 40k please consider to first take a look at https://warhammer40k.fandom.com/wiki/Imperial_Dating_System.\n\nI intentionally diverge from the calculation of the _year fraction_ or _chronosegments_, more on that in the [remark](#remark) section.\n\n## Usage\n\n### Installation\n\nInstall using `npm`:\n\n```sh\nnpm i chrono-40k\n```\n\n### Basic usage:\n\nGet imperial representations of `Date`:\n\n```ts\nimport { Chrono, Formats } from 'chrono-40k';\n\nChrono.classic.format(new Date());\n// returns something like \"0 227 025.M3\"\n\nChrono.classic.format(new Date(), Formats.CLASSIC_SHORT_FORMAT);\n// returns something like \"025.M3\"\n\nChrono.indomitus.format(new Date());\n// returns something like \"974.773 previo TCM.M3\"\n\nChrono.indomitus.format(new Date(), Formats.INDOMITUS_ERA_SHORT_FORMAT);\n// returns something like \"974.773- TCM.M3\"\n```\n\nGet `Date`s for imperial dates:\n\n```ts\nlet date: Date = Chrono.classic.parse('005.M30').toDate();\n// or\ndate = Chrono.classic.toTerranDate('005.M30');\n```\n\nUse imperial date objects:\n\n```ts\nconst classicDate = Chrono.classic.parse(new Date());\n\nconsole.log(classicDate.toString());\nconst date: Date = classicDate.toDate();\n\nconst indomitusDate = Chrono.indomitus.parse(classicDate);\n```\n\nUse short access to imperial dates:\n\n```ts\nlet classicDate = Chrono.classic.parse(new Date());\n// equals\nclassicDate = Chrono.parse(new Date());\n\nconsole.log(Chrono.classic.format(new Date()));\n// equals\nconsole.log(Chrono.format(new Date()));\n\n// etc.\n```\n\n### Advanced usage\n\nConvert from one imperial dating system the other:\n\n```ts\nconst classicDate = Chrono.classic.parse('0 899 998.M41');\nconsole.log(Chrono.indomitus.format(classicDate));\n// outputs \"1.101 previo TCM.M42\"\n```\n\n#### Custom formatting\n\n`Chrono.classic` automatically recognizes imperial dates in the formats\n\n- `c fff yyy.m` (`Formats.CLASSIC_DEFAULT_FORMAT`) \\\n  e. g. \"0 550 899.M41\" and\n- `yyy.m` (`Formats.CLASSIC_SHORT_FORMAT`) \\\n  e. g. \"005.M30\"\n\nwhere `c` = check number, `f` = year fraction, `y` = year and `m` = millenium.\n\n`Chrono.indomitus` automatically recognizes imperial dates into the formats\n\n- `y.f gg d.m` (`Formats.INDOMITUS_ERA_DEFAULT_FORMAT`) \\\n  e. g. \"1.1 previo TCM.M41\" and\n- `y.fg d.m` (`Formats.INDOMITUS_ERA_SHOR_FORMAT`) \\\n  e. g. \"0.110+ TCM.M42\"\n\nwhere `y` = annual designator, `f` = chronosegments, `g`/`gg` = +/- or post/previo opening of the Cicatrix Maledictum, `d` = designator initials and `m` = millenium.\n\nIf needed, a custom format can be provided to any method that parses or formats and imperial date string:\n\n```ts\nChrono.classic.parse('0123456  M7', 'cfffyyy m');\nChrono.classic.format(new Date(), 'yyy,m');\n```\n\nFor more examples please take a look at the [`chrono.spec.ts`](./src/chrono/chrono.spec.ts)\n\n## Remark\n\nI intentionally diverge from the calculation of the _year fraction_ (and the respective _chronosegments_ in the \"Era Indomitus\" dating system) as I see a problem with the lore accurate calculation.\n\n### Problem\n\nThe first issue is that the fixed _Makr constant_ does not take into account leap years. We need at least one \"default\" constant and one for leap years.\n\nThe second and more fundamental issue is that, even when not considering leap years, the calculation with the _Makr constant_ just does not work.\n\nE. g. calculate the _year fractions_ for December 31, 2025 at 10 pm. December 31st is day number 365 of the year 2025 and 10pm is the 22th hour of that day so we calculate **365 \\* 24 + 22 = 8782**. Then we multiply that with the _Makr constant_ **8782 \\* 0.11407955 = 1001.84661** and round down the result to get the **year fraction = 1001**.\n\nThis is a problematic result as we just have 1000 _year fractions_ in a year, so even when resolving this problem by just capping the result at 1000 we do not get a consistent way to calculate dates in both directions.\n\n### Solution\n\nIn my calculation I replace the _Makr constant_ with two variations of the new _Marco constant_, one \"default\" and one for leap years.\n\n**marco_constant_default = 1 / ( ( 365 \\* 24 ) / 1000 )**\\\n**marco_constant_leap_year = 1 / ( ( 366 \\* 24 ) / 1000 )**\n\nWith theses adjustments the dating system does not work lore accurate anymore but it allows for a consistent conversion between gregorian and imperial dates.\n\n## Copyright\n\nThis software is completely unofficial and in no way endorsed by Games Workshop Ltd.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgoristic%2Fchrono-40k","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falgoristic%2Fchrono-40k","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgoristic%2Fchrono-40k/lists"}