From 72db65623d1d2ce348ea57c128581246bdc221c7 Mon Sep 17 00:00:00 2001 From: Bart Krakowski Date: Wed, 3 Jul 2024 22:09:00 +0200 Subject: [PATCH] feat: getWeekInfo polyfill --- .github/workflows/publish.yml | 33 + .gitignore | 24 + README.md | 46 + index.html | 13 + package.json | 18 + pnpm-lock.yaml | 484 +++++++++ public/vite.svg | 1 + src/global.d.ts | 8 + src/index.ts | 27 + src/types.ts | 5 + src/weekInfoData.ts | 1834 +++++++++++++++++++++++++++++++++ tsconfig.json | 24 + vite.config.ts | 9 + 13 files changed, 2526 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 index.html create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 public/vite.svg create mode 100644 src/global.d.ts create mode 100644 src/index.ts create mode 100644 src/types.ts create mode 100644 src/weekInfoData.ts create mode 100644 tsconfig.json create mode 100644 vite.config.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..04412ac --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Publish + +on: + push: + branches: + - main + tags: + - 'v*.*.*' + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + registry-url: 'https://registry.npmjs.org/' + + - name: Install dependencies + run: npm install + + - name: Build package + run: npm run build + + - name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/README.md b/README.md new file mode 100644 index 0000000..97f7dcb --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# `Intl.Locale.prototype.getWeekInfo()` polyfill + +This package provides a polyfill for the Intl.Locale API, adding the getWeekInfo method if it is not already available in the environment. + +## Installation + +```sh +npm install intl-locale-get-week-info +``` + +## Usage + +```js +require('intl-locale-get-week-info'); + +const he = new Intl.Locale("he"); // Hebrew (Israel) +console.log(he.getWeekInfo()); // { firstDay: 7, weekend: [5, 6], minimalDays: 1 } + +const af = new Intl.Locale("af"); // Afrikaans (South Africa) +console.log(af.getWeekInfo()); // { firstDay: 7, weekend: [6, 7], minimalDays: 1 } + +const enGB = new Intl.Locale("en-GB"); // English (United Kingdom) +console.log(enGB.getWeekInfo()); // { firstDay: 1, weekend: [6, 7], minimalDays: 4 } + +const arAF = new Intl.Locale("ar-AF"); // Arabic (Afghanistan) +console.log(arAF.getWeekInfo()); // { firstDay: 6, weekend: [4, 5], minimalDays: 1 } + +const dvMV = new Intl.Locale("dv-MV"); // Divehi (Maldives) +console.log(dvMV.getWeekInfo()); // { firstDay: 5, weekend: [6, 7], minimalDays: 1 } +``` + +## API + +`Intl.Locale.prototype.getWeekInfo +`Returns an object containing week information for the locale. + +### Returns: +- `WeekInfo` +An object with the following properties: + - `firstDay (number)` + An integer between 1 (Monday) and 7 (Sunday) indicating the first day of the week for the locale. Commonly 1, 5, 6, or 7. + - `weekend (number[])` + An array of integers between 1 and 7 indicating the weekend days for the locale. This is usually continuous because UTS 35 stores weekendStart and weekendEnd instead. + - `minimalDays (number)` + An integer between 1 and 7 (commonly 1 and 4) indicating the minimal days required in the first week of a month or year, for week-of-year or week-of-month calculations (e.g. The 20th week of the year). For example, in the [ISO 8601 calendar](https://en.wikipedia.org/wiki/ISO_8601), the first week of a year must have at least 4 days in this year, so if January 1 is a Friday, Saturday, or Sunday, it will be numbered as part of the last week of the previous year. + diff --git a/index.html b/index.html new file mode 100644 index 0000000..44a9335 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + TS + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..6daa423 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "getweekinfo-polyfill", + "author": { + "name": "Bart Krakowski", + "email": "bartlomiej@krakowski.dev" + }, + "version": "1.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "typescript": "^5.5.3", + "vite": "^5.3.3" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..c899cd2 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,484 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +devDependencies: + typescript: + specifier: ^5.5.3 + version: 5.5.3 + vite: + specifier: ^5.3.3 + version: 5.3.3 + +packages: + + /@esbuild/aix-ppc64@0.21.5: + resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64@0.21.5: + resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.21.5: + resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.21.5: + resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.21.5: + resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.21.5: + resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.21.5: + resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.21.5: + resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.21.5: + resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.21.5: + resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.21.5: + resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.21.5: + resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.21.5: + resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.21.5: + resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.21.5: + resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.21.5: + resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.21.5: + resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.21.5: + resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.21.5: + resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.21.5: + resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.21.5: + resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.21.5: + resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.21.5: + resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-android-arm-eabi@4.18.0: + resolution: {integrity: sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-android-arm64@4.18.0: + resolution: {integrity: sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-arm64@4.18.0: + resolution: {integrity: sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-x64@4.18.0: + resolution: {integrity: sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-gnueabihf@4.18.0: + resolution: {integrity: sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-musleabihf@4.18.0: + resolution: {integrity: sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.18.0: + resolution: {integrity: sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-musl@4.18.0: + resolution: {integrity: sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-powerpc64le-gnu@4.18.0: + resolution: {integrity: sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.18.0: + resolution: {integrity: sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-s390x-gnu@4.18.0: + resolution: {integrity: sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.18.0: + resolution: {integrity: sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-musl@4.18.0: + resolution: {integrity: sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.18.0: + resolution: {integrity: sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.18.0: + resolution: {integrity: sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-x64-msvc@4.18.0: + resolution: {integrity: sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@types/estree@1.0.5: + resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + dev: true + + /esbuild@0.21.5: + resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.21.5 + '@esbuild/android-arm': 0.21.5 + '@esbuild/android-arm64': 0.21.5 + '@esbuild/android-x64': 0.21.5 + '@esbuild/darwin-arm64': 0.21.5 + '@esbuild/darwin-x64': 0.21.5 + '@esbuild/freebsd-arm64': 0.21.5 + '@esbuild/freebsd-x64': 0.21.5 + '@esbuild/linux-arm': 0.21.5 + '@esbuild/linux-arm64': 0.21.5 + '@esbuild/linux-ia32': 0.21.5 + '@esbuild/linux-loong64': 0.21.5 + '@esbuild/linux-mips64el': 0.21.5 + '@esbuild/linux-ppc64': 0.21.5 + '@esbuild/linux-riscv64': 0.21.5 + '@esbuild/linux-s390x': 0.21.5 + '@esbuild/linux-x64': 0.21.5 + '@esbuild/netbsd-x64': 0.21.5 + '@esbuild/openbsd-x64': 0.21.5 + '@esbuild/sunos-x64': 0.21.5 + '@esbuild/win32-arm64': 0.21.5 + '@esbuild/win32-ia32': 0.21.5 + '@esbuild/win32-x64': 0.21.5 + dev: true + + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + + /picocolors@1.0.1: + resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + dev: true + + /postcss@8.4.39: + resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.1 + source-map-js: 1.2.0 + dev: true + + /rollup@4.18.0: + resolution: {integrity: sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + dependencies: + '@types/estree': 1.0.5 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.18.0 + '@rollup/rollup-android-arm64': 4.18.0 + '@rollup/rollup-darwin-arm64': 4.18.0 + '@rollup/rollup-darwin-x64': 4.18.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.18.0 + '@rollup/rollup-linux-arm-musleabihf': 4.18.0 + '@rollup/rollup-linux-arm64-gnu': 4.18.0 + '@rollup/rollup-linux-arm64-musl': 4.18.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.18.0 + '@rollup/rollup-linux-riscv64-gnu': 4.18.0 + '@rollup/rollup-linux-s390x-gnu': 4.18.0 + '@rollup/rollup-linux-x64-gnu': 4.18.0 + '@rollup/rollup-linux-x64-musl': 4.18.0 + '@rollup/rollup-win32-arm64-msvc': 4.18.0 + '@rollup/rollup-win32-ia32-msvc': 4.18.0 + '@rollup/rollup-win32-x64-msvc': 4.18.0 + fsevents: 2.3.3 + dev: true + + /source-map-js@1.2.0: + resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} + engines: {node: '>=0.10.0'} + dev: true + + /typescript@5.5.3: + resolution: {integrity: sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + + /vite@5.3.3: + resolution: {integrity: sha512-NPQdeCU0Dv2z5fu+ULotpuq5yfCS1BzKUIPhNbP3YBfAMGJXbt2nS+sbTFu+qchaqWTD+H3JK++nRwr6XIcp6A==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + esbuild: 0.21.5 + postcss: 8.4.39 + rollup: 4.18.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true diff --git a/public/vite.svg b/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/global.d.ts b/src/global.d.ts new file mode 100644 index 0000000..697d770 --- /dev/null +++ b/src/global.d.ts @@ -0,0 +1,8 @@ +import { WeekInfo } from "./types" + +declare namespace Intl { + interface Locale { + getWeekInfo: () => WeekInfo + weekInfo?: WeekInfo + } +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..0c35731 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,27 @@ +;(function () { + // Chrome & Safari + if ('weekInfo' in Intl.Locale.prototype && typeof Intl.Locale.prototype.getWeekInfo !== 'function') { + Intl.Locale.prototype.getWeekInfo = function () { + return this.weekInfo + } + } + // Firefox + if (typeof Intl.Locale.prototype.getWeekInfo !== 'function') { + import('./weekInfoData').then(({ weekInfoData }) => { + Intl.Locale.prototype.getWeekInfo = function () { + const locale = this.toString().toLowerCase() + + const match = + weekInfoData[locale] || + weekInfoData[locale.split('-')[0]] || + weekInfoData['default'] + + return { + firstDay: match?.firstDay, + weekend: match?.weekend, + minimalDays: match?.minimalDays, + } + } + }) + } +})() diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..ea3c58b --- /dev/null +++ b/src/types.ts @@ -0,0 +1,5 @@ +export interface WeekInfo { + firstDay: number + weekend: number[] + minimalDays: number +} diff --git a/src/weekInfoData.ts b/src/weekInfoData.ts new file mode 100644 index 0000000..a910c36 --- /dev/null +++ b/src/weekInfoData.ts @@ -0,0 +1,1834 @@ +import { WeekInfo } from "./types"; + +export const weekInfoData: Record = { + af: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ak: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + sq: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + am: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ar: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + hy: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + as: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + asa: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + az: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + bm: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + eu: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + be: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + bem: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + bez: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + bn: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + bs: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + bg: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + my: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ca: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + tzm: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + chr: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + cgg: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + zh: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kw: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + hr: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + cs: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + da: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + nl: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ebu: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + en: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + eo: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + et: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ee: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + fo: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + fil: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + fi: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + fr: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ff: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + gl: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + lg: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ka: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + de: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + el: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + gu: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + guz: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ha: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + haw: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + he: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + hi: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + hu: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + is: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ig: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + id: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ga: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + it: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ja: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kea: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kab: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kl: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kln: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kam: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kn: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kk: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + km: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ki: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + rw: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kok: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ko: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + khq: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ses: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + lag: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + lv: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + lt: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + luo: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + luy: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + mk: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + jmc: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + kde: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + mg: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ms: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ml: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + mt: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + gv: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + mr: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + mas: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + mer: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + mfe: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + naq: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ne: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + nd: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + nb: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + nn: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + nyn: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + or: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + om: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ps: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + fa: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + pl: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + pt: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + pa: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ro: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + rm: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + rof: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ru: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + rwk: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + saq: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + sg: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + seh: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + sr: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + sn: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ii: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + si: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + sk: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + sl: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + xog: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + so: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + es: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + sw: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + sv: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + gsw: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + shi: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + dav: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ta: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + te: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + teo: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + th: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + bo: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ti: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + to: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + tr: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + uk: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + ur: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + uz: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + vi: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + vun: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + cy: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + yo: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + zu: { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'af-ZA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'am-ET': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-AE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-BH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-DZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-EG': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-IQ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-JO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-KW': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-LB': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-LY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-MA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'arn-CL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-OM': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-QA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-SA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-SD': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-SY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-TN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ar-YE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'as-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'az-az': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'az-Cyrl-AZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'az-Latn-AZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ba-RU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'be-BY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'bg-BG': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'bn-BD': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'bn-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'bo-CN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'br-FR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'bs-Cyrl-BA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'bs-Latn-BA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ca-ES': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'co-FR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'cs-CZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'cy-GB': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'da-DK': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'de-AT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'de-CH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'de-DE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'de-LI': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'de-LU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'dsb-DE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'dv-MV': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'el-CY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'el-GR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-029': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-AU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-BZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-CA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-cb': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-GB': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-IE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-JM': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-MT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-MY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-NZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-PH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-SG': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-TT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-US': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-ZA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'en-ZW': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-AR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-BO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-CL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-CO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-CR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-DO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-EC': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-ES': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-GT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-HN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-MX': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-NI': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-PA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-PE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-PR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-PY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-SV': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-US': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-UY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'es-VE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'et-EE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'eu-ES': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fa-IR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fi-FI': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fil-PH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fo-FO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fr-BE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fr-CA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fr-CH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fr-FR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fr-LU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fr-MC': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'fy-NL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ga-IE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'gd-GB': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'gd-ie': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'gl-ES': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'gsw-FR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'gu-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ha-Latn-NG': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'he-IL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'hi-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'hr-BA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'hr-HR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'hsb-DE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'hu-HU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'hy-AM': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'id-ID': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ig-NG': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ii-CN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'in-ID': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'is-IS': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'it-CH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'it-IT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'iu-Cans-CA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'iu-Latn-CA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'iw-IL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ja-JP': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ka-GE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'kk-KZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'kl-GL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'km-KH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'kn-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'kok-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ko-KR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ky-KG': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'lb-LU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'lo-LA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'lt-LT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'lv-LV': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'mi-NZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'mk-MK': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ml-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'mn-MN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'mn-Mong-CN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'moh-CA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'mr-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ms-BN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ms-MY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'mt-MT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'nb-NO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ne-NP': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'nl-BE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'nl-NL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'nn-NO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'no-no': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'nso-ZA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'oc-FR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'or-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'pa-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'pl-PL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'prs-AF': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ps-AF': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'pt-BR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'pt-PT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'qut-GT': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'quz-BO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'quz-EC': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'quz-PE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'rm-CH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ro-mo': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ro-RO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ru-mo': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ru-RU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'rw-RW': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sah-RU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sa-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'se-FI': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'se-NO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'se-SE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'si-LK': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sk-SK': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sl-SI': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sma-NO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sma-SE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'smj-NO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'smj-SE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'smn-FI': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sms-FI': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sq-AL': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-BA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-CS': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-Cyrl-BA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-Cyrl-CS': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-Cyrl-ME': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-Cyrl-RS': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-Latn-BA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-Latn-CS': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-Latn-ME': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-Latn-RS': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-ME': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-RS': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sr-sp': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sv-FI': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sv-SE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'sw-KE': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'syr-SY': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ta-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'te-IN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'tg-Cyrl-TJ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'th-TH': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'tk-TM': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'tlh-QS': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'tn-ZA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'tr-TR': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'tt-RU': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'tzm-Latn-DZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ug-CN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'uk-UA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'ur-PK': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'uz-Cyrl-UZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'uz-Latn-UZ': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'uz-uz': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'vi-VN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'wo-SN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'xh-ZA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'yo-NG': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'zh-CN': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'zh-HK': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'zh-MO': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'zh-SG': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'zh-TW': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, + 'zu-ZA': { + firstDay: 1, + weekend: [6, 7], + minimalDays: 4, + }, +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..7bb0db2 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..c62138e --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from 'vite' + +export default defineConfig({ + build: { + lib: { + entry: 'src/index.ts', + }, + }, +})