{"id":20673227,"url":"https://github.com/coder966/intl-date","last_synced_at":"2026-04-11T16:43:50.045Z","repository":{"id":45599724,"uuid":"513567547","full_name":"coder966/intl-date","owner":"coder966","description":"Javascript library to represent and work with dates in different calendar systems (e.g. hijri, persian and others).","archived":false,"fork":false,"pushed_at":"2024-03-21T19:47:27.000Z","size":253,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-19T13:42:23.990Z","etag":null,"topics":["calendar","date","hijrah","hijri","hijri-calendar","hijri-date","hijri-dates","hijri-dates-converter","internationalization","intl","intl-apis","javascript","persian","persian-calendar"],"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/coder966.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-07-13T15:06:53.000Z","updated_at":"2024-09-12T13:20:37.000Z","dependencies_parsed_at":"2025-03-10T17:59:51.915Z","dependency_job_id":"46fd1a9d-8d92-4158-a133-d6b390811086","html_url":"https://github.com/coder966/intl-date","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/coder966/intl-date","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Fintl-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Fintl-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Fintl-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Fintl-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coder966","download_url":"https://codeload.github.com/coder966/intl-date/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Fintl-date/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31687881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["calendar","date","hijrah","hijri","hijri-calendar","hijri-date","hijri-dates","hijri-dates-converter","internationalization","intl","intl-apis","javascript","persian","persian-calendar"],"created_at":"2024-11-16T20:40:33.794Z","updated_at":"2026-04-11T16:43:50.027Z","avatar_url":"https://github.com/coder966.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Intl Date\n\nJavascript library to represent and work with dates in different calendar systems (e.g. hijri, persian and others).\n\n## Features\n\n- Simple and type-safe API\n- Immutable objects\n- Supports 7 calendar systems\n- Tiny: 1kB (minified + gzipped)\n- Zero dependencies. Leverages `Intl.DateTimeFormat`.\n\n## Supported Calendars\n\n- gregorian\n- islamic\n- islamic-umalqura\n- islamic-rgsa\n- islamic-civil\n- islamic-tbla\n- persian\n\n## Installation\n\n```shell\n$ npm install intl-date\n```\n\n## Example\n\n```javascript\nconst date = IntlDate.of('islamic-umalqura', 1377, 3, 22);\n\ndate.toString('gregorian'); // 1957-10-16\ndate.getYear('gregorian'); // 1957\ndate.getMonth('gregorian'); // 10\ndate.getDay('gregorian'); // 16\n\ndate.toString('islamic-umalqura'); // 1377-03-22\ndate.getYear('islamic-umalqura'); // 1377\ndate.getMonth('islamic-umalqura'); // 3\ndate.getDay('islamic-umalqura'); // 22\n\ndate.toString('persian'); // 1336-07-24\ndate.getYear('persian'); // 1336\ndate.getMonth('persian'); // 7\ndate.getDay('persian'); // 24\n```\n\n## API\n\n### Different ways to create IntlDate objects\n\n#### of - Create IntlDate from a year, month, and day\n\n```javascript\nconst date = IntlDate.of('islamic-umalqura', 1377, 3, 22);\n```\n\n#### from - Create IntlDate from a Javascript Date object\n\n```javascript\nconst jsDate = new Date(2017, 11, 25);\nconst intlDate = IntlDate.from(jsDate);\n```\n\n#### parse - Create IntlDate from a string\n\n```javascript\nconst date = IntlDate.parse('gregorian', '1957-05-16');\n```\n\n#### today - Create IntlDate for today's date\n\n```javascript\nconst date = IntlDate.today();\n```\n\n### Getters\n\n#### getYear\n\n```javascript\nconst year = date.getYear('islamic-umalqura');\n```\n\n#### getMonth\n\n```javascript\nconst month = date.getMonth('gregorian');\n```\n\n#### getDay\n\n```javascript\nconst day = date.getDay('persian');\n```\n\n#### getDayOfWeek\n\n```javascript\nconst dayOfWeek = date.getDayOfWeek();\n```\n\n#### getQuarter\n\n```javascript\nconst quarter = date.getQuarter('gregorian');\n```\n\n### Manipulative operations (produces new immutable IntlDate objects)\n\n#### plusDays\n\n```javascript\nconst oldDate = IntlDate.of('gregorian', 1957, 10, 16);\nconst newDate = oldDate.plusDays(20);\n\noldDate.toString('gregorian'); // 1957-10-16\nnewDate.toString('gregorian'); // 1957-11-05\n```\n\n#### minusDays\n\n```javascript\nconst oldDate = IntlDate.of('gregorian', 1957, 10, 16);\nconst newDate = oldDate.minusDays(20);\n\noldDate.toString('gregorian'); // 1957-10-16\nnewDate.toString('gregorian'); // 1957-09-26\n```\n\n### Comparing IntlDate objects\n\n#### isEqual\n\n```javascript\nconst date1 = IntlDate.of('gregorian', 1957, 10, 16);\nconst date2 = IntlDate.of('islamic-umalqura', 1377, 3, 22);\nconst result = date1.isEqual(date2); // true\n```\n\n#### isBefore\n\n```javascript\nconst date1 = IntlDate.of('gregorian', 1957, 10, 15);\nconst date2 = IntlDate.of('islamic-umalqura', 1377, 3, 22);\nconst result = date1.isBefore(date2); // true\n```\n\n#### isAfter\n\n```javascript\nconst date1 = IntlDate.of('gregorian', 1957, 10, 17);\nconst date2 = IntlDate.of('islamic-umalqura', 1377, 3, 22);\nconst result = date1.isAfter(date2); // true\n```\n\n#### isBetween\n\n```javascript\nconst date1 = IntlDate.of('gregorian', 1957, 10, 16);\nconst date2 = IntlDate.of('gregorian', 1957, 10, 20);\nconst date3 = IntlDate.of('gregorian', 1957, 10, 25);\nconst result = date2.isBetween(date1, date3); // true\n```\n\n#### daysUntil\n\n```javascript\nconst date1 = IntlDate.of('gregorian', 1957, 10, 16);\nconst date2 = IntlDate.of('gregorian', 1957, 11, 20);\nconst days = date1.daysUntil(date2); // 35\n```\n\n#### min\n\n```javascript\nconst date1 = IntlDate.of('gregorian', 1957, 10, 16);\nconst date2 = IntlDate.of('gregorian', 1957, 10, 20);\nconst min = IntlDate.min(date1, date2); // date1\n```\n\n#### max\n\n```javascript\nconst date1 = IntlDate.of('gregorian', 1957, 10, 16);\nconst date2 = IntlDate.of('gregorian', 1957, 10, 20);\nconst max = IntlDate.max(date1, date2); // date2\n```\n\n### String operations\n\n#### format\n\n```javascript\nconst date = IntlDate.of('gregorian', 2022, 7, 11);\nconst formattedString = date.format('gregorian', 'yyyy-MM-dd'); // 2022-07-11\n```\n\n#### toString\n\n```javascript\nconst date = IntlDate.of('gregorian', 2022, 7, 11);\nconst string = date.toString('gregorian'); // 2022-07-11\n```\n\n## License\n\n```txt\nCopyright 2022 Khalid H. Alharisi\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder966%2Fintl-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoder966%2Fintl-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder966%2Fintl-date/lists"}