{"id":17035603,"url":"https://github.com/jmosul/harptos-js","last_synced_at":"2026-01-18T11:42:20.358Z","repository":{"id":40761233,"uuid":"277133562","full_name":"jmosul/harptos-js","owner":"jmosul","description":"HarptosJS is an attempt to implement a MomentJS-esque date library for Dungeon and Dragon's Harptos Calendar.","archived":false,"fork":false,"pushed_at":"2023-01-06T10:40:07.000Z","size":430,"stargazers_count":1,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T21:43:29.871Z","etag":null,"topics":["date","forgotten-realms","harptos","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jmosul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-04T15:12:39.000Z","updated_at":"2025-02-08T13:22:24.000Z","dependencies_parsed_at":"2023-02-05T22:01:24.280Z","dependency_job_id":null,"html_url":"https://github.com/jmosul/harptos-js","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jmosul/harptos-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmosul%2Fharptos-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmosul%2Fharptos-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmosul%2Fharptos-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmosul%2Fharptos-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmosul","download_url":"https://codeload.github.com/jmosul/harptos-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmosul%2Fharptos-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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","forgotten-realms","harptos","typescript"],"created_at":"2024-10-14T08:47:28.459Z","updated_at":"2026-01-18T11:42:20.341Z","avatar_url":"https://github.com/jmosul.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HarptosJS\n\n\u003e **Early Development**: HarptosJS's features are limited and only an alpha release version is avaliable\n\nHarptosJS is an attempt to implement a [MomentJS](https://momentjs.com/)-esque date library for Dungeon and Dragon's [Harptos Calender](https://forgottenrealms.fandom.com/wiki/Calendar_of_Harptos) useable in both TypeScript and JavaScript.\n\nIt is being built out of need for my own personal project, but presented separately in case it helps another.\n\n### Usage\nTo install use either npm or yarn.\n\n```bash\nnpm install jmosul/harptos-js\n\nyarn add jmosul/harptos-js\n```\n\nThen it can be imported into your project.\n\n```js\nimport harptosJS from '@jmosul/harptosjs';\n\nconst date = harptos('1000-10-01');\n\nconst tomorrow = date.add(1); // 1000-01-01\n\nconst pretty = date.format('LLL') // 1st Marpenoth 1000\n```\n\n**Note** Harptos date objects can currently be built from YYYY-MM-DD formats and daystamps (days since start of epoch.  Example: `5 =\u003e 5th Hammer 0001`).\n\n**Recommend**: It is recommended to store dates as integer daystamps as the most reliable format. `harptos.daystamp()` outputs integer daystamps.\n\nHarptos follows the structure of:\n* 12 months a year\n* 30 days a month\n* 5 additional days between months\n* 365 days a year\n* Leap year every 4 years with an extra day (Shieldmeet) on the 7th month\n\n## Displaying\nHarptos offers a number of formats for displaying dates using the same notation as MomentJS.\n\n|           | Token              | Output                   |\n|----------:|--------------------|--------------------------|\n| **Month** | M                  | 1 2 ... 11 12           |\n|           | MM                 | 01 02 ... 11 12         |\n|           | MMM                | Ham Alt ... Ukt Nig      |\n|           | MMMM               | Hammer Alturiak ... Uktar Nightal |\n| **Day of the Month** | D        | 1 2 ... 29 30 |\n|                     | DD       | 01 02 ... 29 30 |\n| **Year** | y                   | 1 2 ... 1495 1496 |\n|          | YYYY                | 0001 0002 ... 1495 1496 |\n| **Era**  | N                   | DR |\n|          | NN                  | DR |\n|          | NNN                 | Dale Reckoning |\n\n### Additional Days\nThe Harptos Calendar includes 5 named additional days between months and an extra day every leap year (4 years).\n\nDisplaying these is included in the Tokens given for months:\n\n| Token | Output              |\n|-------|---------------------|\n| M     | MW GG MS HH FM SM   |\n| MM    | MW GG MS HH FM SM   |\n| MMM   | MW GG MS HH FM SM   |\n| MMMM  | Midwinter, Greengrass, Midsummer, Highharvestide, Feast of the Moon, Shieldmeet |\n\n### Localised formats\nA few predefined formats are available based on the set locale (see below for changing local).\n\n| Token | Output              |\n|-------|---------------------|\n| L     | 01/01/1000          |\n| LL    | 1 Hammer 1000       |\n| LLL   | 1 Hammer 1000 DR    |\n\n## Locales\nThe default locale for HarptosJS is `harptos_gb` (Day, Month Year).  This is format commonly associated with Harptos.  It is however possible to choose a different locale.\n\nTo reduce distribution size of your project locales are not imported by default.  But you can add any of the provided as below.\n```js\nimport harptos from 'harptosjs';\nimport harptos_us from 'harptosjs/build/locales/harptos_us';\n\n// add locale\nharptos.addLocale(harptos_us);\n```\n\nOnce a locale has been loaded as above, you can choose to use it in different ways:\n\n**Setting a global locale**\n```js\nimport harptos from 'harptosjs';\n\n// set default locale\nharptos.locale('harptos_us');\n```\n\n**Set locale on single date**\n```js\nimport harptos from 'harptosjs';\n\n// set locale on creation\nconst date = harptos('1000-01-01', 'harptos_gb');\n\n// set locale on existing date\ndate.locale('harptos_us');\n\n// format as locale\ndate.format('L', 'common_gb');\n```\n\n### Available locales\n\n| Locale | Description | Example |\n|----|----|----|\n| harptos_gb _default_ | Standard Harptos date format | 1 Hammer 1000 |\n| harptos_us | Harptos dates formatted using American date structure | Hammer 1, 1000 |\n| common_gb | Same as harptos_gb, but months are given their \"common\" name | 1 Deepwinter 1000 |\n| common_us | Same as harptos_us, but months are given their \"common\" name | Deepwinter 1, 1000 |\n| en_gb | Months are converted to English Gregorian names | 1 January 1000 |\n| en_us | Months are converted to English Gregorian names | January 1, 1000 |\n\n\n### Custom locales\nIt is possible to add your own custom locales by following the same format as shown in [https://github.com/jmosul/harptos-js/blob/master/src/locales/locales.test.ts](src/locales/locales.test.ts).\nBe sure to give it a unique name, then you can import it like any of the provided locales as show above.\n\n## Planned Features:\n\n### More date calculations\nIn its current form HarptosJS can only handle add/subtract x days.\nIt will be extended to match MomentJS's api.  For example: `harpos.add(3, months)`\n\n### Tendays\nImplement counting by Tendays. With tendays starting on the 1st of every month as defined in the Harptos calendar.\n\n### Customise calendar structure\nHarptosJS follows the structure of twelve months of 30 days, with 5 inbetween days and a leap year every 4 years.\nI will aim to allow HarptosJS to be highly configurable allowing the date structure to be changed.  This will include custom week lengths (tendays).\n\n### Negative dates\nAim to be able to handle negative Dale Reckoning dates.\n\n## Timeless\nCurrently Harptos does not implement time (hours, minutes, etc...).\n\nDates are calculated from \"daystamps\"; days since the start of epoc, 1st Hammer 1 DR\nAs it stand this is not a planned feature of HarptosJS\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmosul%2Fharptos-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmosul%2Fharptos-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmosul%2Fharptos-js/lists"}