{"id":23773509,"url":"https://github.com/beenotung/timezone-date","last_synced_at":"2026-04-29T16:03:03.007Z","repository":{"id":57141448,"uuid":"258392513","full_name":"beenotung/timezone-date","owner":"beenotung","description":"Enhancement of Date class with better timezone support.","archived":false,"fork":false,"pushed_at":"2025-11-20T17:55:48.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-20T19:23:57.543Z","etag":null,"topics":["browser-compatibility","date","nodejs","timezone","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/timezone-date.ts","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beenotung.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-04-24T03:14:47.000Z","updated_at":"2025-11-20T17:55:52.000Z","dependencies_parsed_at":"2022-09-05T18:40:30.294Z","dependency_job_id":null,"html_url":"https://github.com/beenotung/timezone-date","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/beenotung/timezone-date","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Ftimezone-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Ftimezone-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Ftimezone-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Ftimezone-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beenotung","download_url":"https://codeload.github.com/beenotung/timezone-date/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Ftimezone-date/sbom","scorecard":{"id":230305,"data":{"date":"2025-08-11","repo":{"name":"github.com/beenotung/timezone-date","commit":"99079e8a0dd3adc1e74921a09d3cdf109f122cf7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T04:43:35.664Z","repository_id":57141448,"created_at":"2025-08-17T04:43:35.664Z","updated_at":"2025-08-17T04:43:35.664Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32432917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"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":["browser-compatibility","date","nodejs","timezone","typescript"],"created_at":"2025-01-01T05:40:57.704Z","updated_at":"2026-04-29T16:03:03.003Z","avatar_url":"https://github.com/beenotung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timezone-date.ts\n\nEnhancement of Date class with better timezone support.\n\n[![npm Package Version](https://img.shields.io/npm/v/timezone-date.ts)](https://www.npmjs.com/package/timezone-date.ts)\n[![npm Package Version](https://img.shields.io/bundlephobia/min/timezone-date.ts)](https://bundlephobia.com/package/timezone-date.ts)\n[![npm Package Version](https://img.shields.io/bundlephobia/minzip/timezone-date.ts)](https://bundlephobia.com/package/timezone-date.ts)\n\n## Features\n\n- Compliant to `Date` methods\n- Allow changing timezone anytime\n- Support both numeric timezone offsets and IANA timezone identifiers (e.g., \"America/New_York\")\n- Automatic Daylight Saving Time (DST) handling with IANA timezones\n- Typescript support\n- Tiny code base (below 1KB minizipped)\n\n## Example\n\nJump between timezones:\n\n```typescript\nimport { TimezoneDate } from 'timezone-date.ts'\n\nconst d = TimezoneDate.fromDate(new Date('2020-04-21T10:00:00.000Z'))\n\nd.timezone = 0\nd.getHours() // 10\n\nd.timezone = +8\nd.getHours() // 18\n\nd.getTimezoneOffset() // -480 (in mintes, same format as Native Date)\n\nd.setHours(9)\nd.timezone++\nd.getHours() // 10\nd.toLocaleTimeString() // '10:00:00 AM'\n```\n\nSet a specific time (e.g. from UI input)\n\n```typescript\nlet date = new TimezoneDate()\ndate.timezone = +8\ndate.setFullYear(2020, 11 - 1, 28)\ndate.setHours(9, 2, 38)\nconsole.log(date.toString()) // Sat Nov 28 2020 09:02:38 GMT+0800 (Hong Kong Standard Time)\n```\n\nUsing IANA timezone identifiers with automatic DST handling:\n\n```typescript\nimport { TimezoneDate } from 'timezone-date.ts'\n\nlet date = new TimezoneDate()\ndate.timezone = 'America/New_York' // IANA timezone identifier\n\n// Summer time (EDT, UTC-4)\ndate.setTime(new Date('2025-06-01T12:00:00Z').getTime())\ndate.getTimezoneOffset() / 60 // -4 (EDT)\ndate.toLocaleString('en-US') // \"6/1/2025, 8:00:00 AM\"\n\n// Winter time (EST, UTC-5)\ndate.setTime(new Date('2025-12-01T12:00:00Z').getTime())\ndate.getTimezoneOffset() / 60 // -5 (EST)\ndate.toLocaleString('en-US') // \"12/1/2025, 7:00:00 AM\"\n```\n\nUsing the exported utility function:\n\n```typescript\nimport { getTimezoneOffsetForIANA } from 'timezone-date.ts'\n\nconst time = new Date('2025-06-01T12:00:00Z').getTime()\nconst offset = getTimezoneOffsetForIANA('America/New_York', time)\nconsole.log(offset) // -4 (hours, EDT in summer)\n```\n\n## Installation\n\n```bash\nnpm i timezone-date.ts\n```\n\n## Construction\n\n```typescript\nimport { TimezoneDate } from 'timezone-date.ts'\n\n/* custom timezone (numeric offset) */\nnew TimezoneDate(Date.now(), { timezone: +8 })\n\n/* custom timezone (IANA identifier) */\nnew TimezoneDate(Date.now(), { timezone: 'America/New_York' })\n\n/* default timezone (in the environment) */\nnew TimezoneDate() // current time\nnew TimezoneDate(Date.now())\nTimezoneDate.fromTime(Date.now())\nTimezoneDate.fromDate(new Date())\nTimezoneDate.from(Date.now()) // from Date or timestamp\n```\n\n## Timezone Format\n\nThe `timezone` property accepts:\n\n- **Numeric offset** (in hours): `+8`, `-5`, `0`, etc.\n  - Fixed offset, does not handle DST automatically\n- **IANA timezone identifier**: `\"America/New_York\"`, `\"Asia/Hong_Kong\"`, `\"Europe/London\"`, etc.\n  - Automatically handles Daylight Saving Time (DST)\n  - Uses the browser's/Node.js's built-in timezone database\n\n## Exported Functions\n\n### `getTimezoneOffsetForIANA(timezone: string, time: number): number`\n\nGet the timezone offset in hours for a given IANA timezone identifier at a specific time.\n\n```typescript\nimport { getTimezoneOffsetForIANA } from 'timezone-date.ts'\n\nconst time = new Date('2025-06-01T12:00:00Z').getTime()\nconst offset = getTimezoneOffsetForIANA('America/New_York', time)\n// Returns -4 (EDT in summer) or -5 (EST in winter)\n```\n\n## License\n\nThis is free open sourced software (FOSS), with [BSD 2-Clause License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Ftimezone-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeenotung%2Ftimezone-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Ftimezone-date/lists"}