Gathering detailed insights and metrics for weekstart
Gathering detailed insights and metrics for weekstart
Gathering detailed insights and metrics for weekstart
Gathering detailed insights and metrics for weekstart
npm install weekstart
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
20 Stars
20 Commits
6 Forks
4 Watching
1 Branches
2 Contributors
Updated on 17 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-29.3%
10,710
Compared to previous day
Last week
-7%
64,026
Compared to previous week
Last month
4.1%
296,570
Compared to previous month
Last year
30.5%
3,460,058
Compared to previous year
Library to get first day of week.
1getWeekStartByRegion('MAC'); // 0 2 3getWeekStartByLocale('arq'); // 6
The library is based on the following data from Unicode (especially from Common Locale Data Repository) and from ISO:
There are 2 variants of the library having identical API:
main
- uses base mapping of language code to country code from langRegionMap.full
- uses full mapping of language code to country code from fullLangRegionMap.langRegionMap contains only main language codes. It is data subset from fullLangRegionMap.
npm install weekstart
bower install weekstart
Use dist/main.js
or dist/min/main.js
(minified version).
Use dist/full.js
or dist/min/full.js
(minified version) when you need full locale data.
1import {getWeekStartByLocale, getWeekStartByRegion} from 'weekstart';
If you need full data:
1import {getWeekStartByLocale, getWeekStartByRegion} from 'weekstart/full';
1const getWeekStartByLocale = require('weekstart').getWeekStartByLocale; 2const getWeekStartByRegion = require('weekstart').getWeekStartByRegion;
If you need full data:
1const getWeekStartByLocale = require('weekstart/full').getWeekStartByLocale; 2const getWeekStartByRegion = require('weekstart/full').getWeekStartByRegion;
1define(['path/to/dist/main.js'], function(weekstart) { 2 const getWeekStartByLocale = weekstart.getWeekStartByLocale; 3 const getWeekStartByRegion = weekstart.getWeekStartByRegion; 4});
If you need full data:
1define(['path/to/dist/full.js'], function(weekstart) { 2 const getWeekStartByLocale = weekstart.getWeekStartByLocale; 3 const getWeekStartByRegion = weekstart.getWeekStartByRegion; 4});
1<!-- Use bower_components/weekstart/dist/main.js and bower_components/weekstart/dist/full.js if the library was installed by Bower --> 2<script type="text/javascript" src="path/to/dist/main.js"></script> 3<script type="text/javascript"> 4 // weekstart is available via weekstart field of window object 5 const getWeekStartByLocale = weekstart.getWeekStartByLocale; 6 const getWeekStartByRegion = weekstart.getWeekStartByRegion; 7</script>
If you need full data use path/to/dist/full.js
instead of path/to/dist/main.js
.
1getWeekStartByRegion('dj'); // 6 2getWeekStartByRegion('No'); // 1 3getWeekStartByRegion('CAN'); // 0 4getWeekStartByRegion(462); // 5 5 6getWeekStartByLocale('Jam'); // 0 7getWeekStartByLocale('Fa'); // 6 8getWeekStartByLocale('vi'); // 1 9getWeekStartByLocale('es_MX'); // 0 10getWeekStartByLocale('az-Arab-IRN'); // 6
In the following examples results are given for the function from full.js
.
The same calls for the function from main.js
will return 1
.
1getWeekStartByLocale('CCP'); // 0 2getWeekStartByLocale('UZ-arab'); // 6
Return first day of week for locale identifier: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday.
Return first day of week for country/region code: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday.
See docs
for details.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
Licensed under the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/19 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
30 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More