{"id":13746906,"url":"https://github.com/iansinnott/jstz","last_synced_at":"2025-08-31T21:41:52.710Z","repository":{"id":57286493,"uuid":"41992696","full_name":"iansinnott/jstz","owner":"iansinnott","description":"🌐Timezone detection for JavaScript","archived":false,"fork":false,"pushed_at":"2018-12-29T09:39:28.000Z","size":44,"stargazers_count":177,"open_issues_count":13,"forks_count":33,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-09T09:21:02.438Z","etag":null,"topics":["jstimezonedetect","timezone"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iansinnott.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}},"created_at":"2015-09-06T07:15:56.000Z","updated_at":"2025-07-10T13:47:14.000Z","dependencies_parsed_at":"2022-09-20T00:20:59.673Z","dependency_job_id":null,"html_url":"https://github.com/iansinnott/jstz","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/iansinnott/jstz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjstz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjstz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjstz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjstz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iansinnott","download_url":"https://codeload.github.com/iansinnott/jstz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjstz/sbom","scorecard":{"id":478641,"data":{"date":"2025-08-11","repo":{"name":"github.com/iansinnott/jstz","commit":"528b77e9f827ec359cd3f08abe05ff27b597c4d5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"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":"Code-Review","score":3,"reason":"Found 7/21 approved changesets -- score normalized to 3","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":"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":"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":"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":"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":"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":"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":"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":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENCE:0","Warn: project license file does not contain an FSF or OSI license."],"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T15:58:10.969Z","repository_id":57286493,"created_at":"2025-08-19T15:58:10.969Z","updated_at":"2025-08-19T15:58:10.969Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273046461,"owners_count":25036179,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["jstimezonedetect","timezone"],"created_at":"2024-08-03T06:01:04.186Z","updated_at":"2025-08-31T21:41:52.652Z","avatar_url":"https://github.com/iansinnott.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# JSTZ\n\n[![Circle CI](https://img.shields.io/circleci/project/iansinnott/jstz.svg)](https://circleci.com/gh/iansinnott/jstz)\n[![JSTZ on NPM](https://img.shields.io/npm/v/jstz.svg)](https://www.npmjs.com/package/jstz)\n\nTimezone detection for JavaScript\n\n## What\n\nThis library allows you to detect a user's timezone from within their browser. It is often useful to use JSTZ in combination with a timezone parsing library such as [Moment Timezone][].\n\nThis library is an unofficial fork of [pellepim/jstimezonedetect][jstimezonedetect]. The original library works well and can be used via [CDN][], but it was not configured to work with NPM. This meant the library was less accessible because it could not be retrieved with a simple npm command or included as a dependency in `package.json`. Thus this fork was born.\n\n**Sidenote:** If you're wondering why this isn't an actual GitHub fork it's because the original project uses Mercurial and is hosted on BitBucket.\n\n## Why\n\nDealing with timezones can be a pain. Libraries like [Moment Timezone][] help a lot with the parsing side of things, but if you want to _detect_ the users timezone you would normally have to do it manually. That's where this library comes in.\n\n## Usage\n\n```\n$ npm install --save jstz\n```\n\nIn your JS file:\n\n```js\nimport jstz from 'jstz';\nconst timezone = jstz.determine();\ntimezone.name(); // =\u003e 'America/Los_Angeles' (or whatever your user's timezone is)\n```\n\nOr if you prefer ES5:\n\n```js\nvar jstz = require('jstz');\nvar timezone = jstz.determine();\ntimezone.name(); // =\u003e 'America/Los_Angeles' (or whatever your user's timezone is)\n```\n\n**Note:** If you're not using a module system such as Webpack or Browserify then I recommend you use the original library delivered via CDNJS:\n\n```html\n\u003c!doctype html\u003e\n\u003cscript src='https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js'\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var jstz = require('jstz');\n  var timezone = jstz.determine();\n  console.log('Your timezone is: ' + timezone.name());\n\u003c/script\u003e\n```\n\n## Docs\n\nTo learn more about the library head on over to the original library's repo: \u003chttps://bitbucket.org/pellepim/jstimezonedetect\u003e\n\n## Use With Rails\n\n`jstz` is an excellent library to use by Rails to determine the time zone of the browser (e.g. the gem [browser-timezone-rails](https://github.com/kbaum/browser-timezone-rails)), but some extra tweaking is necessary to make them play nicely together.\n\nA common use case is to provide a time zone select (`f.time_zone_select`) where it defaults to the user's current time zone. That Rails helper uses `ActiveSupport::TimeZone`, which provides a more human-readable subset of the time zones (e.g. `Eastern Time (US \u0026 Canada)` instead of `America/New_York`). `jstz` doesn't know about this subset, so we need to use the `TZInfo` associated with those `ActiveSupport::TimeZone`s to have a correct translation.\n\nThis method could go on your base application controller, assuming you're setting a browser cookie `browser_time_zone`:\n\n```ruby\n# Returns the client's time zone based on a cookie set by the browser, defaults to application time zone\ndef browser_time_zone\n  browser_tz = ActiveSupport::TimeZone.find_tzinfo(cookies[:browser_time_zone])\n  ActiveSupport::TimeZone.all.find { |zone| zone.tzinfo == browser_tz } || Time.zone\nrescue TZInfo::UnknownTimezone, TZInfo::InvalidTimezoneIdentifier\n  Time.zone\nend\n```\n\nThen in the view you could do something like:\n\n```erb\n\u003c%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones,\n                       default: browser_time_zone.name %\u003e\n```\n\nFurther complicating matters, `jstz` uses the forward-thinking `window.Intl`, which has an awareness of time zones other than what is in Rails, so time zones such as `America/Montreal` from `Intl` will not be found in Rails. If you're using `jstz` with Rails, you will want to tempoarily \"silence\" the use of `Intl` when reading from `jstz`. Here's a code snippet:\n\n```js\nexport function findTimeZone() {\n  const oldIntl = window.Intl\n  try {\n    window.Intl = undefined\n    const tz = jstz.determine().name()\n    window.Intl = oldIntl\n    return tz\n  } catch (e) {\n    // sometimes (on android) you can't override intl\n    return jstz.determine().name()\n  }\n}\n```\n\n## Credits (from the original README.md)\n\nThanks to\n\n  - [Josh Fraser][5] for the original idea\n  - [Brian Donovan][6] for making jstz CommonJS compliant\n  - [Ilya Sedlovsky][7] for help with namespacing\n  - [Jordan Magnuson][9] for adding to cdnjs, documentation tags, and for reporting important issues\n  - [Matt Johnson][11] for adding support for the Internationalization API\n\nOther contributors:\n[Gilmore Davidson][8]\n\n[jstimezonedetect]: https://bitbucket.org/pellepim/jstimezonedetect\n[CDN]: https://cdnjs.com/libraries/jstimezonedetect\n[Moment Timezone]: http://momentjs.com/timezone/\n\n[1]: http://www.iana.org/time-zones\n[3]: https://bitbucket.org/pellepim/jstimezonedetect/src\n[4]: https://github.com/gruntjs/grunt\n[5]: http://www.onlineaspect.com/about/\n[6]: https://bitbucket.org/eventualbuddha\n[7]: https://bitbucket.org/purebill\n[8]: https://bitbucket.org/gdavidson\n[9]: https://github.com/JordanMagnuson\n[11]: https://bitbucket.org/mj1856\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiansinnott%2Fjstz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiansinnott%2Fjstz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiansinnott%2Fjstz/lists"}