{"id":19009190,"url":"https://github.com/gamtiq/weekstart","last_synced_at":"2025-10-28T19:38:46.527Z","repository":{"id":53757180,"uuid":"102781861","full_name":"gamtiq/weekstart","owner":"gamtiq","description":"Library to get first day of week.","archived":false,"fork":false,"pushed_at":"2023-02-24T13:07:57.000Z","size":874,"stargazers_count":20,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T09:04:33.987Z","etag":null,"topics":["country","day","first","locale","region","start","week"],"latest_commit_sha":null,"homepage":"https://gamtiq.github.io/weekstart/","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/gamtiq.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","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":"2017-09-07T20:19:15.000Z","updated_at":"2024-11-17T22:22:33.000Z","dependencies_parsed_at":"2024-06-18T15:20:58.653Z","dependency_job_id":"ba7c1ab9-520c-494e-a668-75a445a19799","html_url":"https://github.com/gamtiq/weekstart","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"1143307da8edab1901535b1936ea8401af5db3e0"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fweekstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fweekstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fweekstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fweekstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gamtiq","download_url":"https://codeload.github.com/gamtiq/weekstart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337909,"owners_count":21414102,"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","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":["country","day","first","locale","region","start","week"],"created_at":"2024-11-08T19:07:04.361Z","updated_at":"2025-10-28T19:38:46.476Z","avatar_url":"https://github.com/gamtiq.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# weekstart \u003ca name=\"start\"\u003e\u003c/a\u003e\n\n[![NPM version](https://badge.fury.io/js/weekstart.png)](http://badge.fury.io/js/weekstart)\n\nLibrary to get first day of week.\n\n```js\ngetWeekStartByRegion('MAC');   // 0\n\ngetWeekStartByLocale('arq');   // 6\n```\n\nThe library is based on the following data from Unicode (especially from Common Locale Data Repository) and from ISO:\n* [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html)\n* [https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/supplemental/weekData.json](https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/supplemental/weekData.json)\n* [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html)\n* [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html)\n* [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/scripts_languages_and_territories.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/scripts_languages_and_territories.html)\n* [http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers](http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers)\n* [https://www.iso.org/iso-3166-country-codes.html](https://www.iso.org/iso-3166-country-codes.html)\n\nThere are 2 variants of the library having identical [API](#api):\n* `main` - uses base mapping of language code to country code from [langRegionMap](https://github.com/gamtiq/weekstart/blob/master/src/langRegionMap.js).\n* `full` - uses full mapping of language code to country code from [fullLangRegionMap](https://github.com/gamtiq/weekstart/blob/master/src/fullLangRegionMap.js).\n\n[langRegionMap](https://github.com/gamtiq/weekstart/blob/master/src/langRegionMap.js) contains only main language codes.\nIt is data subset from [fullLangRegionMap](https://github.com/gamtiq/weekstart/blob/master/src/fullLangRegionMap.js).\n\n## Table of contents\n\n* [Installation](#install)\n* [Usage](#usage)\n* [Examples](#examples)\n* [API](#api)\n* [Contributing](#contributing)\n* [License](#license)\n\n## Installation \u003ca name=\"install\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n### Node\n\n    npm install weekstart\n\n### [Bower](http://bower.io)\n\n    bower install weekstart\n\n### AMD/UMD, \u0026lt;script\u0026gt;\n\nUse `dist/main.js` or `dist/min/main.js` (minified version).\nUse `dist/full.js` or `dist/min/full.js` (minified version) when you need full locale data.\n\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n### ECMAScript 6\n\n```js\nimport {getWeekStartByLocale, getWeekStartByRegion} from 'weekstart';\n```\n\nIf you need full data:\n\n```js\nimport {getWeekStartByLocale, getWeekStartByRegion} from 'weekstart/full';\n```\n\n### Node\n\n```js\nconst getWeekStartByLocale = require('weekstart').getWeekStartByLocale;\nconst getWeekStartByRegion = require('weekstart').getWeekStartByRegion;\n```\n\nIf you need full data:\n\n```js\nconst getWeekStartByLocale = require('weekstart/full').getWeekStartByLocale;\nconst getWeekStartByRegion = require('weekstart/full').getWeekStartByRegion;\n```\n\n### AMD/UMD\n\n```js\ndefine(['path/to/dist/main.js'], function(weekstart) {\n    const getWeekStartByLocale = weekstart.getWeekStartByLocale;\n    const getWeekStartByRegion = weekstart.getWeekStartByRegion;\n});\n```\n\nIf you need full data:\n\n```js\ndefine(['path/to/dist/full.js'], function(weekstart) {\n    const getWeekStartByLocale = weekstart.getWeekStartByLocale;\n    const getWeekStartByRegion = weekstart.getWeekStartByRegion;\n});\n```\n\n### Bower, \u0026lt;script\u0026gt;\n\n```html\n\u003c!-- Use bower_components/weekstart/dist/main.js and bower_components/weekstart/dist/full.js if the library was installed by Bower --\u003e\n\u003cscript type=\"text/javascript\" src=\"path/to/dist/main.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n    // weekstart is available via weekstart field of window object\n    const getWeekStartByLocale = weekstart.getWeekStartByLocale;\n    const getWeekStartByRegion = weekstart.getWeekStartByRegion;\n\u003c/script\u003e\n```\n\nIf you need full data use `path/to/dist/full.js` instead of `path/to/dist/main.js`.\n\n## Examples \u003ca name=\"examples\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n```js\ngetWeekStartByRegion('dj');   // 6\ngetWeekStartByRegion('No');   // 1\ngetWeekStartByRegion('CAN');   // 0\ngetWeekStartByRegion(462);   // 5\n\ngetWeekStartByLocale('Jam');   // 0\ngetWeekStartByLocale('Fa');   // 6\ngetWeekStartByLocale('vi');   // 1\ngetWeekStartByLocale('es_MX');   // 0\ngetWeekStartByLocale('az-Arab-IRN');   // 6\n```\n\nIn the following examples results are given for the function from `full.js`.\nThe same calls for the function from `main.js` will return `1`.\n\n```js\ngetWeekStartByLocale('CCP');   // 0\ngetWeekStartByLocale('UZ-arab');   // 6\n```\n\n## API \u003ca name=\"api\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n#### getWeekStartByLocale(locale): number\n\nReturn first day of week for locale identifier:\n0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday.\n\n#### getWeekStartByRegion(regionCode): number\n\nReturn first day of week for country/region code:\n0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday.\n\nSee [`docs`](https://gamtiq.github.io/weekstart/) for details.\n\n## Contributing \u003ca name=\"contributing\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\nIn lieu of a formal styleguide, take care to maintain the existing coding style.\nAdd unit tests for any new or changed functionality.\nLint and test your code.\n\n## License \u003ca name=\"license\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\nLicensed under the [MIT license](https://github.com/gamtiq/weekstart/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamtiq%2Fweekstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgamtiq%2Fweekstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamtiq%2Fweekstart/lists"}