diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index 2a3a349..0000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-version: 2.1
-
-jobs:
- build_and_test:
- docker:
- - image: cimg/node:current
- steps:
- - checkout
- - run: npm install
- - run: npm test
-
-workflows:
- build_and_test:
- jobs:
- - build_and_test
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..c76aa33
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,7 @@
+root = true
+
+[*.{js,ts}]
+charset = utf-8
+indent_size = 2
+indent_style = space
+trim_trailing_whitespace = true
diff --git a/.github/badges/coverage.svg b/.github/badges/coverage.svg
new file mode 100644
index 0000000..969d647
--- /dev/null
+++ b/.github/badges/coverage.svg
@@ -0,0 +1,20 @@
+
\ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..639bebf
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,80 @@
+name: CI
+
+on:
+ push:
+ branches: [ master, develop ]
+ pull_request:
+ branches: [ master, develop ]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 'lts/*'
+ cache: 'npm'
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Run linter
+ run: npm run lint
+
+ - name: Run tests
+ run: npm test
+
+ coverage:
+ runs-on: ubuntu-latest
+ if: github.event_name == 'push'
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 'lts/*'
+ cache: 'npm'
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Run tests with coverage
+ run: npm run test:coverage
+
+ - name: Read coverage summary
+ id: coverage
+ run: |
+ echo "pct=$(jq '.total.lines.pct' coverage/coverage-summary.json)" >> $GITHUB_OUTPUT
+
+ - name: Create badges directory
+ run: mkdir -p .github/badges
+
+ - name: Generate coverage badge
+ uses: emibcn/badge-action@v2.0.3
+ with:
+ label: 'coverage'
+ status: ${{ steps.coverage.outputs.pct }}%
+ color: ${{ fromJSON(steps.coverage.outputs.pct) >= 80 && 'green' || fromJSON(steps.coverage.outputs.pct) >= 60 && 'yellow' || 'red' }}
+ path: .github/badges/coverage.svg
+
+ - name: Commit coverage badge
+ run: |
+ git config --local user.email "action@github.com"
+ git config --local user.name "GitHub Action"
+ git add .github/badges/coverage.svg
+ git diff --staged --quiet || git commit -m "Update coverage badge"
+ git push
+
+ - name: Upload coverage reports
+ uses: actions/upload-artifact@v4
+ with:
+ name: coverage-report
+ path: coverage/
diff --git a/.gitignore b/.gitignore
index 9daa824..56de452 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,6 @@
.DS_Store
-node_modules
+.claude/
+CLAUDE.md
+coverage/
+dist/
+node_modules/
diff --git a/.npmignore b/.npmignore
deleted file mode 100644
index 9ecab2e..0000000
--- a/.npmignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.*
-benchmark
-rollup.config.mjs
-src
-test
-test.sh
diff --git a/EXTEND.md b/EXTEND.md
deleted file mode 100644
index b411f3c..0000000
--- a/EXTEND.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# Extension
-
-The easiest way to extend the default formatter and parser is to use plugins, but if the existing plugins do not meet your requirements, you can extend them yourself.
-
-## Token
-
-Tokens in this library have the following rules:
-
-- All of the characters must be the same alphabet (`A-Z, a-z`).
-
-```javascript
-'E' // Good
-'EE' // Good
-'EEEEEEEEEE' // Good, but why so long!?
-'EES' // Not good
-'???' // Not good
-```
-
-- It is case sensitive.
-
-```javascript
-'eee' // Good
-'Eee' // Not good
-```
-
-- Only tokens consisting of the following alphabets can be added to the parser.
-
-```javascript
-'Y' // Year
-'M' // Month
-'D' // Day
-'H' // 24-hour
-'A' // AM PM
-'h' // 12-hour
-'s' // Second
-'S' // Millisecond
-'Z' // Timezone offset
-```
-
-- Existing tokens cannot be overwritten.
-
-```javascript
-'YYY' // This is OK because the same token does not exists.
-'SSS' // This cannot be added because the exact same token exists.
-'EEE' // This is OK for the formatter, but cannot be added to the parser.
-```
-
-## Examples
-
-### Example 1
-
-Add `E` token to the formatter. This new token will output "decade" like this:
-
-```javascript
-const d1 = new Date(2020, 0, 1);
-const d2 = new Date(2019, 0, 1);
-
-date.format(d1, '[The year] YYYY [is] E[s].'); // => "The year 2020 is 2020s."
-date.format(d2, '[The year] YYYY [is] E[s].'); // => "The year 2019 is 2010s."
-```
-
-Source code example is here:
-
-```javascript
-const date = require('date-and-time');
-
-date.extend({
- formatter: {
- E: function (d) {
- return (d.getFullYear() / 10 | 0) * 10;
- }
- }
-});
-```
-
-### Example 2
-
-Add `MMMMM` token to the parser. This token ignores case:
-
-```javascript
-date.parse('Dec 25 2019', 'MMMMM DD YYYY'); // => December 25, 2019
-date.parse('dec 25 2019', 'MMMMM DD YYYY'); // => December 25, 2019
-date.parse('DEC 25 2019', 'MMMMM DD YYYY'); // => December 25, 2019
-```
-
-Source code example is here:
-
-```javascript
-const date = require('date-and-time');
-
-date.extend({
- parser: {
- MMMMM: function (str) {
- const mmm = this.res.MMM.map(m => m.toLowerCase());
- const result = this.find(mmm, str.toLowerCase());
- result.value++;
- return result;
- }
- }
-});
-```
-
-Extending the parser may be a bit difficult. Refer to the library source code to grasp the default behavior.
-
-## Caveats
-
-Note that switching locales or applying plugins after extending the library will be cleared all extensions. In such cases, you need to extend the library again.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 638dbf6..08dc7cf 100644
--- a/LICENSE
+++ b/LICENSE
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-
diff --git a/LOCALE.md b/LOCALE.md
deleted file mode 100644
index 9ae6ee0..0000000
--- a/LOCALE.md
+++ /dev/null
@@ -1,103 +0,0 @@
-# Locale
-
-By default, `format()` outputs month, day of week, and meridiem (AM / PM) in English, and functions such as `parse()` assume that a passed date time string is in English. Here it describes how to use other languages in these functions.
-
-## Usage
-
-- ES Modules:
-
-```javascript
-import date from 'date-and-time';
-import es from 'date-and-time/locale/es';
-
-date.locale(es); // Spanish
-date.format(new Date(), 'dddd D MMMM'); // => 'lunes 11 enero
-```
-
-- CommonJS:
-
-```javascript
-const date = require('date-and-time');
-const fr = require('date-and-time/locale/fr');
-
-date.locale(fr); // French
-date.format(new Date(), 'dddd D MMMM'); // => 'lundi 11 janvier'
-```
-
-- ES Modules for the browser:
-
-```html
-
-```
-
-- Older browser:
-
-```html
-
-
-
-
-```
-
-### NOTE
-
-- If you want to use ES Modules in Node.js without a transpiler, you need to add `"type": "module"` in your `package.json` or change your file extension from `.js` to `.mjs`.
-- The locale will be actually switched after executing the `locale()`.
-- You can also change the locale back to English by importing `en` locale:
-
-```javascript
-import en from 'date-and-time/locale/en';
-
-date.locale(en);
-```
-
-## Supported locale List
-
-At this time, it supports the following locales:
-
-```text
-Arabic (ar)
-Azerbaijani (az)
-Bengali (bn)
-Burmese (my)
-Chinese (zh-cn)
-Chinese (zh-tw)
-Czech (cs)
-Danish (dk)
-Dutch (nl)
-English (en)
-French (fr)
-German (de)
-Greek (el)
-Hindi (hi)
-Hungarian (hu)
-Indonesian (id)
-Italian (it)
-Japanese (ja)
-Javanese (jv)
-Kinyarwanda (rw)
-Korean (ko)
-Persian (fa)
-Polish (pl)
-Portuguese (pt)
-Punjabi (pa-in)
-Romanian (ro)
-Russian (ru)
-Serbian (sr)
-Spanish (es)
-Swedish (sv)
-Thai (th)
-Turkish (tr)
-Ukrainian (uk)
-Uzbek (uz)
-Vietnamese (vi)
-```
diff --git a/PLUGINS.md b/PLUGINS.md
deleted file mode 100644
index 2cbc7ec..0000000
--- a/PLUGINS.md
+++ /dev/null
@@ -1,488 +0,0 @@
-# Plugins
-
-This library is oriented towards minimalism, so it may seem to some developers to be lacking in features. The plugin is the most realistic solution to such dissatisfaction. By importing plugins, you can extend the functionality of this library, primarily the formatter and parser.
-
-*The formatter is used in `format()`, etc., the parser is used in `parse()`, `preparse()`, `isValid()`, etc.*
-
-## Usage
-
-- ES Modules:
-
-```javascript
-import date from 'date-and-time';
-// Import the plugin named "foobar".
-import foobar from 'date-and-time/plugin/foobar';
-
-// Apply the "foobar" to the library.
-date.plugin(foobar);
-```
-
-- CommonJS:
-
-```javascript
-const date = require('date-and-time');
-// Import the plugin named "foobar".
-const foobar = require('date-and-time/plugin/foobar');
-
-// Apply the "foobar" to the library.
-date.plugin(foobar);
-```
-
-- ES Modules for the browser:
-
-```html
-
-```
-
-- Older browser:
-
-```html
-
-
-
-
-
-```
-
-### Note
-
-- If you want to use ES Modules in Node.js without a transpiler, you need to add `"type": "module"` in your `package.json` or change your file extension from `.js` to `.mjs`.
-
-## Plugin List
-
-- [day-of-week](#day-of-week)
- - It adds *"dummy"* tokens for `day of week` to the parser.
-
-- [meridiem](#meridiem)
- - It adds various notations for `AM PM`.
-
-- [microsecond](#microsecond)
- - It adds tokens for microsecond to the parser.
-
-- [ordinal](#ordinal)
- - It adds ordinal notation of date to the formatter.
-
-- [timespan](#timespan)
- - It adds `timeSpan()` function that calculates the difference of two dates to the library.
-
-- [timezone](#timezone)
- - It adds `formatTZ()`, `parseTZ()`, `transformTZ()`, `addYearsTZ()`, `addMonthsTZ()` and `addDaysTZ()` that support `IANA time zone names` to the library.
-
-- [two-digit-year](#two-digit-year)
- - It adds two-digit year notation to the parser.
-
----
-
-### day-of-week
-
-It adds tokens for `day of week` to the parser. Although `day of week` is not significant information for the parser to identify a date, these tokens are sometimes useful. For example, when a string to be parsed contains a day of week, and you just want to skip it.
-
-**formatter:**
-
-There is no change.
-
-**parser:**
-
-| token | meaning | acceptable examples |
-|:------|:-----------|:--------------------|
-| dddd | long | Friday, Sunday |
-| ddd | short | Fri, Sun |
-| dd | very short | Fr, Su |
-
-```javascript
-const date = require('date-and-time');
-// Import "day-of-week" plugin as a named "day_of_week".
-const day_of_week = require('date-and-time/plugin/day-of-week');
-
-// Apply the "day_of_week" plugin to the library.
-date.plugin(day_of_week);
-
-// You can write like this.
-date.parse('Thursday, March 05, 2020', 'dddd, MMMM, D YYYY');
-// You can also write like this, but it is not versatile because length of day of week are variant.
-date.parse('Thursday, March 05, 2020', ' , MMMM, D YYYY');
-date.parse('Friday, March 06, 2020', ' , MMMM, D YYYY');
-```
-
----
-
-### meridiem
-
-It adds various notations for AM PM.
-
-**formatter:**
-
-| token | meaning | output examples |
-|:------|:------------------------|:----------------|
-| AA | uppercase with ellipsis | A.M., P.M. |
-| a | lowercase | am, pm |
-| aa | lowercase with ellipsis | a.m., p.m. |
-
-**parser:**
-
-| token | meaning | acceptable examples |
-|:------|:------------------------|:--------------------|
-| AA | uppercase with ellipsis | A.M., P.M. |
-| a | lowercase | am, pm |
-| aa | lowercase with ellipsis | a.m., p.m. |
-
-```javascript
-const date = require('date-and-time');
-// Import "meridiem" plugin.
-const meridiem = require('date-and-time/plugin/meridiem');
-
-// Apply "medidiem" plugin to the library.
-date.plugin(meridiem);
-
-// This is default behavior of the formatter.
-date.format(new Date(), 'hh:mm A'); // => '12:34 PM'
-
-// These are added tokens to the formatter.
-date.format(new Date(), 'hh:mm AA'); // => '12:34 P.M.'
-date.format(new Date(), 'hh:mm a'); // => '12:34 pm'
-date.format(new Date(), 'hh:mm aa'); // => '12:34 p.m.'
-
-// This is default behavior of the parser.
-date.parse('12:34 PM', 'hh:mm A'); // => Jan 1 1970 12:34:00
-
-// These are added tokens to the parser.
-date.parse('12:34 P.M.', 'hh:mm AA'); // => Jan 1 1970 12:34:00
-date.parse('12:34 pm', 'hh:mm a'); // => Jan 1 1970 12:34:00
-date.parse('12:34 p.m.', 'hh:mm aa'); // => Jan 1 1970 12:34:00
-```
-
-This plugin has a **breaking change**. In previous versions, the `A` token for the parser could parse various notations for AM PM, but in the new version, it can only parse `AM` and `PM`. For other notations, a dedicated token is now provided for each.
-
----
-
-### microsecond
-
-It adds tokens for microsecond to the parser. If a time string to be parsed contains microsecond, these tokens are useful. In JS, however, it is not supported microsecond accuracy, a parsed value is rounded to millisecond accuracy.
-
-**formatter:**
-
-There is no change.
-
-**parser:**
-
-| token | meaning | acceptable examples |
-|:-------|:----------------|:--------------------|
-| SSSSSS | high accuracy | 753123, 022113 |
-| SSSSS | middle accuracy | 75312, 02211 |
-| SSSS | low accuracy | 7531, 0221 |
-
-```javascript
-const date = require('date-and-time');
-// Import "microsecond" plugin.
-const microsecond = require('date-and-time/plugin/microsecond');
-
-// Apply "microsecond" plugin to the library.
-date.plugin(microsecond);
-
-// A date object in JavaScript supports `millisecond` (ms) like this:
-date.parse('12:34:56.123', 'HH:mm:ss.SSS');
-
-// 4 or more digits number sometimes seen is not `millisecond`, probably `microsecond` (μs):
-date.parse('12:34:56.123456', 'HH:mm:ss.SSSSSS');
-
-// 123456µs will be rounded to 123ms.
-```
-
----
-
-### ordinal
-
-It adds `DDD` token that output ordinal notation of date to the formatter.
-
-**formatter:**
-
-| token | meaning | output examples |
-|:------|:-------------------------|:--------------------|
-| DDD | ordinal notation of date | 1st, 2nd, 3rd, 31th |
-
-**parser:**
-
-There is no change.
-
-```javascript
-const date = require('date-and-time');
-// Import "ordinal" plugin.
-const ordinal = require('date-and-time/plugin/ordinal');
-
-// Apply "ordinal" plugin to the library.
-date.plugin(ordinal);
-
-// These are default behavior of the formatter.
-date.format(new Date(), 'MMM D YYYY'); // => Jan 1 2019
-date.format(new Date(), 'MMM DD YYYY'); // => Jan 01 2019
-
-// `DDD` token outputs ordinal number of date.
-date.format(new Date(), 'MMM DDD YYYY'); // => Jan 1st 2019
-```
-
----
-
-### timespan
-
-It adds `timeSpan()` function that calculates the difference of two dates to the library. This function is similar to `subtract()`, the difference is that it can format the calculation results.
-
-#### timeSpan(date1, date2)
-
-- @param {**Date**} date1 - A Date object
-- @param {**Date**} date2 - A Date object
-- @returns {**Object**} The result object of subtracting date2 from date1
-
-```javascript
-const date = require('date-and-time');
-// Import "timespan" plugin.
-const timespan = require('date-and-time/plugin/timespan');
-
-// Apply "timespan" plugin to the library.
-date.plugin(timespan);
-
-const now = new Date(2020, 2, 5, 1, 2, 3, 4);
-const new_years_day = new Date(2020, 0, 1);
-
-date.timeSpan(now, new_years_day).toDays('D HH:mm:ss.SSS'); // => '64 01:02:03.004'
-date.timeSpan(now, new_years_day).toHours('H [hours] m [minutes] s [seconds]'); // => '1537 hours 2 minutes 3 seconds'
-date.timeSpan(now, new_years_day).toMinutes('mmmmmmmmmm [minutes]'); // => '0000092222 minutes'
-```
-
-Like `subtract()`, `timeSpan()` returns an object with functions like this:
-
-| function | description |
-|:---------------|:------------------------|
-| toDays | Outputs in dates |
-| toHours | Outputs in hours |
-| toMinutes | Outputs in minutes |
-| toSeconds | Outputs in seconds |
-| toMilliseconds | Outputs in milliseconds |
-
-In these functions can be available some tokens to format the calculation result. Here are the tokens and their meanings:
-
-| function | available tokens |
-|:---------------|:-----------------|
-| toDays | D, H, m, s, S |
-| toHours | H, m, s, S |
-| toMinutes | m, s, S |
-| toSeconds | s, S |
-| toMilliseconds | S |
-
-| token | meaning |
-|:------|:------------|
-| D | date |
-| H | 24-hour |
-| m | minute |
-| s | second |
-| S | millisecond |
-
----
-
-### timezone
-
-It adds `formatTZ()`, `parseTZ()`, `transformTZ()`, `addYearsTZ()`, `addMonthsTZ()` and `addDaysTZ()` that support `IANA time zone names` (`America/Los_Angeles`, `Asia/Tokyo`, and so on) to the library.
-
-#### formatTZ(dateObj, arg[, timeZone])
-
-- @param {**Date**} dateObj - A Date object
-- @param {**string|Array.\**} arg - A format string or its compiled object
-- @param {**string**} [timeZone] - Output as this time zone
-- @returns {**string**} A formatted string
-
-`formatTZ()` is upward compatible with `format()`. Tokens available for `arg` are the same as those for `format()`. If `timeZone` is omitted, this function assumes `timeZone` to be the local time zone and outputs a string. This means that the result is the same as when `format()` is used.
-
-#### parseTZ(dateString, arg[, timeZone])
-
-- @param {**string**} dateString - A date and time string
-- @param {**string|Array.\**} arg - A format string or its compiled object
-- @param {**string**} [timeZone] - Input as this time zone
-- @returns {**Date**} A Date object
-
-`parseTZ()` is upward compatible with `parse()`. Tokens available for `arg` are the same as those for `parse()`. `timeZone` in this function is used as supplemental information. if `dateString` contains a time zone offset value (i.e. -0800, +0900), `timeZone` is not be used. If `dateString` doesn't contain a time zone offset value and `timeZone` is omitted, this function assumes `timeZone` to be the local time zone. This means that the result is the same as when `parse()` is used.
-
-#### transformTZ(dateString, arg1, arg2[, timeZone])
-
-- @param {**string**} dateString - A date and time string
-- @param {**string|Array.\**} arg1 - A format string before transformation or its compiled object
-- @param {**string|Array.\**} arg2 - A format string after transformation or its compiled object
-- @param {**string**} [timeZone] - Output as this time zone
-- @returns {**string**} A formatted string
-
-`transformTZ()` is upward compatible with `transform()`. `dateString` must itself contain a time zone offset value (i.e. -0800, +0900), otherwise this function assumes it is the local time zone. Tokens available for `arg1` are the same as those for `parse()`, also tokens available for `arg2` are the same as those for `format()`. `timeZone` is a `IANA time zone names`, which is required to output a new formatted string. If it is omitted, this function assumes `timeZone` to be the local time zone. This means that the result is the same as when `transform()` is used.
-
-#### addYearsTZ(dateObj, years[, timeZone])
-
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} years - The number of years to add
-- @param {**string**} [timeZone] - The time zone to use for the calculation
-- @returns {**Date**} The Date object after adding the specified number of years
-
-`addYearsTZ()` can calculate adding years in the specified time zone regardless of the execution environment.
-
-#### addMonthsTZ(dateObj, months[, timeZone])
-
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} months - The number of months to add
-- @param {**string**} [timeZone] - The time zone to use for the calculation
-- @returns {**Date**} The Date object after adding the specified number of months
-
-`addMonthsTZ()` can calculate adding months in the specified time zone regardless of the execution environment.
-
-#### addDaysTZ(dateObj, days[, timeZone])
-
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} days - The number of days to add
-- @param {**string**} [timeZone] - The time zone to use for the calculation
-- @returns {**Date**} The Date object after adding the specified number of days
-
-`addDaysTZ()` can calculate adding days in the specified time zone regardless of the execution environment.
-
-```javascript
-const date = require('date-and-time');
-// Import "timezone" plugin.
-const timezone = require('date-and-time/plugin/timezone');
-
-// Apply "timezone" plugin to the library.
-date.plugin(timezone);
-
-const d1 = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999)); // 2021-03-14T09:59:59.999Z
-date.formatTZ(d1, 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z', 'America/Los_Angeles'); // March 14 2021 1:59:59.999 UTC-0800
-
-const d2 = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0)); // 2021-03-14T10:00:00.000Z
-date.formatTZ(d2, 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z', 'America/Los_Angeles'); // March 14 2021 3:00:00.000 UTC-0700
-
-// Parses the date string assuming that the time zone is "Pacific/Honolulu" (UTC-1000).
-date.parseTZ('Sep 25 2021 4:00:00', 'MMM D YYYY H:mm:ss', 'Pacific/Honolulu'); // 2021-09-25T14:00:00.000Z
-
-// Parses the date string assuming that the time zone is "Europe/London" (UTC+0100).
-date.parseTZ('Sep 25 2021 4:00:00', 'MMM D YYYY H:mm:ss', 'Europe/London'); // 2021-09-25T03:00:00.000Z
-
-// Transforms the date string from EST (Eastern Standard Time) to PDT (Pacific Daylight Time).
-date.transformTZ('2021-11-07T03:59:59 UTC-0500', 'YYYY-MM-DD[T]HH:mm:ss [UTC]Z', 'MMMM D YYYY H:mm:ss UTC[Z]', 'America/Los_Angeles'); // November 7 2021 1:59:59 UTC-0700
-
-// Transforms the date string from PDT(Pacific Daylight Time) to JST (Japan Standard Time).
-date.transformTZ('2021-03-14T03:00:00 UTC-0700', 'YYYY-MM-DD[T]HH:mm:ss [UTC]Z', 'MMMM D YYYY H:mm:ss UTC[Z]', 'Asia/Tokyo'); // March 14 2021 19:00:00 UTC+0900
-```
-
-#### Caveats
-
-- This plugin uses the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) object to parse `IANA time zone names`. Note that if you use this plugin in older browsers, this may **NOT** be supported there. At least it does not work in IE.
-- If you don't need to use `IANA time zone names`, you should not use this plugin for performance reasons. Recommended to use `format()` and `parse()`.
-
-#### Start of DST (Daylight Saving Time)
-
-For example, in the US, when local standard time is about to reach `02:00:00` on Sunday, 14 March 2021, the clocks are set `forward` by 1 hour to `03:00:00` local daylight time instead. As a result, the time from `02:00:00` to `02:59:59` on 14 March 2021 does not exist. In such edge cases, `parseTZ()` will handle the case in the following way:
-
-```javascript
-date.parseTZ('Mar 14 2021 1:59:59', 'MMM D YYYY H:mm:ss', 'America/Los_Angeles'); // => 2021-03-14T09:59:59Z
-date.parseTZ('Mar 14 2021 3:00:00', 'MMM D YYYY H:mm:ss', 'America/Los_Angeles'); // => 2021-03-14T10:00:00Z
-
-// These times don't actually exist, but parseTZ() will handle as follows:
-date.parseTZ('Mar 14 2021 2:00:00', 'MMM D YYYY H:mm:ss', 'America/Los_Angeles'); // => 2021-03-14T10:00:00Z
-date.parseTZ('Mar 14 2021 2:59:59', 'MMM D YYYY H:mm:ss', 'America/Los_Angeles'); // => 2021-03-14T10:59:59Z
-```
-
-#### End of DST
-
-Also, when local daylight time is about to reach `02:00:00` on Sunday, 7 November 2021, the clocks are set `back` by 1 hour to `01:00:00` local standard time instead. As a result, the time from `01:00:00` to `01:59:59` on 7 November 2021 occurs twice. Because this time period happens twice, `parseTZ()` assumes that the time is the earlier one (during DST) in order to make the result unique:
-
-```javascript
-// This time is DST or PST? The parseTZ() always assumes that it is DST.
-date.parseTZ('Nov 7 2021 1:59:59', 'MMM D YYYY H:mm:ss', 'America/Los_Angeles'); // => 2021-11-07T08:59:59Z
-// This time is already PST.
-date.parseTZ('Nov 7 2021 2:00:00', 'MMM D YYYY H:mm:ss', 'America/Los_Angeles'); // => 2021-11-07T10:00:00Z
-```
-
-In the first example above, if you want `parseTZ()` to parse the time as PST, you need to pass a date string containing the time zone offset value. In this case, it is better to use `parse()` instead:
-
-```javascript
-date.parse('Nov 7 2021 1:59:59 -0800', 'MMM D YYYY H:mm:ss Z'); // => 2021-11-07T09:59:59Z
-```
-
-#### Token Extension
-
-This plugin also adds tokens for time zone name to the formatter.
-
-**formatter:**
-
-| token | meaning | output examples |
-|:------|:----------------------------|:----------------------|
-| z | time zone name abbreviation | PST, EST |
-| zz | time zone name | Pacific Standard Time |
-
-The `z` and `zz` are lowercase. Also, currently it does not support output other than English.
-
-**parser:**
-
-There is no change.
-
-```javascript
-const date = require('date-and-time');
-// Import "timezone" plugin.
-const timezone = require('date-and-time/plugin/timezone');
-
-// Apply "timezone" plugin to the library.
-date.plugin(timezone);
-
-const d1 = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
-date.format(d1, 'MMMM DD YYYY H:mm:ss.SSS zz');
-// March 14 2021 1:59:59.999 Pacific Standard Time
-
-date.format(d1, 'MMMM DD YYYY H:mm:ss.SSS zz', true);
-// March 14 2021 9:59:59.999 Coordinated Universal Time
-
-date.formatTZ(d1, 'MMMM DD YYYY H:mm:ss.SSS z', 'Asia/Tokyo');
-// March 14 2021 18:59:59.999 JST
-
-// Transforms the date string from EST (Eastern Standard Time) to PDT (Pacific Daylight Time).
-date.transform('2021-11-07T03:59:59 UTC-0500', 'YYYY-MM-DD[T]HH:mm:ss [UTC]Z', 'MMMM D YYYY H:mm:ss z');
-// November 7 2021 1:59:59 PDT
-```
----
-
-### two-digit-year
-
-It adds `YY` token to the parser. This token will convert the year 69 or earlier to 2000s, the year 70 or later to 1900s. In brief:
-
-| examples | result |
-|:------------------------|:-------|
-| 00, 01, 02, ..., 68, 69 | 2000s |
-| 70, 71, 72, ..., 98, 99 | 1900s |
-
-**formatter:**
-
-There is no change.
-
-**parser:**
-
-| token | meaning | acceptable examples |
-|:------|:---------------|:--------------------|
-| YY | two-digit year | 90, 00, 08, 19 |
-
-```javascript
-const date = require('date-and-time');
-// Import "two-digit-year" plugin as a named "two_digit_year".
-const two_digit_year = require('date-and-time/plugin/two-digit-year');
-
-// This is the default behavior of the parser.
-date.parse('Dec 25 69', 'MMM D YY'); // => Invalid Date
-
-// Apply the "two_digit_year" plugin to the library.
-date.plugin(two_digit_year);
-
-// The `YY` token convert the year 69 or earlier to 2000s, the year 70 or later to 1900s.
-date.parse('Dec 25 69', 'MMM D YY'); // => Dec 25 2069
-date.parse('Dec 25 70', 'MMM D YY'); // => Dec 25 1970
-```
-
-This plugin has a **breaking change**. In previous versions, this plugin overrode the default behavior of the `Y` token, but this has been obsolete.
diff --git a/README.md b/README.md
index 405cf78..3023ad1 100644
--- a/README.md
+++ b/README.md
@@ -1,640 +1,1315 @@
# date-and-time
-[](https://circleci.com/gh/knowledgecode/date-and-time)
+[](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml)
+[](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml)
+[](https://www.npmjs.com/package/date-and-time)
-This JS library is just a collection of functions for manipulating date and time. It's small, simple, and easy to learn.
+The simplest and most user-friendly date and time manipulation library
-## Why
+## Install
-Nowadays, JS modules have become larger, more complex, and dependent on many other modules. It is important to strive for simplicity and smallness, especially for modules that are at the bottom of the dependency chain, such as those that handle date and time.
+```shell
+npm i date-and-time
+```
-## Features
+- ESModules:
-- Minimalist. Approximately 2k. (minified and gzipped)
-- Extensible. Plugin system support.
-- Multi language support.
-- Universal / Isomorphic. Works anywhere.
-- TypeScript support.
-- Older browser support. Even works on IE6. :)
+```typescript
+import { format } from 'date-and-time';
-## Install
+format(new Date(), 'ddd, MMM DD YYYY');
+// => Wed, Jul 09 2025
+```
-```shell
-npm i date-and-time
+- CommonJS:
+
+```typescript
+const { format } = require('date-and-time');
+
+format(new Date(), 'ddd, MMM DD YYYY');
+// => Wed, Jul 09 2025
```
-## Recent Changes
+## Migration
-- 3.6.0
- - In `parseTZ()`, enabled parsing of the missing hour during the transition from standard time to daylight saving time into a Date type.
- - In `format()` with the `z` token, fixed an issue where some short time zone names were incorrect.
+Version `4.x` has been completely rewritten in TypeScript and some features from `3.x` are no longer compatible. The main changes are as follows:
-- 3.5.0
- - Added `addYearsTZ()`, `addMonthsTZ()`, and `addDaysTZ()` to the `timezone` plugin.
- - Revised the approach to adding time and removed the third parameter from `addHours()`, `addMinutes()`, `addSeconds()`, and `addMilliseconds()`.
+- The `timezone` and `timespan` plugins have been integrated into the main library
+- Tree shaking is now supported
+- Supports `ES2021` and no longer supports older browsers
+
+For details, please refer to [MIGRATION.md](docs/MIGRATION.md).
+
+## API
-- 3.4.1
- - Fixed an issue where `formatTZ()` would output 0:00 as 24:00 in 24-hour format in Node.js.
+## format(dateObj, arg[, options])
-## Usage
+
+Formats a Date object according to the specified format string.
-- ES Modules:
+- dateObj
+ - type: `Date`
+ - The Date object to format
+- arg
+ - type: `string | CompiledObject`
+ - The format string or compiled object to match against the Date object
+- [options]
+ - type: `FormatterOptions`
+ - Optional formatter options for customization
-```javascript
-import date from 'date-and-time';
+```typescript
+import { format } from 'date-and-time';
+import Tokyo from 'date-and-time/timezones/Asia/Tokyo';
+import ja from 'date-and-time/locales/ja';
+
+const now = new Date();
+
+format(now, 'YYYY/MM/DD HH:mm:ss');
+// => 2015/01/01 23:14:05
+
+format(now, 'ddd, MMM DD YYYY');
+// => Thu, Jan 01 2015
+
+format(now, 'ddd, MMM DD YYYY hh:mm A [GMT]Z', { timeZone: 'UTC' });
+// => Fri, Jan 02 2015 07:14 AM GMT+0000
+
+format(now, 'YYYY年MMMM月D日dddd Ah:mm:ss [GMT]Z', { timeZone: Tokyo, locale: ja });
+// => 2015年1月2日金曜日 午後4:14:05 GMT+0900
```
-- CommonJS:
+The tokens available for use in the format string specified as the second argument and their meanings are as follows:
+
+| Token | Meaning | Output Examples |
+|:---------|:--------------------------------------------|:----------------------|
+| YYYY | 4-digit year | 0999, 2015 |
+| YY | 2-digit year | 99, 01, 15 |
+| Y | Year without zero padding | 2, 44, 888, 2015 |
+| MMMM | Full month name | January, December |
+| MMM | Short month name | Jan, Dec |
+| MM | Month | 01, 12 |
+| M | Month without zero padding | 1, 12 |
+| DD | Day | 02, 31 |
+| D | Day without zero padding | 2, 31 |
+| dddd | Full day name | Friday, Sunday |
+| ddd | Short day name | Fri, Sun |
+| dd | Very short day name | Fr, Su |
+| HH | Hour in 24-hour format | 23, 08 |
+| H | Hour in 24-hour format without zero padding | 23, 8 |
+| hh | Hour in 12-hour format | 11, 08 |
+| h | Hour in 12-hour format without zero padding | 11, 8 |
+| A | Uppercase AM/PM | AM, PM |
+| AA | Uppercase AM/PM (with periods) | A.M., P.M. |
+| a | Lowercase AM/PM | am, pm |
+| aa | Lowercase AM/PM (with periods) | a.m., p.m. |
+| mm | Minutes | 14, 07 |
+| m | Minutes without zero padding | 14, 7 |
+| ss | Seconds | 05, 10 |
+| s | Seconds without zero padding | 5, 10 |
+| SSS | 3-digit milliseconds | 753, 022 |
+| SS | 2-digit milliseconds | 75, 02 |
+| S | 1-digit milliseconds | 7, 0 |
+| Z | Timezone offset | +0100, -0800 |
+| ZZ | Timezone offset with colon | +01:00, -08:00 |
+
+Additionally, by importing plugins, you can use the following tokens. For details, please refer to [PLUGINS.md](docs/PLUGINS.md).
+
+| Token | Meaning | Output Examples |
+|:---------|:--------------------------------------------|:----------------------|
+| DDD | Ordinal representation of day | 1st, 2nd, 3rd |
+| z | Short timezone name | PST, EST |
+| zz | Long timezone name | Pacific Standard Time |
+
+The breakdown of `FormatterOptions` that can be specified as the third argument is as follows:
+
+
+hour12
+
+- type: `h11 | h12`
+- default: `h12`
+- The hour format to use for formatting. This is used when the hour is in 12-hour format. It can be `h11` for 11-hour format or `h12` for 12-hour format.
+
+```typescript
+format(now, 'dddd, MMMM D, YYYY [at] h:mm:ss.SSS A [GMT]ZZ', { hour12: 'h11' });
+// Wednesday, July 23, 2025 at 0:12:54.814 AM GMT-07:00
+```
+
+
+
+
+hour24
+
+- type: `h23 | h24`
+- default: `h23`
+- The hour format to use for formatting. This is used when the hour is in 24-hour format. It can be `h23` for 23-hour format or `h24` for 24-hour format.
+
+```typescript
+format(now, 'dddd, MMMM D, YYYY [at] H:mm:ss.SSS [GMT]ZZ', { hour24: 'h24' });
+// => Wednesday, July 23, 2025 at 24:12:54.814 GMT-07:00
+```
-```javascript
-const date = require('date-and-time');
+
+
+
+numeral
+
+- type: `Numeral`
+- default: `latn`
+- The numeral system to use for formatting numbers. This is an object that provides methods to encode and decode numbers in the specified numeral system.
+
+```typescript
+import arab from 'date-and-time/numerals/arab';
+
+format(now, 'DD/MM/YYYY', { numeral: arab });
+// => ٠٨/٠٧/٢٠٢٥
```
-- ES Modules for the browser:
+Currently, the following numeral systems are supported:
+
+- `arab`
+- `arabext`
+- `beng`
+- `latn`
+- `mymr`
+
+
+
+
+calendar
-```html
-
+- type: `buddhist | gregory`
+- default: `gregory`
+- The calendar system to use for formatting dates. This can be `buddhist` for Buddhist calendar or `gregory` for Gregorian calendar.
+
+```typescript
+format(now, 'dddd, MMMM D, YYYY', { calendar: 'buddhist' });
+// => Wednesday, July 23, 2568
```
-- Older browser:
+
+
+
+timeZone
+
+- type: `TimeZone | UTC`
+- default: `undefined`
+- The time zone to use for formatting dates and times. This can be a specific time zone object or `UTC` to use Coordinated Universal Time. If not specified, it defaults to undefined, which means the local time zone will be used.
+
+```typescript
+import New_York from 'date-and-time/timezones/America/New_York';
-```html
-
+format(now, 'dddd, MMMM D, YYYY [at] H:mm:ss.SSS [GMT]ZZ', { timeZone: New_York });
+// => Wednesday, July 23, 2025 at 3:28:27.443 GMT-04:00
```
-### Note
+
-- If you want to use ES Modules in Node.js without the transpiler, you need to add `"type": "module"` in your `package.json` or change your file extension from `.js` to `.mjs`.
-- If you are using TypeScript and having trouble building, please ensure that the following settings in the `compilerOptions` of your `tsconfig.json` are set to `true`.
+
+locale
-```json
-{
- "compilerOptions": {
- "allowSyntheticDefaultImports": true,
- "esModuleInterop": true
- }
-}
+- type: `Locale`
+- default: `en`
+- The locale to use for formatting dates and times. This is an object that provides methods to get localized month names, day names, and meridiems.
+
+```typescript
+import es from 'date-and-time/locales/es';
+
+format(now, 'dddd, D [de] MMMM [de] YYYY, h:mm:ss.SSS aa [GMT]ZZ', { locale: es });
+// => miércoles, 23 de julio de 2025, 12:38:08,533 a.m. GMT-07:00
```
-## API
+
+Currently, the following locales are supported:
+
+- `ar` (Arabic)
+- `az` (Azerbaijani)
+- `bn` (Bengali)
+- `cs` (Czech)
+- `da` (Danish)
+- `de` (German)
+- `el` (Greek)
+- `en` (English)
+- `es` (Spanish)
+- `fa` (Persian)
+- `fi` (Finnish)
+- `fr` (French)
+- `he` (Hebrew)
+- `hi` (Hindi)
+- `hu` (Hungarian)
+- `id` (Indonesian)
+- `it` (Italian)
+- `ja` (Japanese)
+- `ko` (Korean)
+- `ms` (Malay)
+- `my` (Burmese)
+- `nl` (Dutch)
+- `no` (Norwegian)
+- `pl` (Polish)
+- `pt-BR` (Brazilian Portuguese)
+- `pt-PT` (European Portuguese)
+- `ro` (Romanian)
+- `ru` (Russian)
+- `rw` (Kinyarwanda)
+- `sr-Cyrl` (Serbian Cyrillic)
+- `sr-Latn` (Serbian Latin)
+- `sv` (Swedish)
+- `ta` (Tamil)
+- `th` (Thai)
+- `tr` (Turkish)
+- `uk` (Ukrainian)
+- `uz-Cyrl` (Uzbek Cyrillic)
+- `uz-Latn` (Uzbek Latin)
+- `vi` (Vietnamese)
+- `zh-Hans` (Simplified Chinese)
+- `zh-Hant` (Traditional Chinese)
+
+
+
+
+### Notes
+
+
+Comments
+
+Parts of the format string enclosed in brackets are output as-is, regardless of whether they are valid tokens.
+
+```typescript
+format(new Date(), 'DD-[MM]-YYYY'); // => '02-MM-2015'
+format(new Date(), '[DD-[MM]-YYYY]'); // => 'DD-[MM]-YYYY'
+```
-- [format](#formatdateobj-arg-utc)
- - Formatting date and time objects (Date -> String)
+
-- [parse](#parsedatestring-arg-utc)
- - Parsing date and time strings (String -> Date)
+
+Output as UTC timezone
-- [compile](#compileformatstring)
- - Compiling format strings
+To output date and time as UTC timezone, specify the string `UTC` in the `timeZone` property of `FormatterOptions`.
-- [preparse](#preparsedatestring-arg)
- - Pre-parsing date and time strings
+```typescript
+format(new Date(), 'hh:mm A [GMT]Z');
+// => '12:14 PM GMT-0700'
-- [isValid](#isvalidarg1-arg2)
- - Date and time string validation
+format(new Date(), 'hh:mm A [GMT]Z', { timeZone: 'UTC' });
+// => '07:14 AM GMT+0000'
+```
-- [transform](#transformdatestring-arg1-arg2-utc)
- - Format transformation of date and time strings (String -> String)
+
+
-- [addYears](#addyearsdateobj-years-utc)
- - Adding years
+## parse(dateString, arg[, options])
-- [addMonths](#addmonthsdateobj-months-utc)
- - Adding months
+
+Parses a date string according to the specified format.
-- [addDays](#adddaysdateobj-days-utc)
- - Adding days
+- dateString
+ - type: `string`
+ - The date string to parse
+- arg
+ - type: `string | CompiledObject`
+ - The format string or compiled object to match against the date string
+- [options]
+ - type: `ParserOptions`
+ - Optional parser options for customization
-- [addHours](#addhoursdateobj-hours)
- - Adding hours
+```typescript
+import { parse } from 'date-and-time';
+import Paris from 'date-and-time/timezones/Europe/Paris';
+import fr from 'date-and-time/locales/fr';
-- [addMinutes](#addminutesdateobj-minutes)
- - Adding minutes
+parse('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss');
+// => Jan 02 2015 23:14:05 GMT-0800
-- [addSeconds](#addsecondsdateobj-seconds)
- - Adding seconds
+parse('02-01-2015', 'DD-MM-YYYY');
+// => Jan 02 2015 00:00:00 GMT-0800
-- [addMilliseconds](#addmillisecondsdateobj-milliseconds)
- - Adding milliseconds
+parse('11:14:05 PM', 'h:mm:ss A', { timeZone: 'UTC' });
+// => Jan 02 1970 23:14:05 GMT+0000
-- [subtract](#subtractdate1-date2)
- - Subtracting two dates (date1 - date2)
+parse(
+ '02 janv. 2015, 11:14:05 PM', 'DD MMM YYYY, h:mm:ss A',
+ { timeZone: Paris, locale: fr }
+);
+// => Jan 02 2015 23:14:05 GMT+0100
-- [isLeapYear](#isleapyeary)
- - Whether a year is a leap year
+parse('Jam 1 2017', 'MMM D YYYY');
+// => Invalid Date
+```
-- [isSameDay](#issamedaydate1-date2)
- - Comparison of two dates
+The tokens available for use in the format string specified as the second argument and their meanings are as follows:
+
+| Token | Meaning | Input Examples |
+|:----------|:--------------------------------------------|:--------------------|
+| YYYY | 4-digit year | 0999, 2015 |
+| Y | Year without zero padding | 2, 44, 88, 2015 |
+| MMMM | Full month name | January, December |
+| MMM | Short month name | Jan, Dec |
+| MM | Month | 01, 12 |
+| M | Month without zero padding | 1, 12 |
+| DD | Day | 02, 31 |
+| D | Day without zero padding | 2, 31 |
+| HH | Hour in 24-hour format | 23, 08 |
+| H | Hour in 24-hour format without zero padding | 23, 8 |
+| hh | Hour in 12-hour format | 11, 08 |
+| h | Hour in 12-hour format without zero padding | 11, 8 |
+| A | Uppercase AM/PM | AM, PM |
+| AA | Uppercase AM/PM (with periods) | A.M., P.M. |
+| a | Lowercase AM/PM | am, pm |
+| aa | Lowercase AM/PM (with periods) | a.m., p.m. |
+| mm | Minutes | 14, 07 |
+| m | Minutes without zero padding | 14, 7 |
+| ss | Seconds | 05, 10 |
+| s | Seconds without zero padding | 5, 10 |
+| SSS | 3-digit milliseconds | 753, 022 |
+| SS | 2-digit milliseconds | 75, 02 |
+| S | 1-digit milliseconds | 7, 0 |
+| Z | Timezone offset | +0100, -0800 |
+| ZZ | Timezone offset with colon | +01:00, -08:00 |
+
+Additionally, by importing plugins, you can use the following tokens. For details, please refer to [PLUGINS.md](docs/PLUGINS.md).
+
+| Token | Meaning | Input Examples |
+|:----------|:-------------------------------------------|:---------------------|
+| YY | 2-digit year | 90, 00, 08, 19 |
+| DDD | Ordinal representation of day | 1st, 2nd, 3rd |
+| dddd | Full day name | Friday, Sunday |
+| ddd | Short day name | Fri, Sun |
+| dd | Very short day name | Fr, Su |
+| SSSSSS | 6-digit milliseconds | 123456, 000001 |
+| SSSSS | 5-digit milliseconds | 12345, 00001 |
+| SSSS | 4-digit milliseconds | 1234, 0001 |
+| fff | 3-digit microseconds | 753, 022 |
+| ff | 2-digit microseconds | 75, 02 |
+| f | 1-digit microseconds | 7, 0 |
+| SSSSSSSSS | 9-digit milliseconds | 123456789, 000000001 |
+| SSSSSSSS | 8-digit milliseconds | 12345678, 00000001 |
+| SSSSSSS | 7-digit milliseconds | 1234567, 0000001 |
+| FFF | 3-digit nanoseconds | 753, 022 |
+| FF | 2-digit nanoseconds | 75, 02 |
+| F | 1-digit nanoseconds | 7, 0 |
+
+The breakdown of `ParserOptions` that can be specified as the third argument is as follows:
+
+
+hour12
+
+- type: `h11 | h12`
+- default: `h12`
+- The hour format to use for parsing. This is used when the hour is in 12-hour format. It can be `h11` for 11-hour format (0 - 11) or `h12` for 12-hour format (1 - 12).
+
+```typescript
+parse('0:12:54 PM', 'h:mm:ss A', { hour12: 'h11' });
+// => Jan 01 1970 12:12:54 GMT-0800
+```
-- [locale](#localelocale)
- - Changing locales
+
-- [extend](#extendextension)
- - Functional extension
+
+hour24
-- [plugin](#pluginplugin)
- - Importing plugins
+- type: `h23 | h24`
+- default: `h23`
+- The hour format to use for parsing. This is used when the hour is in 24-hour format. It can be `h23` for 23-hour format (0 - 23) or `h24` for 24-hour format (1 - 24).
-### format(dateObj, arg[, utc])
+```typescript
+parse('24:12:54', 'h:mm:ss', { hour24: 'h24' });
+// => Jan 01 1970 00:12:54 GMT-0800
+```
-- @param {**Date**} dateObj - A Date object
-- @param {**string|Array.\**} arg - A format string or its compiled object
-- @param {**boolean**} [utc] - Output as UTC
-- @returns {**string**} A formatted string
+
-```javascript
-const now = new Date();
-date.format(now, 'YYYY/MM/DD HH:mm:ss'); // => '2015/01/02 23:14:05'
-date.format(now, 'ddd, MMM DD YYYY'); // => 'Fri, Jan 02 2015'
-date.format(now, 'hh:mm A [GMT]Z'); // => '11:14 PM GMT-0800'
-date.format(now, 'hh:mm A [GMT]Z', true); // => '07:14 AM GMT+0000'
-
-const pattern = date.compile('ddd, MMM DD YYYY');
-date.format(now, pattern); // => 'Fri, Jan 02 2015'
-```
-
-Available tokens and their meanings are as follows:
-
-| token | meaning | examples of output |
-|:------|:-------------------------------------|:-------------------|
-| YYYY | four-digit year | 0999, 2015 |
-| YY | two-digit year | 99, 01, 15 |
-| Y | four-digit year without zero-padding | 2, 44, 888, 2015 |
-| MMMM | month name (long) | January, December |
-| MMM | month name (short) | Jan, Dec |
-| MM | month with zero-padding | 01, 12 |
-| M | month | 1, 12 |
-| DD | date with zero-padding | 02, 31 |
-| D | date | 2, 31 |
-| dddd | day of week (long) | Friday, Sunday |
-| ddd | day of week (short) | Fri, Sun |
-| dd | day of week (very short) | Fr, Su |
-| HH | 24-hour with zero-padding | 23, 08 |
-| H | 24-hour | 23, 8 |
-| hh | 12-hour with zero-padding | 11, 08 |
-| h | 12-hour | 11, 8 |
-| A | meridiem (uppercase) | AM, PM |
-| mm | minute with zero-padding | 14, 07 |
-| m | minute | 14, 7 |
-| ss | second with zero-padding | 05, 10 |
-| s | second | 5, 10 |
-| SSS | millisecond (high accuracy) | 753, 022 |
-| SS | millisecond (middle accuracy) | 75, 02 |
-| S | millisecond (low accuracy) | 7, 0 |
-| Z | time zone offset value | +0100, -0800 |
-| ZZ | time zone offset value with colon | +01:00, -08:00 |
-
-You can also use the following tokens by importing plugins. See [PLUGINS.md](./PLUGINS.md) for details.
-
-| token | meaning | examples of output |
-|:------|:-------------------------------------|:----------------------|
-| DDD | ordinal notation of date | 1st, 2nd, 3rd |
-| AA | meridiem (uppercase with ellipsis) | A.M., P.M. |
-| a | meridiem (lowercase) | am, pm |
-| aa | meridiem (lowercase with ellipsis) | a.m., p.m. |
-| z | time zone name abbreviation | PST, EST |
-| zz | time zone name | Pacific Standard Time |
-
-#### Note 1. Comments
-
-Parts of the given format string enclosed in square brackets are considered comments and are output as is, regardless of whether they are tokens or not.
-
-```javascript
-date.format(new Date(), 'DD-[MM]-YYYY'); // => '02-MM-2015'
-date.format(new Date(), '[DD-[MM]-YYYY]'); // => 'DD-[MM]-YYYY'
-```
-
-#### Note 2. Output as UTC
-
-This function outputs the date and time in the local time zone of the execution environment by default. If you want to output in UTC, set the UTC option (the third argument) to true. To output in any other time zone, you will need [a plugin](./PLUGINS.md).
-
-```javascript
-date.format(new Date(), 'hh:mm A [GMT]Z'); // => '11:14 PM GMT-0800'
-date.format(new Date(), 'hh:mm A [GMT]Z', true); // => '07:14 AM GMT+0000'
-```
-
-#### Note 3. More Tokens
-
-You can also define your own tokens. See [EXTEND.md](./EXTEND.md) for details.
-
-### parse(dateString, arg[, utc])
-
-- @param {**string**} dateString - A date and time string
-- @param {**string|Array.\**} arg - A format string or its compiled object
-- @param {**boolean**} [utc] - Input as UTC
-- @returns {**Date**} A Date object
-
-```javascript
-date.parse('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss'); // => Jan 2 2015 23:14:05 GMT-0800
-date.parse('02-01-2015', 'DD-MM-YYYY'); // => Jan 2 2015 00:00:00 GMT-0800
-date.parse('11:14:05 PM', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800
-date.parse('11:14:05 PM', 'hh:mm:ss A', true); // => Jan 1 1970 23:14:05 GMT+0000 (Jan 1 1970 15:14:05 GMT-0800)
-date.parse('23:14:05 GMT+0900', 'HH:mm:ss [GMT]Z'); // => Jan 1 1970 23:14:05 GMT+0900 (Jan 1 1970 06:14:05 GMT-0800)
-date.parse('Jam 1 2017', 'MMM D YYYY'); // => Invalid Date
-date.parse('Feb 29 2017', 'MMM D YYYY'); // => Invalid Date
-```
-
-Available tokens and their meanings are as follows:
-
-| token | meaning | examples of acceptable form |
-|:-------|:-------------------------------------|:----------------------------|
-| YYYY | four-digit year | 0999, 2015 |
-| Y | four-digit year without zero-padding | 2, 44, 88, 2015 |
-| MMMM | month name (long) | January, December |
-| MMM | month name (short) | Jan, Dec |
-| MM | month with zero-padding | 01, 12 |
-| M | month | 1, 12 |
-| DD | date with zero-padding | 02, 31 |
-| D | date | 2, 31 |
-| HH | 24-hour with zero-padding | 23, 08 |
-| H | 24-hour | 23, 8 |
-| hh | 12-hour with zero-padding | 11, 08 |
-| h | 12-hour | 11, 8 |
-| A | meridiem (uppercase) | AM, PM |
-| mm | minute with zero-padding | 14, 07 |
-| m | minute | 14, 7 |
-| ss | second with zero-padding | 05, 10 |
-| s | second | 5, 10 |
-| SSS | millisecond (high accuracy) | 753, 022 |
-| SS | millisecond (middle accuracy) | 75, 02 |
-| S | millisecond (low accuracy) | 7, 0 |
-| Z | time zone offset value | +0100, -0800 |
-| ZZ | time zone offset value with colon | +01:00, -08:00 |
-
-You can also use the following tokens by importing plugins. See [PLUGINS.md](./PLUGINS.md) for details.
-
-| token | meaning | examples of acceptable form |
-|:-------|:-------------------------------------|:----------------------------|
-| YY | two-digit year | 90, 00, 08, 19 |
-| AA | meridiem (uppercase with ellipsis) | A.M., P.M. |
-| a | meridiem (lowercase) | am, pm |
-| aa | meridiem (lowercase with ellipsis) | a.m., p.m. |
-| dddd | day of week (long) | Friday, Sunday |
-| ddd | day of week (short) | Fri, Sun |
-| dd | day of week (very short) | Fr, Su |
-| SSSSSS | microsecond (high accuracy) | 123456, 000001 |
-| SSSSS | microsecond (middle accuracy) | 12345, 00001 |
-| SSSS | microsecond (low accuracy) | 1234, 0001 |
-
-#### Note 1. Invalid Date
+
+numeral
+
+- type: `Numeral`
+- default: `latn`
+- The numeral system to use for parsing numbers. This is an object that provides methods to encode and decode numbers in the specified numeral system.
+
+```typescript
+import arab from 'date-and-time/numerals/arab';
+
+parse('٠٨/٠٧/٢٠٢٥', 'DD/MM/YYYY', { numeral: arab });
+// => July 09 2025 00:00:00 GMT-0700
+```
+
+Currently, the following numeral systems are supported:
+
+- `arab`
+- `arabext`
+- `beng`
+- `latn`
+- `mymr`
+
+
+
+
+calendar
+
+- type: `buddhist | gregory`
+- default: `gregory`
+- The calendar system to use for parsing dates. This can be `buddhist` for Buddhist calendar or `gregory` for Gregorian calendar.
+
+```typescript
+parse('July 09 2025', 'MMMM DD YYYY', { calendar: 'buddhist' });
+// => July 09 1482 00:00:00 GMT-0752
+// Note: Buddhist calendar is 543 years ahead of Gregorian calendar,
+// so 2025 BE (Buddhist Era) equals 1482 CE (Common Era)
+```
+
+
+
+
+ignoreCase
+
+- type: `boolean`
+- default: `false`
+- Whether to ignore case when matching strings. This is useful for matching month names, day names, and meridiems in a case-insensitive manner. If true, the parser will convert both the input string and the strings in the locale to lowercase before matching.
+
+```typescript
+parse('july 09 2025', 'MMMM DD YYYY', { ignoreCase: true });
+// => July 09 2025 00:00:00 GMT-0700
+```
+
+
+
+
+timeZone
+
+- type: `TimeZone | UTC`
+- default: `undefined`
+- The time zone to use for parsing dates and times. This can be a specific time zone object or `UTC` to use Coordinated Universal Time. If not specified, it defaults to undefined, which means the local time zone will be used.
+
+```typescript
+import New_York from 'date-and-time/timezones/America/New_York';
+
+parse('July 09 2025, 12:34:56', 'MMMM D YYYY, H:mm:ss', { timeZone: New_York });
+// => July 09 2025 09:34:56 GMT-0700 (July 09 2025 12:34:56 GMT-0400)
+
+parse('July 09 2025, 12:34:56', 'MMMM D YYYY, H:mm:ss', { timeZone: 'UTC' });
+// => July 09 2025 05:34:56 GMT-0700 (July 09 2025 12:34:56 GMT+0000)
+```
+
+
+
+
+locale
+
+- type: `Locale`
+- default: `en`
+- The locale to use for parsing dates and times. This is an object that provides methods to get localized month names, day names, and meridiems.
+
+```typescript
+import es from 'date-and-time/locales/es';
+
+parse(
+ '23 de julio de 2025, 12:38:08,533 a.m. GMT-07:00',
+ 'D [de] MMMM [de] YYYY, h:mm:ss,SSS aa [GMT]ZZ',
+ { locale: es }
+);
+// => July 23 2025 12:38:08.533 GMT-0700
+```
+
+
+Currently, the following locales are supported:
+
+- `ar` (Arabic)
+- `az` (Azerbaijani)
+- `bn` (Bengali)
+- `cs` (Czech)
+- `da` (Danish)
+- `de` (German)
+- `el` (Greek)
+- `en` (English)
+- `es` (Spanish)
+- `fa` (Persian)
+- `fi` (Finnish)
+- `fr` (French)
+- `he` (Hebrew)
+- `hi` (Hindi)
+- `hu` (Hungarian)
+- `id` (Indonesian)
+- `it` (Italian)
+- `ja` (Japanese)
+- `ko` (Korean)
+- `ms` (Malay)
+- `my` (Burmese)
+- `nl` (Dutch)
+- `no` (Norwegian)
+- `pl` (Polish)
+- `pt-BR` (Brazilian Portuguese)
+- `pt-PT` (European Portuguese)
+- `ro` (Romanian)
+- `ru` (Russian)
+- `rw` (Kinyarwanda)
+- `sr-Cyrl` (Serbian Cyrillic)
+- `sr-Latn` (Serbian Latin)
+- `sv` (Swedish)
+- `ta` (Tamil)
+- `th` (Thai)
+- `tr` (Turkish)
+- `uk` (Ukrainian)
+- `uz-Cyrl` (Uzbek Cyrillic)
+- `uz-Latn` (Uzbek Latin)
+- `vi` (Vietnamese)
+- `zh-Hans` (Simplified Chinese)
+- `zh-Hant` (Traditional Chinese)
+
+
+
+
+### Notes
+
+
+When parsing fails
If this function fails to parse, it will return `Invalid Date`. Notice that the `Invalid Date` is a Date object, not `NaN` or `null`. You can tell whether the Date object is invalid as follows:
-```javascript
-const today = date.parse('Jam 1 2017', 'MMM D YYYY');
+```typescript
+const today = parse('Jam 1 2017', 'MMM D YYYY');
if (isNaN(today.getTime())) {
- // Failure
+ console.error('Parsing failed');
}
```
-#### Note 2. Input as UTC
+
+
+
+Input as UTC timezone
+
+If the `dateString` does not contain a timezone offset and the `timeZone` property of the third argument is not specified, this function considers the `dateString` to be in the local timezone. If you want to process a `dateString` without a timezone offset as UTC timezone, set the string `UTC` to the `timeZone` property in the third argument. Note that the timezone offset contained in the `dateString` takes precedence over the `timeZone` property of the third argument.
-This function uses the local time zone offset value of the execution environment by default if the given string does not contain a time zone offset value. To make it use UTC instead, set the UTC option (the third argument) to true. If you want it to use any other time zone, you will need [a plugin](./PLUGINS.md).
+```typescript
+parse('11:14:05 PM', 'hh:mm:ss A');
+// => Jan 1 1970 23:14:05 GMT-0800
-```javascript
-date.parse('11:14:05 PM', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800
-date.parse('11:14:05 PM', 'hh:mm:ss A', true); // => Jan 1 1970 23:14:05 GMT+0000 (Jan 1 1970 15:14:05 GMT-0800)
+parse('11:14:05 PM GMT+0000', 'hh:mm:ss A [GMT]Z');
+// => Jan 1 1970 23:14:05 GMT+0000
+
+parse('11:14:05 PM', 'hh:mm:ss A', { timeZone: 'UTC' });
+// => Jan 1 1970 23:14:05 GMT+0000
```
-#### Note 3. Default Date Time
+
+
+
+Default Date Time
-Default date is `January 1, 1970`, time is `00:00:00.000`. Values not passed will be complemented with them:
+Default date is `January 1, 1970`, time is `00:00:00.000`. Any date/time components not specified in the input string will be filled with these default values.
-```javascript
-date.parse('11:14:05 PM', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800
-date.parse('Feb 2000', 'MMM YYYY'); // => Feb 1 2000 00:00:00 GMT-0800
+```typescript
+parse('11:14:05 PM', 'hh:mm:ss A');
+// => Jan 1 1970 23:14:05 GMT-0800
+
+parse('Feb 2000', 'MMM YYYY');
+// => Feb 1 2000 00:00:00 GMT-0800
```
-#### Note 4. Max Date / Min Date
+
+
+
+Max Date / Min Date
-Parsable maximum date is `December 31, 9999`, minimum date is `January 1, 0001`.
+The parsable maximum date is `December 31, 9999`, and the minimum date is `January 1, 0001`.
-```javascript
-date.parse('Dec 31 9999', 'MMM D YYYY'); // => Dec 31 9999 00:00:00 GMT-0800
-date.parse('Dec 31 10000', 'MMM D YYYY'); // => Invalid Date
+```typescript
+parse('Dec 31 9999', 'MMM D YYYY');
+// => Dec 31 9999 00:00:00 GMT-0800
-date.parse('Jan 1 0001', 'MMM D YYYY'); // => Jan 1 0001 00:00:00 GMT-0800
-date.parse('Jan 1 0000', 'MMM D YYYY'); // => Invalid Date
+parse('Dec 31 10000', 'MMM D YYYY');
+// => Invalid Date
+
+parse('Jan 1 0001', 'MMM D YYYY');
+// => Jan 1 0001 00:00:00 GMT-0800
+
+parse('Jan 1 0000', 'MMM D YYYY');
+// => Invalid Date
```
-#### Note 5. 12-hour notation and Meridiem
+
+
+
+12-hour notation and Meridiem
-If use `hh` or `h` (12-hour) token, use together `A` (meridiem) token to get the right value.
+If you use the `hh` or `h` (12-hour) token, use it together with the `A` (meridiem) token to get the correct value.
-```javascript
-date.parse('11:14:05', 'hh:mm:ss'); // => Jan 1 1970 11:14:05 GMT-0800
-date.parse('11:14:05 PM', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800
+```typescript
+parse('11:14:05', 'hh:mm:ss');
+// => Jan 1 1970 11:14:05 GMT-0800
+
+parse('11:14:05 PM', 'hh:mm:ss A');
+// => Jan 1 1970 23:14:05 GMT-0800
```
-#### Note 6. Token invalidation
+
+
+
+Token invalidation
Any part of the given format string that you do not want to be recognized as a token should be enclosed in square brackets. They are considered comments and will not be parsed.
-```javascript
-date.parse('12 hours 34 minutes', 'HH hours mm minutes'); // => Invalid Date
-date.parse('12 hours 34 minutes', 'HH [hours] mm [minutes]'); // => Jan 1 1970 12:34:00 GMT-0800
+```typescript
+parse('12 hours 34 minutes', 'HH hours mm minutes');
+// => Invalid Date
+
+parse('12 hours 34 minutes', 'HH [hours] mm [minutes]');
+// => Jan 1 1970 12:34:00 GMT-0800
```
-#### Note 7. Wildcard
+
-Whitespace acts as a wildcard token. This token will not parse the corresponding parts of the date and time strings. This behavior is similar to enclosing part of a format string in square brackets (Token invalidation), but with the flexibility that the contents do not have to match, as long as the number of characters in the corresponding parts match.
+
+Wildcard
-```javascript
+Whitespace acts as a wildcard token. This token will skip parsing the corresponding parts of the date and time strings. This behavior is similar to enclosing part of a format string in square brackets (Token invalidation), but with the flexibility that the contents do not have to match exactly - only the character count needs to match between the format string and input string.
+
+```typescript
// This will be an error.
-date.parse('2015/01/02 11:14:05', 'YYYY/MM/DD'); // => Invalid Date
-// Adjust the length of the format string by appending white spaces of the same length as a part to ignore to the end of it.
-date.parse('2015/01/02 11:14:05', 'YYYY/MM/DD '); // => Jan 2 2015 00:00:00 GMT-0800
+parse('2015/01/02 11:14:05', 'YYYY/MM/DD');
+// => Invalid Date
+
+parse('2015/01/02 11:14:05', 'YYYY/MM/DD ');
+// => Jan 2 2015 00:00:00 GMT-0800
```
-#### Note 8. Ellipsis
+
+
+
+Ellipsis
-`...` token ignores subsequent corresponding date and time strings. Use this token only at the end of a format string. The above example can be also written like this:
+`...` token ignores subsequent corresponding date and time strings. Use this token only at the end of a format string. The above example can also be written like this:
-```javascript
-date.parse('2015/01/02 11:14:05', 'YYYY/MM/DD...'); // => Jan 2 2015 00:00:00 GMT-0800
+```typescript
+parse('2015/01/02 11:14:05', 'YYYY/MM/DD...');
+// => Jan 2 2015 00:00:00 GMT-0800
```
-### compile(formatString)
+
+
-- @param {**string**} formatString - A format string
-- @returns {**Array.\**} A compiled object
+## compile(formatString)
-If you are going to execute the `format()`, the `parse()` or the `isValid()` so many times with one string format, recommended to precompile and reuse it for performance.
+
+Compiles a format string into a tokenized array for efficient parsing and formatting.
-```javascript
- const pattern = date.compile('MMM D YYYY h:m:s A');
+- formatString
+ - type: `string`
+ - The format string to compile
- date.parse('Mar 22 2019 2:54:21 PM', pattern);
- date.parse('Jul 27 2019 4:15:24 AM', pattern);
- date.parse('Dec 25 2019 3:51:11 AM', pattern);
+If you are going to execute the `format`, `parse`, or `isValid` functions many times with one string format, it is recommended to precompile and reuse it for performance.
- date.format(new Date(), pattern); // => Mar 16 2020 6:24:56 PM
+```typescript
+import { compile, parse, format } from 'date-and-time';
+
+const pattern = compile('MMM D YYYY h:m:s A');
+
+parse('Mar 22 2019 2:54:21 PM', pattern);
+parse('Jul 27 2019 4:15:24 AM', pattern);
+parse('Dec 25 2019 3:51:11 AM', pattern);
+
+format(new Date(), pattern);
+// => Mar 16 2020 6:24:56 PM
```
-### preparse(dateString, arg)
+
+
+## preparse(dateString, arg[, options])
-- @param {**string**} dateString - A date and time string
-- @param {**string|Array.\**} arg - A format string or its compiled object
-- @returns {**Object**} A pre-parsed result object
+
+Preparses a date string according to the specified pattern.
-This function takes exactly the same parameters with the `parse()`, but returns a date structure as follows unlike that:
+- dateString
+ - type: `string`
+ - The date string to preparse
+- arg
+ - type: `string | CompiledObject`
+ - The pattern string or compiled object to match against the date string
+- [options]
+ - type: `ParserOptions`
+ - Optional parser options
-```javascript
-date.preparse('Fri Jan 2015 02 23:14:05 GMT-0800', ' MMM YYYY DD HH:mm:ss [GMT]Z');
+```typescript
+import { preparse } from 'date-and-time';
+
+preparse('Jan 2015 02 23:14:05 GMT-0800', 'MMM YYYY DD HH:mm:ss [GMT]Z');
{
- Y: 2015, // Year
- M: 1, // Month
- D: 2, // Day
- H: 23, // 24-hour
- A: 0, // Meridiem
- h: 0, // 12-hour
- m: 14, // Minute
- s: 5, // Second
- S: 0, // Millisecond
- Z: 480, // Timsezone offset
- _index: 33, // Pointer offset
- _length: 33, // Length of the date string
- _match: 7 // Token matching count
+ Y: 2015, // Year
+ M: 1, // Month
+ D: 2, // Day
+ H: 23, // Hour (24-hour)
+ m: 14, // Minute
+ s: 5, // Second
+ Z: 480, // Timezone offset in minutes
+ _index: 29, // Current parsing position
+ _length: 29, // Total length of date string
+ _match: 7 // Number of matched tokens
}
```
-This date structure provides a parsing result. You will be able to tell from it how the date string was parsed(, or why the parsing was failed).
+This date structure provides a parsing result. You will be able to tell from it how the date string was parsed (or why the parsing failed).
+
+
-### isValid(arg1[, arg2])
+## isValid(dateString, arg[, options])
-- @param {**Object|string**} arg1 - A pre-parsed result object or a date and time string
-- @param {**string|Array.\**} [arg2] - A format string or its compiled object
-- @returns {**boolean**} Whether the date and time string is a valid date and time
+
+Validates whether a date string is valid according to the specified format.
-This function takes either exactly the same parameters with the `parse()` or a date structure which the `preparse()` returns, evaluates the validity of them.
+- dateString
+ - type: `string`
+ - The date string to validate
+- arg
+ - type: `string | CompiledObject`
+ - The format string or compiled object
+- [options]
+ - type: `ParserOptions`
+ - Optional parser options
-```javascript
-date.isValid('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss'); // => true
-date.isValid('29-02-2015', 'DD-MM-YYYY'); // => false
+```typescript
+isValid('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss'); // => true
+isValid('29-02-2015', 'DD-MM-YYYY'); // => false
```
-```javascript
-const result = date.preparse('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss');
-date.isValid(result); // => true
+For details about `ParserOptions`, refer to the `parse` function section.
+
+
+
+## transform(dateString, arg1, arg2[, options1[, options2]])
+
+
+Transforms a date string from one format to another.
+
+- dateString
+ - type: `string`
+ - The date string to transform
+- arg1
+ - type: `string | CompiledObject`
+ - The format string or compiled object for parsing
+- arg2
+ - type: `string | CompiledObject`
+ - The format string or compiled object for formatting
+- [options1]
+ - type: `ParserOptions`
+ - Optional parser options
+- [options2]
+ - type: `FormatterOptions`
+ - Optional formatter options
+
+This is a syntactic sugar for combining `parse` and `format` processing to convert date formats in a single function. It converts `dateString` to `arg2` format. Actually, it parses the `dateString` in `arg1` format and then formats it in `arg2` format.
+
+```typescript
+import { transform } from 'date-and-time';
+import New_York from 'date-and-time/timezones/America/New_York';
+import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
+
+// Swap the order of month and day
+transform('3/8/2020', 'D/M/YYYY', 'M/D/YYYY');
+// => 8/3/2020
+
+// Convert 24-hour format to 12-hour format
+transform('13:05', 'HH:mm', 'hh:mm A');
+// => 01:05 PM
+
+// Convert EST to PST
+transform(
+ '3/8/2020 1:05 PM', 'D/M/YYYY h:mm A', 'D/M/YYYY h:mm A',
+ { timeZone: New_York }, { timeZone: Los_Angeles }
+);
+// => 3/8/2020 10:05 AM
```
-### transform(dateString, arg1, arg2[, utc])
+For details about `ParserOptions`, refer to the `parse` function section. For details about `FormatterOptions`, refer to the `format` function section.
-- @param {**string**} dateString - A date and time string
-- @param {**string|Array.\**} arg1 - A format string or its compiled object before transformation
-- @param {**string|Array.\**} arg2 - A format string or its compiled object after transformation
-- @param {**boolean**} [utc] - Output as UTC
-- @returns {**string**} A formatted string
+
-This function transforms the format of a date string. The 2nd parameter, `arg1`, is the format string of it. Available token list is equal to the `parse()`'s. The 3rd parameter, `arg2`, is the transformed format string. Available token list is equal to the `format()`'s.
+## addYears(dateObj, years[, timeZone])
-```javascript
-// 3/8/2020 => 8/3/2020
-date.transform('3/8/2020', 'D/M/YYYY', 'M/D/YYYY');
+
+Adds the specified number of years to a Date object.
-// 13:05 => 01:05 PM
-date.transform('13:05', 'HH:mm', 'hh:mm A');
-```
+- dateObj
+ - type: `Date`
+ - The Date object to modify
+- years
+ - type: `number`
+ - The number of years to add
+- [timeZone]
+ - type: `TimeZone | UTC`
+ - Optional time zone object or `UTC`
-### addYears(dateObj, years[, utc])
+```typescript
+import { addYears } from 'date-and-time';
+import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} years - The number of years to add
-- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
-- @returns {**Date**} The Date object after adding the specified number of years
+const now = new Date(2024, 2, 11, 1); // => Mar 11 2024 01:00:00 GMT-07:00
-Adds years to a date object. Subtraction is also possible by specifying a negative value. If the third parameter is false or omitted, this function calculates based on the system's default time zone. If you need to obtain calculation results based on a specific time zone regardless of the execution system, consider using the `addYearsTZ()`, which allows you to specify a time zone name as the third parameter. See [PLUGINS.md](./PLUGINS.md) for details.
-
-```javascript
-const now = new Date();
-const next_year = date.addYears(now, 1);
+addYears(now, 1, Los_Angeles); // => Mar 11 2025 01:00:00 GMT-07:00
+addYears(now, -1, Los_Angeles); // => Mar 11 2023 01:00:00 GMT-08:00
```
Exceptional behavior of the calculation for the last day of the month:
-```javascript
-const now = new Date(Date.UTC(2020, 1, 29)); // => Feb 29 2020
-const next_year = date.addYears(now, 1, true); // => Feb 28 2021
-const next_next_year = date.addYears(next_year, 1, true); // => Feb 28 2022
+```typescript
+const now = new Date(Date.UTC(2020, 1, 29)); // => Feb 29 2020
+const next = addYears(now, 1, 'UTC'); // => Feb 28 2021
+const back = addYears(next, -1, 'UTC'); // => Feb 28 2020 (not the original date)
```
-### addMonths(dateObj, months[, utc])
+
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} months - The number of months to add
-- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
-- @returns {**Date**} The Date object after adding the specified number of months
+## addMonths(dateObj, months[, timeZone])
-Adds months to a date object. Subtraction is also possible by specifying a negative value. If the third parameter is false or omitted, this function calculates based on the system's default time zone. If you need to obtain calculation results based on a specific time zone regardless of the execution system, consider using the `addMonthsTZ()`, which allows you to specify a time zone name as the third parameter. See [PLUGINS.md](./PLUGINS.md) for details.
+
+Adds the specified number of months to a Date object.
-```javascript
-const now = new Date();
-const next_month = date.addMonths(now, 1);
+- dateObj
+ - type: `Date`
+ - The Date object to modify
+- months
+ - type: `number`
+ - The number of months to add
+- [timeZone]
+ - type: `TimeZone | UTC`
+ - Optional time zone object or `UTC`
+
+```typescript
+import { addMonths } from 'date-and-time';
+import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
+
+const now = new Date(2024, 2, 11, 1); // => Mar 11 2024 01:00:00 GMT-07:00
+
+addMonths(now, 1, Los_Angeles); // => Apr 11 2024 01:00:00 GMT-07:00
+addMonths(now, -1, Los_Angeles); // => Feb 11 2024 01:00:00 GMT-08:00
```
Exceptional behavior of the calculation for the last day of the month:
-```javascript
-const now = new Date(Date.UTC(2023, 0, 31)); // => Jan 31 2023
-const next_month = date.addMonths(now, 1, true); // => Feb 28 2023
-const next_next_month = date.addMonths(next_month, 1, true); // => Mar 28 2023
+```typescript
+const now = new Date(Date.UTC(2023, 0, 31)); // => Jan 31 2023
+const apr = addMonths(now, 3, 'UTC'); // => Apr 30 2023
+const feb = addMonths(apr, -2, 'UTC'); // => Feb 28 2023
```
-### addDays(dateObj, days[, utc])
+
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} days - The number of days to add
-- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
-- @returns {**Date**} The Date object after adding the specified number of days
+## addDays(dateObj, days[, timeZone])
-Adds days to a date object. Subtraction is also possible by specifying a negative value. If the third parameter is false or omitted, this function calculates based on the system's default time zone. If you need to obtain calculation results based on a specific time zone regardless of the execution system, consider using the `addDaysTZ()`, which allows you to specify a time zone name as the third parameter. See [PLUGINS.md](./PLUGINS.md) for details.
+
+Adds the specified number of days to a Date object.
-```javascript
-const now = new Date();
-const yesterday = date.addDays(now, -1);
+- dateObj
+ - type: `Date`
+ - The Date object to modify
+- days
+ - type: `number`
+ - The number of days to add
+- [timeZone]
+ - type: `TimeZone | UTC`
+ - Optional time zone object or `UTC`
+
+```typescript
+import { addDays } from 'date-and-time';
+import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
+
+const now = new Date(2024, 2, 11, 1); // => Mar 11 2024 01:00:00 GMT-07:00
+
+addDays(now, 1, Los_Angeles); // => Mar 12 2024 01:00:00 GMT-07:00
+addDays(now, -1, Los_Angeles); // => Mar 10 2024 01:00:00 GMT-08:00
```
-### addHours(dateObj, hours)
+
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} hours - The number of hours to add
-- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
-- @returns {**Date**} The Date object after adding the specified number of hours
+## addHours(dateObj, hours)
-Adds hours to a date object. Subtraction is also possible by specifying a negative value. The third parameter was deprecated in version 3.5.0. Regardless of what is specified for this parameter, the calculation results will not change.
+
+Adds the specified number of hours to a Date object.
-```javascript
-const now = new Date();
-const an_hour_ago = date.addHours(now, -1);
+- dateObj
+ - type: `Date`
+ - The Date object to modify
+- hours
+ - type: `number`
+ - The number of hours to add
+
+```typescript
+import { addHours } from 'date-and-time';
+
+const now = new Date(2025, 6, 24); // => Jul 24 2025 00:00:00
+
+addHours(now, -1); // => Jul 23 2025 23:00:00
```
-### addMinutes(dateObj, minutes)
+
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} minutes - The number of minutes to add
-- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
-- @returns {**Date**} The Date object after adding the specified number of minutes
+## addMinutes(dateObj, minutes)
-Adds minutes to a date object. Subtraction is also possible by specifying a negative value. The third parameter was deprecated in version 3.5.0. Regardless of what is specified for this parameter, the calculation results will not change.
+
+Adds the specified number of minutes to a Date object.
-```javascript
-const now = new Date();
-const two_minutes_later = date.addMinutes(now, 2);
+- dateObj
+ - type: `Date`
+ - The Date object to modify
+- minutes
+ - type: `number`
+ - The number of minutes to add
+
+```typescript
+import { addMinutes } from 'date-and-time';
+
+const now = new Date(2025, 6, 24); // => Jul 24 2025 00:00:00
+
+addMinutes(now, 2); // => Jul 24 2025 00:02:00
```
-### addSeconds(dateObj, seconds)
+
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} seconds - The number of seconds to add
-- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
-- @returns {**Date**} The Date object after adding the specified number of seconds
+## addSeconds(dateObj, seconds)
-Adds seconds to a date object. Subtraction is also possible by specifying a negative value. The third parameter was deprecated in version 3.5.0. Regardless of what is specified for this parameter, the calculation results will not change.
+
+Adds the specified number of seconds to a Date object.
-```javascript
-const now = new Date();
-const three_seconds_ago = date.addSeconds(now, -3);
+- dateObj
+ - type: `Date`
+ - The Date object to modify
+- seconds
+ - type: `number`
+ - The number of seconds to add
+
+```typescript
+import { addSeconds } from 'date-and-time';
+
+const now = new Date(2025, 6, 24); // => Jul 24 2025 00:00:00
+
+addSeconds(now, -3); // => Jul 23 2025 23:59:57
```
-### addMilliseconds(dateObj, milliseconds)
+
-- @param {**Date**} dateObj - A Date object
-- @param {**number**} milliseconds - The number of milliseconds to add
-- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
-- @returns {**Date**} The Date object after adding the specified number of milliseconds
+## addMilliseconds(dateObj, milliseconds)
-Adds milliseconds to a date object. Subtraction is also possible by specifying a negative value. The third parameter was deprecated in version 3.5.0. Regardless of what is specified for this parameter, the calculation results will not change.
+
+Adds the specified number of milliseconds to a Date object.
-```javascript
-const now = new Date();
-const a_millisecond_later = date.addMilliseconds(now, 1);
+- dateObj
+ - type: `Date`
+ - The Date object to modify
+- milliseconds
+ - type: `number`
+ - The number of milliseconds to add
+
+```typescript
+import { addMilliseconds } from 'date-and-time';
+
+const now = new Date(2025, 6, 24); // => Jul 24 2025 00:00:00.000
+
+addMilliseconds(now, 123); // => Jul 24 2025 00:00:00.123
```
-### subtract(date1, date2)
+
+
+## subtract(from, to)
-- @param {**Date**} date1 - A Date object
-- @param {**Date**} date2 - A Date object
-- @returns {**Object**} The result object of subtracting date2 from date1
+
+Calculates the difference between two dates.
+
+- from
+ - type: `Date`
+ - The first Date object
+- to
+ - type: `Date`
+ - The second Date object
+
+Returns a `Duration` instance with methods to get the difference in various units.
+
+```typescript
+import { subtract } from 'date-and-time';
-```javascript
-const today = new Date(2015, 0, 2);
const yesterday = new Date(2015, 0, 1);
+const today = new Date(2015, 0, 2, 3, 4, 5, 6);
+
+const duration = subtract(yesterday, today);
+
+duration.toDays().value; // => 1.127835...
+duration.toHours().value; // => 27.068057...
+duration.toMinutes().value; // => 1624.083433...
+duration.toSeconds().value; // => 97445.006
+duration.toMilliseconds().value; // => 97445006
+duration.toMicroseconds().value; // => 97445006000
+duration.toNanoseconds().value; // => 97445006000000
+```
-date.subtract(today, yesterday).toDays(); // => 1 = today - yesterday
-date.subtract(today, yesterday).toHours(); // => 24
-date.subtract(today, yesterday).toMinutes(); // => 1440
-date.subtract(today, yesterday).toSeconds(); // => 86400
-date.subtract(today, yesterday).toMilliseconds(); // => 86400000
+### Duration
+
+The `Duration` object can be directly created not only as a return value of the `subtract` function, but also by passing any numeric value (milliseconds) as a constructor argument.
+
+```typescript
+import { Duration } from 'date-and-time';
+
+const duration = new Duration(123);
+
+duration.toSeconds().value; // => 0.123
```
-### isLeapYear(y)
+
+toDays()
-- @param {**number**} y - A year to check
-- @returns {**boolean**} Whether the year is a leap year
+This method calculates the number of days in the duration and returns a descriptor that includes the value in days, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
-```javascript
-date.isLeapYear(2015); // => false
-date.isLeapYear(2012); // => true
+```typescript
+duration.toDays().value;
+// => 1.127835...
+
+duration.toDays().format('D[day], H:mm:ss.SSSfffFFF');
+// => 1day, 3:04:05.006000000
+
+duration.toDays().toParts();
+// => { days: 1, hours: 3, minutes: 4, seconds: 5, ... }
```
-### isSameDay(date1, date2)
+
-- @param {**Date**} date1 - A Date object
-- @param {**Date**} date2 - A Date object
-- @returns {**boolean**} Whether the two dates are the same day (time is ignored)
+
+toHours()
-```javascript
-const date1 = new Date(2017, 0, 2, 0); // Jan 2 2017 00:00:00
-const date2 = new Date(2017, 0, 2, 23, 59); // Jan 2 2017 23:59:00
-const date3 = new Date(2017, 0, 1, 23, 59); // Jan 1 2017 23:59:00
-date.isSameDay(date1, date2); // => true
-date.isSameDay(date1, date3); // => false
+This method calculates the number of hours in the duration and returns a descriptor that includes the value in hours, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
+
+```typescript
+duration.toHours().value;
+// => 27.068057...
+
+duration.toHours().format('H:mm:ss.SSSfffFFF');
+// => 27:04:05.006000000
+
+duration.toHours().toParts();
+// => { hours: 27, minutes: 4, seconds: 5, ... }
```
-### locale([locale])
+
+
+
+toMinutes()
+
+This method calculates the number of minutes in the duration and returns a descriptor that includes the value in minutes, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
-- @param {**Function|string**} [locale] - A locale installer or language code
-- @returns {**string**} The current language code
+```typescript
+duration.toMinutes().value;
+// => 1624.083433...
-It returns the current language code if called without any parameters.
+duration.toMinutes().format('m[min] ss.SSSfffFFF');
+// => 1624min 05.006000000
-```javascript
-date.locale(); // => "en"
+duration.toMinutes().toParts();
+// => { minutes: 1624, seconds: 5, milliseconds: 6, ... }
```
-To switch to any other language, call it with a locale installer or a language code.
+
-```javascript
-import es from 'date-and-time/locale/es';
+
+toSeconds()
-date.locale(es); // Switch to Spanish
+This method calculates the number of seconds in the duration and returns a descriptor that includes the value in seconds, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
+
+```typescript
+duration.toSeconds().value;
+// => 97445.006
+
+duration.toSeconds().format('s[sec] SSSfffFFF');
+// => 97445sec 006000000
+
+duration.toSeconds().toParts();
+// => { seconds: 97445, milliseconds: 6, microseconds: 0, ... }
```
-See [LOCALE.md](./LOCALE.md) for details.
+
+
+
+toMilliseconds()
-### extend(extension)
+This method calculates the number of milliseconds in the duration and returns a descriptor that includes the value in milliseconds, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
-- @param {**Object**} extension - An extension object
-- @returns {**void**}
+```typescript
+duration.toMilliseconds().value;
+// => 97445006
+
+duration.toMilliseconds().format('S.fffFFF');
+// => 97445006.000000
+
+duration.toMilliseconds().toParts();
+// => { milliseconds: 97445006, microseconds: 0, nanoseconds: 0 }
+```
-It extends this library. See [EXTEND.md](./EXTEND.md) for details.
+
+
+
+toMicroseconds()
+
+This method calculates the number of microseconds in the duration and returns a descriptor that includes the value in microseconds, a format method for custom formatting, and a toParts method that returns an object with the microseconds and nanoseconds parts.
+
+```typescript
+duration.toMicroseconds().value;
+// => 97445006000
+
+duration.toMicroseconds().format('f.FFF');
+// => 97445006000.000
+
+duration.toMicroseconds().toParts();
+// => { microseconds: 97445006000, nanoseconds: 0 }
+```
-### plugin(plugin)
+
-- @param {**Function|string**} plugin - A plugin installer or plugin name
-- @returns {**void**}
+
+toNanoseconds()
-Plugin is a named extension object. By installing predefined plugins, you can easily extend this library. See [PLUGINS.md](./PLUGINS.md) for details.
+This method calculates the number of nanoseconds in the duration and returns a descriptor that includes the value in nanoseconds, a format method for custom formatting, and a toParts method that returns an object with the nanoseconds part.
-## Browser Support
+```typescript
+duration.toNanoseconds().value;
+// => 97445006000000
+
+duration.toNanoseconds().format('F[ns]');
+// => 97445006000000ns
+
+duration.toNanoseconds().toParts();
+// => { nanoseconds: 97445006000000 }
+```
+
+
+
+### DurationDescriptor
+
+#### value
+
+The value of the duration in the respective unit.
+
+#### format(formatString[, numeral])
+
+
+Formats the duration according to the provided format string.
+
+- formatString
+ - type: `string`
+ - The format string to use for formatting
+- [numeral]
+ - type: `Numeral`
+ - default: `latn`
+ - Optional numeral object for number formatting
+
+The tokens available for use in the format string specified as the first argument and their meanings are as follows. However, tokens for units larger than the `DurationDescriptor` cannot be used. For example, in the case of a `DurationDescriptor` obtained by the `toHours` method, the `D` token representing days cannot be used. For a `DurationDescriptor` obtained by the `toNanoseconds` method, only the `F` token representing nanoseconds can be used.
+
+| Token | Meaning |
+|:---------|:-----------------------------------|
+| D | Days |
+| H | Hours |
+| m | Minutes |
+| s | Seconds |
+| S | Milliseconds |
+| f | Microseconds |
+| F | Nanoseconds |
+
+What makes the format string in `DurationDescriptor` different from others is that repeating the same token produces a zero-padding effect. For example, formatting `1 day` with `DDDD` results in an output of `0001`.
+
+
+
+#### toParts()
+
+
+Converts the duration to an object containing the parts of the duration in the respective unit.
+
+```typescript
+{
+ days: 1,
+ hours: 3,
+ minutes: 4,
+ seconds: 5,
+ milliseconds: 6,
+ microseconds: 0,
+ nanoseconds: 0
+}
+```
+
+
+
+### Notes
+
+
+Negative Duration
+
+When the `value` becomes negative, there are slight differences in the output results of the `format` method and the `toParts` method. In the `format` method, only the largest unit in the `DurationDescriptor`, for example, only the `D` token in the case of a `DurationDescriptor` obtained by the `toDays` method, gets a minus sign, while in the `toParts` method, all units get a minus sign.
+
+```typescript
+duration.toDays().value;
+// => -1.127835...
+
+duration.toDays().format('D[day], H:mm:ss.SSSfffFFF');
+// => -1day, 3:04:05.006000000
+
+duration.toDays().toParts();
+// => { days: -1, hours: -3, minutes: -4, seconds: -5, ... }
+```
+
+
+
+
+Negative Zero
+
+The `format` method may output `-0`. For example, when the value of a `DurationDescriptor` obtained by the `toDays` method is a negative decimal less than 1, using the `D` token in the `format` method outputs `-0`.
+
+```typescript
+duration.toDays().value;
+// => -0.127835...
+
+duration.toDays().format('D[day], H:mm:ss.SSSfffFFF');
+// => -0day, 3:04:05.006000000
+
+duration.toDays().toParts();
+// => { days: 0, hours: -3, minutes: -4, seconds: -5, ... }
+```
+
+
+
+
+## isLeapYear(year)
+
+
+Determines if the specified year is a leap year.
+
+- year
+ - type: `number`
+ - The year to check
+
+```typescript
+import { isLeapYear } from 'date-and-time';
+
+isLeapYear(2015); // => false
+isLeapYear(2012); // => true
+```
+
+
+
+## isSameDay(date1, date2)
+
+
+Determines if two dates represent the same calendar day.
+
+- date1
+ - type: `Date`
+ - The first date to compare
+- date2
+ - type: `Date`
+ - The second date to compare
+
+```typescript
+import { isSameDay } from 'date-and-time';
+
+const date1 = new Date(2017, 0, 2, 0); // Jan 2 2017 00:00:00
+const date2 = new Date(2017, 0, 2, 23, 59); // Jan 2 2017 23:59:00
+const date3 = new Date(2017, 0, 1, 23, 59); // Jan 1 2017 23:59:00
+
+isSameDay(date1, date2); // => true
+isSameDay(date1, date3); // => false
+```
-Chrome, Firefox, Safari, Edge, and Internet Explorer 6+.
+
## License
diff --git a/benchmark/bench.js b/benchmark/bench.js
deleted file mode 100644
index 9b2ec96..0000000
--- a/benchmark/bench.js
+++ /dev/null
@@ -1,62 +0,0 @@
-const date = require('../date-and-time');
-const rand = (min, max) => ((Math.random() * (max - min) + min) | 0);
-const M = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
-const A = ['a.m.', 'p.m.'];
-const dates = [];
-const dateString = [];
-const formatString = 'MMM. D YYYY h:m:s A';
-const cnt = 3000000;
-
-console.log('Creating a list of random date string...');
-
-for (let i = 0; i < cnt; i++) {
- const month = rand(0, 12);
- const day = '' + rand(1, 29);
- const year = '' + rand(2000, 2020);
- const hour = '' + rand(0, 12);
- const minute = '' + rand(0, 60);
- const sec = '' + rand(0, 60);
- const ampm = rand(0, 2);
- dates.push(new Date(year, month, day, hour + 12 * ampm, minute, sec));
- dateString.push(`${M[month]}. ${day} ${year} ${hour}:${minute}:${sec} ${A[ampm]}`);
-}
-
-console.log('Starting the benchmark.\n');
-
-let start = Date.now();
-
-for (let i = 0; i < cnt; i++) {
- date.format(dates[i], formatString);
-}
-
-const bench1 = Date.now() - start;
-console.log(`format(): ${bench1}ms`);
-
-start = Date.now();
-const pattern1 = date.compile(formatString);
-
-for (let i = 0; i < cnt; i++) {
- date.format(dates[i], pattern1);
-}
-
-const bench2 = Date.now() - start;
-console.log(`format() with compile(): ${bench2}ms (${Math.round(bench2 / bench1 * 100)}%)`);
-
-start = Date.now();
-
-for (let i = 0; i < cnt; i++) {
- date.parse(dateString[i], formatString);
-}
-
-const bench3 = Date.now() - start;
-console.log(`parse(): ${bench3}ms`);
-
-start = Date.now();
-const pattern2 = date.compile(formatString);
-
-for (let i = 0; i < cnt; i++) {
- date.parse(dateString[i], pattern2);
-}
-
-const bench4 = Date.now() - start;
-console.log(`parse() with compile(): ${bench4}ms (${Math.round(bench4 / bench3 * 100)}%)`);
diff --git a/date-and-time.d.ts b/date-and-time.d.ts
deleted file mode 100644
index 592064e..0000000
--- a/date-and-time.d.ts
+++ /dev/null
@@ -1,343 +0,0 @@
-/**
- * Formatting date and time objects (Date -> String)
- * @param dateObj - A Date object
- * @param formatString - A format string
- * @param [utc] - Output as UTC
- * @returns A formatted string
- */
-export function format(dateObj: Date, formatString: string, utc?: boolean): string;
-
-/**
- * Formatting date and time objects (Date -> String)
- * @param dateObj - A Date object
- * @param compiledObj - A compiled object of format string
- * @param [utc] - Output as UTC
- * @returns A formatted string
- */
-export function format(dateObj: Date, compiledObj: string[], utc?: boolean): string;
-
-/**
- * Parsing date and time strings (String -> Date)
- * @param dateString - A date and time string
- * @param formatString - A format string
- * @param [utc] - Input as UTC
- * @returns A Date object
- */
-export function parse(dateString: string, formatString: string, utc?: boolean): Date;
-
-/**
- * Parsing date and time strings (String -> Date)
- * @param dateString - A date and time string
- * @param compiledObj - A compiled object of format string
- * @param [utc] - Input as UTC
- * @returns A Date object
- */
-export function parse(dateString: string, compiledObj: string[], utc?: boolean): Date;
-
-/**
- * Compiling format strings
- * @param formatString - A format string
- * @returns A compiled object
- */
-export function compile(formatString: string): string[];
-
-/** Preparse result object */
-export type PreparseResult = {
- /** Year */
- Y: number;
- /** Month */
- M: number;
- /** Day */
- D: number;
- /** 24-hour */
- H: number;
- /** Meridiem */
- A: number;
- /** 12-hour */
- h: number;
- /** Minute */
- m: number;
- /** Second */
- s: number;
- /** Millisecond */
- S: number;
- /** Timezone offset */
- Z: number;
- /** Pointer offset */
- _index: number;
- /** Length of the date string */
- _length: number;
- /** Token matching count */
- _match: number;
-};
-
-/**
- * Pre-parsing date and time strings
- * @param dateString - A date and time string
- * @param formatString - A format string
- * @returns A pre-parsed result object
- */
-export function preparse(dateString: string, formatString: string): PreparseResult;
-
-/**
- * Pre-parsing date and time strings
- * @param dateString - A date and time string
- * @param compiledObj - A compiled object of format string
- * @returns A pre-parsed result object
- */
-export function preparse(dateString: string, compiledObj: string[]): PreparseResult;
-
-/**
- * Date and time string validation
- * @param dateString - A date and time string
- * @param formatString - A format string
- * @returns Whether the date and time string is a valid date and time
- */
-export function isValid(dateString: string, formatString: string): boolean;
-
-/**
- * Date and time string validation
- * @param dateString - A date and time string
- * @param compiledObj - A compiled object of format string
- * @returns Whether the date and time string is a valid date and time
- */
-export function isValid(dateString: string, compiledObj: string[]): boolean;
-
-/**
- * Date and time string validation
- * @param preparseResult - A pre-parsed result object
- * @returns Whether the date and time string is a valid date and time
- */
-export function isValid(preparseResult: PreparseResult): boolean;
-
-/**
- * Format transformation of date and time strings (String -> String)
- * @param dateString - A date and time string
- * @param formatString1 - A format string before transformation
- * @param formatString2 - A format string after transformation
- * @param [utc] - Output as UTC
- * @returns A formatted string
- */
-export function transform(dateString: string, formatString1: string, formatString2: string, utc?: boolean): string;
-
-/**
- * Format transformation of date and time strings (String -> String)
- * @param dateString - A date and time string
- * @param formatString - A format string before transformation
- * @param compiledObj - A compiled object of format string after transformation
- * @param [utc] - Output as UTC
- * @returns A formatted string
- */
-export function transform(dateString: string, formatString: string, compiledObj: string[], utc?: boolean): string;
-
-/**
- * Format transformation of date and time strings (String -> String)
- * @param dateString - A date and time string
- * @param compiledObj - A compiled object of format string before transformation
- * @param formatString - A format string after transformation
- * @param [utc] - Output as UTC
- * @returns A formatted string
- */
-export function transform(dateString: string, compiledObj: string[], formatString: string, utc?: boolean): string;
-
-/**
- * Format transformation of date and time strings (String -> String)
- * @param dateString - A date and time string
- * @param compiledObj1 - A compiled object of format string before transformation
- * @param compiledObj2 - A compiled object of format string after transformation
- * @param [utc] - Output as UTC
- * @returns A formatted string
- */
-export function transform(dateString: string, compiledObj1: string[], compiledObj2: string[], utc?: boolean): string;
-
-/**
- * Adding years
- * @param dateObj - A Date object
- * @param years - The number of years to add
- * @param [utc] - If true, calculates the date in UTC
- * @returns The Date object after adding the specified number of years
- */
-export function addYears(dateObj: Date, years: number, utc?: boolean): Date;
-
-/**
- * Adding months
- * @param dateObj - A Date object
- * @param months - The number of months to add
- * @param [utc] - If true, calculates the date in UTC
- * @returns The Date object after adding the specified number of months
- */
-export function addMonths(dateObj: Date, months: number, utc?: boolean): Date;
-
-/**
- * Adding days
- * @param dateObj - A Date object
- * @param days - The number of days to add
- * @param [utc] - If true, calculates the date in UTC
- * @returns The Date object after adding the specified number of days
- */
-export function addDays(dateObj: Date, days: number, utc?: boolean): Date;
-
-/**
- * Adding hours
- * @param dateObj - A Date object
- * @param hours - The number of hours to add
- * @returns The Date object after adding the specified number of hours
- */
-export function addHours(dateObj: Date, hours: number): Date;
-
-/**
- * @deprecated The `utc` parameter is ignored. The function always returns the same result regardless of this value.
- * @param dateObj - A Date object
- * @param hours - The number of hours to add
- * @param [utc] - If true, calculates the date in UTC
- * @returns The Date object after adding the specified number of hours
- */
-export function addHours(dateObj: Date, hours: number, utc?: boolean): Date;
-
-/**
- * Adding minutes
- * @param dateObj - A Date object
- * @param minutes - The number of minutes to add
- * @returns The Date object after adding the specified number of minutes
- */
-export function addMinutes(dateObj: Date, minutes: number): Date;
-
-/**
- * @deprecated The `utc` parameter is ignored. The function always returns the same result regardless of this value.
- * @param dateObj - A Date object
- * @param minutes - The number of minutes to add
- * @param [utc] - If true, calculates the date in UTC
- * @returns The Date object after adding the specified number of minutes
- */
-export function addMinutes(dateObj: Date, minutes: number, utc?: boolean): Date;
-
-/**
- * Adding seconds
- * @param dateObj - A Date object
- * @param seconds - The number of seconds to add
- * @returns The Date object after adding the specified number of seconds
- */
-export function addSeconds(dateObj: Date, seconds: number): Date;
-
-/**
- * @deprecated The `utc` parameter is ignored. The function always returns the same result regardless of this value.
- * @param dateObj - A Date object
- * @param seconds - The number of seconds to add
- * @param [utc] - If true, calculates the date in UTC
- * @returns The Date object after adding the specified number of seconds
- */
-export function addSeconds(dateObj: Date, seconds: number, utc?: boolean): Date;
-
-/**
- * Adding milliseconds
- * @param dateObj - A Date object
- * @param milliseconds - The number of milliseconds to add
- * @returns The Date object after adding the specified number of milliseconds
- */
-export function addMilliseconds(dateObj: Date, milliseconds: number): Date;
-
-/**
- * @deprecated The `utc` parameter is ignored. The function always returns the same result regardless of this value.
- * @param dateObj - A Date object
- * @param milliseconds - The number of milliseconds to add
- * @param [utc] - If true, calculates the date in UTC
- * @returns The Date object after adding the specified number of milliseconds
- */
-export function addMilliseconds(dateObj: Date, milliseconds: number, utc?: boolean): Date;
-
-/** Subtraction result object */
-export type SubtractResult = {
- /** Returns the result value in milliseconds. */
- toMilliseconds: () => number;
- /** Returns the result value in seconds. */
- toSeconds: () => number;
- /** Returns the result value in minutes. This value might be a real number. */
- toMinutes: () => number;
- /** Returns the result value in hours. This value might be a real number. */
- toHours: () => number;
- /** Returns the result value in days. This value might be a real number. */
- toDays: () => number;
-};
-
-/**
- * Subtracting two dates (date1 - date2)
- * @param date1 - A Date object
- * @param date2 - A Date object
- * @returns The result object of subtracting date2 from date1
- */
-export function subtract(date1: Date, date2: Date): SubtractResult;
-
-/**
- * Whether a year is a leap year
- * @param y - A year to check
- * @returns Whether the year is a leap year
- */
-export function isLeapYear(y: number): boolean;
-
-/**
- * Comparison of two dates
- * @param date1 - A Date object
- * @param date2 - A Date object
- * @returns Whether the two dates are the same day (time is ignored)
- */
-export function isSameDay(date1: Date, date2: Date): boolean;
-
-/** Locale installer */
-export type Locale = (proto: unknown) => string;
-
-/**
- * Changing locales
- * @param [locale] - A locale installer
- * @returns The current language code
- */
-export function locale(locale?: Locale): string;
-
-/**
- * Changing locales
- * @param [locale] - A language code
- * @returns The current language code
- */
-export function locale(locale?: string): string;
-
-export type Resources = {
- [key: string]: string[] | string[][]
-};
-
-export type Formatter = {
-};
-
-export type Parser = {
-};
-
-export type Extender = {
- [key: string]: (...args: any) => any
-};
-
-/** Extension object */
-export type Extension = {
- res?: Resources,
- formatter?: Formatter,
- parser?: Parser,
- extender?: Extender
-};
-
-/**
- * Functional extension
- * @param extension - An extension object
- */
-export function extend(extension: Extension): void;
-
-/** Plugin installer */
-export type Plugin = (proto: unknown, date?: unknown) => string;
-
-/**
- * Importing plugins
- * @param plugin - A plugin installer
- */
-export function plugin(plugin: Plugin): void;
-
-/**
- * Importing plugins
- * @param plugin - A plugin name
- */
-export function plugin(plugin: string): void;
diff --git a/date-and-time.js b/date-and-time.js
deleted file mode 100644
index 5f72aa5..0000000
--- a/date-and-time.js
+++ /dev/null
@@ -1,520 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.date = factory());
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time (c) KNOWLEDGECODE | MIT
- */
-
- var locales = {},
- plugins = {},
- lang = 'en',
- _res = {
- MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- dddd: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
- ddd: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- dd: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
- A: ['AM', 'PM']
- },
- _formatter = {
- YYYY: function (d/*, formatString*/) { return ('000' + d.getFullYear()).slice(-4); },
- YY: function (d/*, formatString*/) { return ('0' + d.getFullYear()).slice(-2); },
- Y: function (d/*, formatString*/) { return '' + d.getFullYear(); },
- MMMM: function (d/*, formatString*/) { return this.res.MMMM[d.getMonth()]; },
- MMM: function (d/*, formatString*/) { return this.res.MMM[d.getMonth()]; },
- MM: function (d/*, formatString*/) { return ('0' + (d.getMonth() + 1)).slice(-2); },
- M: function (d/*, formatString*/) { return '' + (d.getMonth() + 1); },
- DD: function (d/*, formatString*/) { return ('0' + d.getDate()).slice(-2); },
- D: function (d/*, formatString*/) { return '' + d.getDate(); },
- HH: function (d/*, formatString*/) { return ('0' + d.getHours()).slice(-2); },
- H: function (d/*, formatString*/) { return '' + d.getHours(); },
- A: function (d/*, formatString*/) { return this.res.A[d.getHours() > 11 | 0]; },
- hh: function (d/*, formatString*/) { return ('0' + (d.getHours() % 12 || 12)).slice(-2); },
- h: function (d/*, formatString*/) { return '' + (d.getHours() % 12 || 12); },
- mm: function (d/*, formatString*/) { return ('0' + d.getMinutes()).slice(-2); },
- m: function (d/*, formatString*/) { return '' + d.getMinutes(); },
- ss: function (d/*, formatString*/) { return ('0' + d.getSeconds()).slice(-2); },
- s: function (d/*, formatString*/) { return '' + d.getSeconds(); },
- SSS: function (d/*, formatString*/) { return ('00' + d.getMilliseconds()).slice(-3); },
- SS: function (d/*, formatString*/) { return ('0' + (d.getMilliseconds() / 10 | 0)).slice(-2); },
- S: function (d/*, formatString*/) { return '' + (d.getMilliseconds() / 100 | 0); },
- dddd: function (d/*, formatString*/) { return this.res.dddd[d.getDay()]; },
- ddd: function (d/*, formatString*/) { return this.res.ddd[d.getDay()]; },
- dd: function (d/*, formatString*/) { return this.res.dd[d.getDay()]; },
- Z: function (d/*, formatString*/) {
- var offset = d.getTimezoneOffset() / 0.6 | 0;
- return (offset > 0 ? '-' : '+') + ('000' + Math.abs(offset - (offset % 100 * 0.4 | 0))).slice(-4);
- },
- ZZ: function (d/*, formatString*/) {
- var offset = d.getTimezoneOffset();
- var mod = Math.abs(offset);
- return (offset > 0 ? '-' : '+') + ('0' + (mod / 60 | 0)).slice(-2) + ':' + ('0' + mod % 60).slice(-2);
- },
- post: function (str) { return str; },
- res: _res
- },
- _parser = {
- YYYY: function (str/*, formatString */) { return this.exec(/^\d{4}/, str); },
- Y: function (str/*, formatString */) { return this.exec(/^\d{1,4}/, str); },
- MMMM: function (str/*, formatString */) {
- var result = this.find(this.res.MMMM, str);
- result.value++;
- return result;
- },
- MMM: function (str/*, formatString */) {
- var result = this.find(this.res.MMM, str);
- result.value++;
- return result;
- },
- MM: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- M: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- DD: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- D: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- HH: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- H: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- A: function (str/*, formatString */) { return this.find(this.res.A, str); },
- hh: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- h: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- mm: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- m: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- ss: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- s: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- SSS: function (str/*, formatString */) { return this.exec(/^\d{1,3}/, str); },
- SS: function (str/*, formatString */) {
- var result = this.exec(/^\d\d?/, str);
- result.value *= 10;
- return result;
- },
- S: function (str/*, formatString */) {
- var result = this.exec(/^\d/, str);
- result.value *= 100;
- return result;
- },
- Z: function (str/*, formatString */) {
- var result = this.exec(/^[+-]\d{2}[0-5]\d/, str);
- result.value = (result.value / 100 | 0) * -60 - result.value % 100;
- return result;
- },
- ZZ: function (str/*, formatString */) {
- var arr = /^([+-])(\d{2}):([0-5]\d)/.exec(str) || ['', '', '', ''];
- return { value: 0 - ((arr[1] + arr[2] | 0) * 60 + (arr[1] + arr[3] | 0)), length: arr[0].length };
- },
- h12: function (h, a) { return (h === 12 ? 0 : h) + a * 12; },
- exec: function (re, str) {
- var result = (re.exec(str) || [''])[0];
- return { value: result | 0, length: result.length };
- },
- find: function (array, str) {
- var index = -1, length = 0;
-
- for (var i = 0, len = array.length, item; i < len; i++) {
- item = array[i];
- if (!str.indexOf(item) && item.length > length) {
- index = i;
- length = item.length;
- }
- }
- return { value: index, length: length };
- },
- pre: function (str) { return str; },
- res: _res
- },
- extend = function (base, props, override, res) {
- var obj = {}, key;
-
- for (key in base) {
- obj[key] = base[key];
- }
- for (key in props || {}) {
- if (!(!!override ^ !!obj[key])) {
- obj[key] = props[key];
- }
- }
- if (res) {
- obj.res = res;
- }
- return obj;
- },
- proto = {
- _formatter: _formatter,
- _parser: _parser
- },
- date;
-
- /**
- * Compiling format strings
- * @param {string} formatString - A format string
- * @returns {Array.} A compiled object
- */
- proto.compile = function (formatString) {
- return [formatString].concat(formatString.match(/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g) || []);
- };
-
- /**
- * Formatting date and time objects (Date -> String)
- * @param {Date} dateObj - A Date object
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Output as UTC
- * @returns {string} A formatted string
- */
- proto.format = function (dateObj, arg, utc) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- formatter = ctx._formatter,
- d = (function () {
- if (utc) {
- var u = new Date(dateObj.getTime());
-
- u.getFullYear = u.getUTCFullYear;
- u.getMonth = u.getUTCMonth;
- u.getDate = u.getUTCDate;
- u.getHours = u.getUTCHours;
- u.getMinutes = u.getUTCMinutes;
- u.getSeconds = u.getUTCSeconds;
- u.getMilliseconds = u.getUTCMilliseconds;
- u.getDay = u.getUTCDay;
- u.getTimezoneOffset = function () { return 0; };
- u.getTimezoneName = function () { return 'UTC'; };
- return u;
- }
- return dateObj;
- }()),
- comment = /^\[(.*)\]$/, str = '';
-
- for (var i = 1, len = pattern.length, token; i < len; i++) {
- token = pattern[i];
- str += formatter[token]
- ? formatter.post(formatter[token](d, pattern[0]))
- : comment.test(token) ? token.replace(comment, '$1') : token;
- }
- return str;
- };
-
- /**
- * Pre-parsing date and time strings
- * @param {string} dateString - A date and time string
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Input as UTC
- * @returns {Object} A pre-parsed result object
- */
- proto.preparse = function (dateString, arg) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- parser = ctx._parser,
- dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 0, _match: 0 },
- wildcard = ' ', comment = /^\[(.*)\]$/, ellipsis = '...';
-
- dateString = parser.pre(dateString);
- for (var i = 1, len = pattern.length, token, str, result; i < len; i++) {
- token = pattern[i];
- str = dateString.substring(dt._index);
-
- if (parser[token]) {
- result = parser[token](str, pattern[0]);
- if (!result.length) {
- break;
- }
- dt[result.token || token.charAt(0)] = result.value;
- dt._index += result.length;
- dt._match++;
- } else if (token === str.charAt(0) || token === wildcard) {
- dt._index++;
- } else if (comment.test(token) && !str.indexOf(token.replace(comment, '$1'))) {
- dt._index += token.length - 2;
- } else if (token === ellipsis) {
- dt._index = dateString.length;
- break;
- } else {
- break;
- }
- }
- dt.H = dt.H || parser.h12(dt.h, dt.A);
- dt._length = dateString.length;
- return dt;
- };
-
- /**
- * Parsing of date and time string (String -> Date)
- * @param {string} dateString - A date-time string
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Input as UTC
- * @returns {Date} A Date object
- */
- proto.parse = function (dateString, arg, utc) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- dt = ctx.preparse(dateString, pattern);
-
- if (ctx.isValid(dt)) {
- dt.M -= dt.Y < 100 ? 22801 : 1; // 22801 = 1900 * 12 + 1
- if (utc || ~ctx._parser.find(pattern, 'ZZ').value) {
- return new Date(Date.UTC(dt.Y, dt.M, dt.D, dt.H, dt.m + dt.Z, dt.s, dt.S));
- }
- return new Date(dt.Y, dt.M, dt.D, dt.H, dt.m, dt.s, dt.S);
- }
- return new Date(NaN);
- };
-
- /**
- * Date and time string validation
- * @param {Object|string} arg1 - A pre-parsed result object or a date and time string
- * @param {string|Array.} [arg2] - A format string or its compiled object
- * @returns {boolean} Whether the date and time string is a valid date and time
- */
- proto.isValid = function (arg1, arg2) {
- var ctx = this || date, dt = typeof arg1 === 'string' ? ctx.preparse(arg1, arg2) : arg1;
-
- return !(
- dt._index < 1 || dt._length < 1 || dt._index - dt._length || dt._match < 1
- || dt.Y < 1 || dt.Y > 9999 || dt.M < 1 || dt.M > 12 || dt.D < 1 || dt.D > new Date(dt.Y, dt.M, 0).getDate()
- || dt.H < 0 || dt.H > 23 || dt.m < 0 || dt.m > 59 || dt.s < 0 || dt.s > 59 || dt.S < 0 || dt.S > 999
- || dt.Z < -840 || dt.Z > 720
- );
- };
-
- /**
- * Format transformation of date and time string (String -> String)
- * @param {string} dateString - A date and time string
- * @param {string|Array.} arg1 - A format string or its compiled object before transformation
- * @param {string|Array.} arg2 - A format string or its compiled object after transformation
- * @param {boolean} [utc] - Output as UTC
- * @returns {string} A formatted string
- */
- proto.transform = function (dateString, arg1, arg2, utc) {
- const ctx = this || date;
- return ctx.format(ctx.parse(dateString, arg1), arg2, utc);
- };
-
- /**
- * Adding years
- * @param {Date} dateObj - A Date object
- * @param {number} years - Number of years to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
- proto.addYears = function (dateObj, years, utc) {
- return (this || date).addMonths(dateObj, years * 12, utc);
- };
-
- /**
- * Adding months
- * @param {Date} dateObj - A Date object
- * @param {number} months - Number of months to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
- proto.addMonths = function (dateObj, months, utc) {
- var d = new Date(dateObj.getTime());
-
- if (utc) {
- d.setUTCMonth(d.getUTCMonth() + months);
- if (d.getUTCDate() < dateObj.getUTCDate()) {
- d.setUTCDate(0);
- return d;
- }
- } else {
- d.setMonth(d.getMonth() + months);
- if (d.getDate() < dateObj.getDate()) {
- d.setDate(0);
- return d;
- }
- }
- return d;
- };
-
- /**
- * Adding days
- * @param {Date} dateObj - A Date object
- * @param {number} days - Number of days to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
- proto.addDays = function (dateObj, days, utc) {
- var d = new Date(dateObj.getTime());
-
- if (utc) {
- d.setUTCDate(d.getUTCDate() + days);
- } else {
- d.setDate(d.getDate() + days);
- }
- return d;
- };
-
- /**
- * Adding hours
- * @param {Date} dateObj - A Date object
- * @param {number} hours - Number of hours to add
- * @returns {Date} The Date object after adding the value
- */
- proto.addHours = function (dateObj, hours) {
- return new Date(dateObj.getTime() + hours * 60 * 60 * 1000);
- };
-
- /**
- * Adding minutes
- * @param {Date} dateObj - A Date object
- * @param {number} minutes - Number of minutes to add
- * @returns {Date} The Date object after adding the value
- */
- proto.addMinutes = function (dateObj, minutes) {
- return new Date(dateObj.getTime() + minutes * 60 * 1000);
- };
-
- /**
- * Adding seconds
- * @param {Date} dateObj - A Date object
- * @param {number} seconds - Number of seconds to add
- * @returns {Date} The Date object after adding the value
- */
- proto.addSeconds = function (dateObj, seconds) {
- return new Date(dateObj.getTime() + seconds * 1000);
- };
-
- /**
- * Adding milliseconds
- * @param {Date} dateObj - A Date object
- * @param {number} milliseconds - Number of milliseconds to add
- * @returns {Date} The Date object after adding the value
- */
- proto.addMilliseconds = function (dateObj, milliseconds) {
- return new Date(dateObj.getTime() + milliseconds);
- };
-
- /**
- * Subtracting two dates (date1 - date2)
- * @param {Date} date1 - A Date object
- * @param {Date} date2 - A Date object
- * @returns {Object} The result object of subtracting date2 from date1
- */
- proto.subtract = function (date1, date2) {
- var delta = date1.getTime() - date2.getTime();
-
- return {
- toMilliseconds: function () {
- return delta;
- },
- toSeconds: function () {
- return delta / 1000;
- },
- toMinutes: function () {
- return delta / 60000;
- },
- toHours: function () {
- return delta / 3600000;
- },
- toDays: function () {
- return delta / 86400000;
- }
- };
- };
-
- /**
- * Whether a year is a leap year
- * @param {number} y - A year to check
- * @returns {boolean} Whether the year is a leap year
- */
- proto.isLeapYear = function (y) {
- return (!(y % 4) && !!(y % 100)) || !(y % 400);
- };
-
- /**
- * Comparison of two dates
- * @param {Date} date1 - A Date object
- * @param {Date} date2 - A Date object
- * @returns {boolean} Whether the two dates are the same day (time is ignored)
- */
- proto.isSameDay = function (date1, date2) {
- return date1.toDateString() === date2.toDateString();
- };
-
- /**
- * Definition of new locale
- * @param {string} code - A language code
- * @param {Function} locale - A locale installer
- * @returns {void}
- */
- proto.locale = function (code, locale) {
- if (!locales[code]) {
- locales[code] = locale;
- }
- };
-
- /**
- * Definition of new plugin
- * @param {string} name - A plugin name
- * @param {Function} plugin - A plugin installer
- * @returns {void}
- */
- proto.plugin = function (name, plugin) {
- if (!plugins[name]) {
- plugins[name] = plugin;
- }
- };
-
- date = extend(proto);
-
- /**
- * Changing locales
- * @param {Function|string} [locale] - A locale installer or language code
- * @returns {string} The current language code
- */
- date.locale = function (locale) {
- var install = typeof locale === 'function' ? locale : date.locale[locale];
-
- if (!install) {
- return lang;
- }
- lang = install(proto);
-
- var extension = locales[lang] || {};
- var res = extend(_res, extension.res, true);
- var formatter = extend(_formatter, extension.formatter, true, res);
- var parser = extend(_parser, extension.parser, true, res);
-
- date._formatter = formatter;
- date._parser = parser;
-
- for (var plugin in plugins) {
- date.extend(plugins[plugin]);
- }
-
- return lang;
- };
-
- /**
- * Functional extension
- * @param {Object} extension - An extension object
- * @returns {void}
- */
- date.extend = function (extension) {
- var res = extend(date._parser.res, extension.res);
- var extender = extension.extender || {};
-
- date._formatter = extend(date._formatter, extension.formatter, false, res);
- date._parser = extend(date._parser, extension.parser, false, res);
-
- for (var key in extender) {
- if (!date[key]) {
- date[key] = extender[key];
- }
- }
- };
-
- /**
- * Importing plugins
- * @param {Function|string} plugin - A plugin installer or plugin name
- * @returns {void}
- */
- date.plugin = function (plugin) {
- var install = typeof plugin === 'function' ? plugin : date.plugin[plugin];
-
- if (install) {
- date.extend(plugins[install(proto, date)] || {});
- }
- };
-
- var date$1 = date;
-
- return date$1;
-
-}));
diff --git a/date-and-time.min.js b/date-and-time.min.js
deleted file mode 100644
index e90c38b..0000000
--- a/date-and-time.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).date=t()}(this,(function(){"use strict";
-/**
- * @preserve date-and-time (c) KNOWLEDGECODE | MIT
- */var e,t={},n={},r="en",u={MMMM:["January","February","March","April","May","June","July","August","September","October","November","December"],MMM:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd:["Su","Mo","Tu","We","Th","Fr","Sa"],A:["AM","PM"]},i={YYYY:function(e){return("000"+e.getFullYear()).slice(-4)},YY:function(e){return("0"+e.getFullYear()).slice(-2)},Y:function(e){return""+e.getFullYear()},MMMM:function(e){return this.res.MMMM[e.getMonth()]},MMM:function(e){return this.res.MMM[e.getMonth()]},MM:function(e){return("0"+(e.getMonth()+1)).slice(-2)},M:function(e){return""+(e.getMonth()+1)},DD:function(e){return("0"+e.getDate()).slice(-2)},D:function(e){return""+e.getDate()},HH:function(e){return("0"+e.getHours()).slice(-2)},H:function(e){return""+e.getHours()},A:function(e){return this.res.A[e.getHours()>11|0]},hh:function(e){return("0"+(e.getHours()%12||12)).slice(-2)},h:function(e){return""+(e.getHours()%12||12)},mm:function(e){return("0"+e.getMinutes()).slice(-2)},m:function(e){return""+e.getMinutes()},ss:function(e){return("0"+e.getSeconds()).slice(-2)},s:function(e){return""+e.getSeconds()},SSS:function(e){return("00"+e.getMilliseconds()).slice(-3)},SS:function(e){return("0"+(e.getMilliseconds()/10|0)).slice(-2)},S:function(e){return""+(e.getMilliseconds()/100|0)},dddd:function(e){return this.res.dddd[e.getDay()]},ddd:function(e){return this.res.ddd[e.getDay()]},dd:function(e){return this.res.dd[e.getDay()]},Z:function(e){var t=e.getTimezoneOffset()/.6|0;return(t>0?"-":"+")+("000"+Math.abs(t-(t%100*.4|0))).slice(-4)},ZZ:function(e){var t=e.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+("0"+(n/60|0)).slice(-2)+":"+("0"+n%60).slice(-2)},post:function(e){return e},res:u},o={YYYY:function(e){return this.exec(/^\d{4}/,e)},Y:function(e){return this.exec(/^\d{1,4}/,e)},MMMM:function(e){var t=this.find(this.res.MMMM,e);return t.value++,t},MMM:function(e){var t=this.find(this.res.MMM,e);return t.value++,t},MM:function(e){return this.exec(/^\d\d/,e)},M:function(e){return this.exec(/^\d\d?/,e)},DD:function(e){return this.exec(/^\d\d/,e)},D:function(e){return this.exec(/^\d\d?/,e)},HH:function(e){return this.exec(/^\d\d/,e)},H:function(e){return this.exec(/^\d\d?/,e)},A:function(e){return this.find(this.res.A,e)},hh:function(e){return this.exec(/^\d\d/,e)},h:function(e){return this.exec(/^\d\d?/,e)},mm:function(e){return this.exec(/^\d\d/,e)},m:function(e){return this.exec(/^\d\d?/,e)},ss:function(e){return this.exec(/^\d\d/,e)},s:function(e){return this.exec(/^\d\d?/,e)},SSS:function(e){return this.exec(/^\d{1,3}/,e)},SS:function(e){var t=this.exec(/^\d\d?/,e);return t.value*=10,t},S:function(e){var t=this.exec(/^\d/,e);return t.value*=100,t},Z:function(e){var t=this.exec(/^[+-]\d{2}[0-5]\d/,e);return t.value=-60*(t.value/100|0)-t.value%100,t},ZZ:function(e){var t=/^([+-])(\d{2}):([0-5]\d)/.exec(e)||["","","",""];return{value:0-(60*(t[1]+t[2]|0)+(t[1]+t[3]|0)),length:t[0].length}},h12:function(e,t){return(12===e?0:e)+12*t},exec:function(e,t){var n=(e.exec(t)||[""])[0];return{value:0|n,length:n.length}},find:function(e,t){for(var n,r=-1,u=0,i=0,o=e.length;iu&&(r=i,u=n.length);return{value:r,length:u}},pre:function(e){return e},res:u},s=function(e,t,n,r){var u,i={};for(u in e)i[u]=e[u];for(u in t||{})!!n^!!i[u]||(i[u]=t[u]);return r&&(i.res=r),i},a={_formatter:i,_parser:o};return a.compile=function(e){return[e].concat(e.match(/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g)||[])},a.format=function(t,n,r){for(var u,i=this||e,o="string"==typeof n?i.compile(n):n,s=i._formatter,a=function(){if(r){var e=new Date(t.getTime());return e.getFullYear=e.getUTCFullYear,e.getMonth=e.getUTCMonth,e.getDate=e.getUTCDate,e.getHours=e.getUTCHours,e.getMinutes=e.getUTCMinutes,e.getSeconds=e.getUTCSeconds,e.getMilliseconds=e.getUTCMilliseconds,e.getDay=e.getUTCDay,e.getTimezoneOffset=function(){return 0},e.getTimezoneName=function(){return"UTC"},e}return t}(),c=/^\[(.*)\]$/,f="",d=1,l=o.length;d9999||r.M<1||r.M>12||r.D<1||r.D>new Date(r.Y,r.M,0).getDate()||r.H<0||r.H>23||r.m<0||r.m>59||r.s<0||r.s>59||r.S<0||r.S>999||r.Z<-840||r.Z>720)},a.transform=function(t,n,r,u){const i=this||e;return i.format(i.parse(t,n),r,u)},a.addYears=function(t,n,r){return(this||e).addMonths(t,12*n,r)},a.addMonths=function(e,t,n){var r=new Date(e.getTime());if(n){if(r.setUTCMonth(r.getUTCMonth()+t),r.getUTCDate() Wed, Jul 09 2025
+```
+
+- CommonJS:
+
+```typescript
+const { format } = require('date-and-time');
+
+format(new Date(), 'ddd, MMM DD YYYY');
+// => Wed, Jul 09 2025
+```
+
+## API
+
+### format
+
+The third argument has been changed from `boolean` to `FormatterOptions`. With `FormatterOptions`, you can now specify timezone and locale settings. If you previously set the third argument to `true` to output in UTC timezone, you can achieve the same output as follows:
+
+```typescript
+import { format } from 'date-and-time';
+
+format(new Date(), 'ddd, MMM DD YYYY hh:mm A [GMT]Z', { timeZone: 'UTC' });
+// => Fri, Jan 02 2015 07:14 AM GMT+0000
+```
+
+Additionally, since the `timezone` plugin has been integrated into the main library, the `formatTZ` function has been deprecated. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
+
+```typescript
+import { format } from 'date-and-time';
+import New_York from 'date-and-time/timezones/America/New_York';
+
+format(now, 'dddd, MMMM D, YYYY [at] H:mm:ss.SSS [GMT]ZZ', { timeZone: New_York });
+// => Wednesday, July 23, 2025 at 3:28:27.443 GMT-04:00
+```
+
+### parse
+
+The third argument has been changed from `boolean` to `ParserOptions`. With `ParserOptions`, you can now specify timezone and locale settings. If you previously set the third argument to `true` to parse input in UTC timezone, you can achieve the same output as follows:
+
+```typescript
+import { parse } from 'date-and-time';
+
+parse('11:14:05 PM', 'h:mm:ss A', { timeZone: 'UTC' });
+// => Jan 02 1970 23:14:05 GMT+0000
+```
+
+Additionally, since the `timezone` plugin has been integrated into the main library, the `parseTZ` function has been deprecated. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
+
+```typescript
+import { parse } from 'date-and-time';
+import Paris from 'date-and-time/timezones/Europe/Paris';
+import fr from 'date-and-time/locales/fr';
+
+parse(
+ '02 janv. 2015, 11:14:05 PM', 'DD MMM YYYY, h:mm:ss A',
+ { timeZone: Paris, locale: fr }
+);
+// => Jan 02 2015 23:14:05 GMT+0100
+```
+
+### preparse
+
+The third argument has been changed from `boolean` to `ParserOptions`. With `ParserOptions`, you can now specify timezone and locale settings. If you previously set the third argument to `true` to parse input in UTC timezone, you can achieve the same output as follows:
+
+```typescript
+import { preparse } from 'date-and-time';
+
+preparse('11:14:05 PM', 'h:mm:ss A', { timeZone: 'UTC' });
+
+{
+ A: 1,
+ h: 11,
+ m: 14,
+ s: 5,
+ _index: 11,
+ _length: 11,
+ _match: 4
+}
+```
+
+Additionally, the `PreparseResult` object returned by the `preparse` function has the following changes:
+
+- Properties for tokens that were not read are not included. For example, in the code example above, since the string does not contain a date part, properties representing dates such as `Y`, `M`, and `D` are not included.
+- Read values are returned as-is. For example, previously, time read in 12-hour format was converted to 24-hour format, but this is no longer done.
+
+### isValid
+
+The following usage that takes `PreparseResult` as an argument has been deprecated.
+
+```typescript
+import { isValid, preparse } from 'date-and-time';
+
+const pr = preparse('11:14:05 PM', 'h:mm:ss A');
+
+// This usage is no longer supported
+isValid(pr);
+```
+
+Other changes are the same as for the `parse` function.
+
+### transform
+
+The fourth argument has been changed from `boolean` to `FormatterOptions`. With `FormatterOptions`, you can now specify timezone and locale settings. Additionally, `ParserOptions` has been added as a parameter before `FormatterOptions`. Since the `timezone` plugin has been integrated into the main library, the `transformTZ` function has been deprecated.
+
+```typescript
+import { transform } from 'date-and-time';
+import New_York from 'date-and-time/timezones/America/New_York';
+import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
+
+// Convert 24-hour format to 12-hour format
+transform('13:05', 'HH:mm', 'hh:mm A', { timeZone: 'UTC' }, { timeZone: 'UTC' });
+// => 01:05 PM
+
+// Convert East Coast time to West Coast time
+transform(
+ '3/8/2020 1:05 PM', 'D/M/YYYY h:mm A', 'D/M/YYYY h:mm A',
+ { timeZone: New_York }, { timeZone: Los_Angeles }
+);
+// => 3/8/2020 10:05 AM
+```
+
+### addYears
+
+The third argument has been changed from `boolean` to `TimeZone | UTC`. If you previously set the third argument to `true` to calculate in UTC timezone, you can achieve the same output as follows:
+
+```typescript
+import { addYears } from 'date-and-time';
+
+const now = new Date(Date.UTC(2024, 2, 11, 1));
+// => Mar 11 2024 01:00:00 GMT+0000
+
+addYears(now, 1, 'UTC');
+// => Mar 11 2025 01:00:00 GMT+0000
+```
+
+Additionally, since the `timezone` plugin has been integrated into the main library, the `addYearsTZ` function has been deprecated. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
+
+```typescript
+import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
+
+const now = new Date(2024, 2, 11, 1);
+// => Mar 11 2024 01:00:00 GMT-07:00
+
+addYears(now, 1, Los_Angeles);
+// => Mar 11 2025 01:00:00 GMT-07:00
+```
+
+### addMonths
+
+The changes are the same as for the `addYears` function.
+
+### addDays
+
+The changes are the same as for the `addYears` function.
+
+### subtract
+
+The calculation order has been reversed. Previously, the second argument was subtracted from the first argument, but now the first argument is subtracted from the second argument.
+Additionally, the return value object has been changed to `Duration`. You can achieve the same output as before as follows:
+
+```typescript
+import { subtract } from 'date-and-time';
+
+const yesterday = new Date(2015, 0, 1);
+const today = new Date(2015, 0, 2);
+
+subtract(yesterday, today).toDays().value; // => 1
+subtract(yesterday, today).toHours().value; // => 24
+subtract(yesterday, today).toMinutes().value; // => 1440
+subtract(yesterday, today).toSeconds().value; // => 86400
+subtract(yesterday, today).toMilliseconds().value; // => 86400000
+```
+
+### timeSpan
+
+The `timespan` plugin has been deprecated as it has been integrated into the main library's `subtract` function. Please note that the argument order of the `subtract` function has changed. You can achieve the same output as before as follows:
+
+```typescript
+import { subtract } from 'date-and-time';
+
+const new_years_day = new Date(2020, 0, 1);
+const now = new Date(2020, 2, 5, 1, 2, 3, 4);
+
+subtract(new_years_day, now).toDays().format('D HH:mm:ss.SSS');
+// => 64 01:02:03.004
+
+subtract(new_years_day, now).toHours().format('H [hours] m [minutes] s [seconds]');
+// => 1537 hours 2 minutes 3 seconds
+
+subtract(new_years_day, now).toMinutes().format('mmmmmmmmmm [minutes]');
+// => 0000092222 minutes
+```
+
+## Locale
+
+The method for switching locales has changed. Previously, the locale used throughout the library was switched, but now it is specified as a function argument. Below is a code example for the `format` function.
+
+```typescript
+import { format } from 'date-and-time';
+import es from 'date-and-time/locales/es';
+
+format(new Date(), 'dddd, D [de] MMMM [de] YYYY, h:mm aa [GMT]ZZ', { locale: es });
+// => miércoles, 23 de julio de 2025, 12:38 a.m. GMT-07:00
+```
+
+## Plugins
+
+The following plugins have been deprecated as they have been integrated into the main library:
+
+- `meridiem`
+- `timespan`
+- `timezone`
diff --git a/docs/PLUGINS.md b/docs/PLUGINS.md
new file mode 100644
index 0000000..3aae836
--- /dev/null
+++ b/docs/PLUGINS.md
@@ -0,0 +1,206 @@
+# Plugins
+
+`date-and-time` adopts a plugin system. Special tokens that are considered to be used relatively infrequently are provided as plugins outside the main library. By adding plugins as needed, you can use those tokens in `Formatter` and `Parser`. Here, `Formatter` refers to the output engine used by the `format` function, and `Parser` refers to the parsing engine used by the `parse`, `preparse`, and `isValid` functions. These engines are extended by adding plugins as arguments to these functions.
+
+## Install
+
+- ESModules:
+
+```typescript
+import { format } from 'date-and-time';
+import foobar from 'date-and-time/plugins/foobar';
+
+format(new Date(), 'ddd, MMM DD YYYY', { plugins: [foobar] });
+```
+
+- CommonJS:
+
+```typescript
+const { format } = require('date-and-time');
+const foobar = require('date-and-time/plugins/foobar');
+
+format(new Date(), 'ddd, MMM DD YYYY', { plugins: [foobar] });
+```
+
+## Plugin List
+
+
+day-of-week
+
+You can add tokens to the `Parser` to read day of the week. Since day of the week is not information that can identify a specific date, it is actually a meaningless token, but it can be used to skip that portion when the string you want to read contains a day of the week.
+
+`Parser`:
+
+| Token | Meaning | Input Examples |
+|:---------|:-----------------------------------|:---------------|
+| dddd | Full day name | Friday, Sunday |
+| ddd | Short day name | Fri, Sun |
+| dd | Very short day name | Fr, Su |
+
+```typescript
+import { parse } from 'date-and-time';
+import day_of_week from 'date-and-time/plugins/day_of_week';
+
+parse(
+ 'Thursday, March 05, 2020', 'dddd, MMMM, D YYYY',
+ { plugins: [day_of_week] }
+);
+```
+
+
+
+
+microsecond
+
+You can add tokens to the `Parser` to read microseconds. Since the precision of JavaScript's Date type is milliseconds, these tokens are actually meaningless, but they can be used to skip that portion when the string you want to read contains microseconds.
+
+`Parser`:
+
+| Token | Meaning | Input Examples |
+|:----------|:---------------------------------|:---------------|
+| SSSSSS | 6-digit milliseconds | 123456, 000001 |
+| SSSSS | 5-digit milliseconds | 12345, 00001 |
+| SSSS | 4-digit milliseconds | 1234, 0001 |
+| fff | 3-digit microseconds | 753, 022 |
+| ff | 2-digit microseconds | 75, 02 |
+| f | 1-digit microseconds | 7, 0 |
+
+```typescript
+import { parse } from 'date-and-time';
+import microsecond from 'date-and-time/plugins/microsecond';
+
+parse('12:34:56.123456', 'HH:mm:ss.SSSSSS', { plugins: [microsecond] });
+parse('12:34:56 123.456', 'HH:mm:ss SSS.fff', { plugins: [microsecond] });
+```
+
+
+
+
+nanosecond
+
+You can add tokens to the `Parser` to read nanoseconds. Since the precision of JavaScript's Date type is milliseconds, these tokens are actually meaningless, but they can be used to skip that portion when the string you want to read contains nanoseconds.
+
+`Parser`:
+
+| Token | Meaning | Input Examples |
+|:----------|:---------------------------------|:---------------------|
+| SSSSSSSSS | 9-digit milliseconds | 123456789, 000000001 |
+| SSSSSSSS | 8-digit milliseconds | 12345678, 00000001 |
+| SSSSSSS | 7-digit milliseconds | 1234567, 0000001 |
+| FFF | 3-digit nanoseconds | 753, 022 |
+| FF | 2-digit nanoseconds | 75, 02 |
+| F | 1-digit nanoseconds | 7, 0 |
+
+```typescript
+import { parse } from 'date-and-time';
+import microsecond from 'date-and-time/plugins/microsecond';
+import nanosecond from 'date-and-time/plugins/nanosecond';
+
+parse(
+ '12:34:56.123456789',
+ 'HH:mm:ss.SSSSSSSSS',
+ { plugins: [microsecond, nanosecond] }
+);
+
+parse(
+ '12:34:56 123456.789',
+ 'HH:mm:ss SSSSSS.FFF',
+ { plugins: [microsecond, nanosecond] }
+);
+```
+
+
+
+
+ordinal
+
+You can add tokens to the `Formatter` and `Parser` to output or read ordinal representations of days. This ordinal representation is limited to English and is not supported for locales other than English.
+
+`Formatter`:
+
+| Token | Meaning | Output Examples |
+|:----------|:---------------------------------|:---------------------|
+| DDD | Ordinal representation of day | 1st, 2nd, 3rd |
+
+```typescript
+import { format } from 'date-and-time';
+import ordinal from 'date-and-time/plugins/ordinal';
+
+format(new Date(), 'MMM DDD YYYY', { plugins: [ordinal] });
+// => Jan 1st 2019
+```
+
+`Parser`:
+
+| Token | Meaning | Input Examples |
+|:----------|:---------------------------------|:---------------------|
+| DDD | Ordinal representation of day | 1st, 2nd, 3rd |
+
+```typescript
+import { parse } from 'date-and-time';
+import ordinal from 'date-and-time/plugins/ordinal';
+
+parse('Jan 1st 2019', 'MMM DDD YYYY', { plugins: [ordinal] });
+```
+
+
+
+
+two-digit-year
+
+You can add tokens to the `Parser` to read 2-digit years. This token identifies years based on the following rules:
+
+- Values of 70 or above are interpreted as 1900s
+- Values of 69 or below are interpreted as 2000s
+
+`Parser`:
+
+| Token | Meaning | Input Examples |
+|:----------|:---------------------------------|:---------------------|
+| YY | 2-digit year | 90, 00, 08, 19 |
+
+```typescript
+import { parse } from 'date-and-time';
+import two_digit_year from 'date-and-time/plugins/two-digit-year';
+
+parse('Dec 25 69', 'MMM DD YY', { plugins: [two_digit_year] });
+// => Dec 25 2069
+parse('Dec 25 70', 'MMM DD YY', { plugins: [two_digit_year] });
+// => Dec 25 1970
+```
+
+
+
+
+zonename
+
+You can add tokens to the `Formatter` to output timezone names. These timezone names are limited to English and are not supported for locales other than English.
+
+`Formatter`:
+
+| Token | Meaning | Output Examples |
+|:---------|:---------------------------------|:----------------------|
+| z | Short timezone name | PST, EST |
+| zz | Long timezone name | Pacific Standard Time |
+
+```typescript
+import { parse } from 'date-and-time';
+import zonename from 'date-and-time/plugins/zonename';
+import Tokyo from 'date-and-time/timezones/Asia/Tokyo';
+
+format(
+ new Date(),
+ 'MMMM DD YYYY H:mm zz',
+ { plugins: [zonename] }
+);
+// March 14 2021 1:59 Pacific Standard Time
+
+format(
+ new Date(),
+ 'MMMM DD YYYY H:mm z',
+ { plugins: [zonename], timeZone: Tokyo }
+);
+// March 14 2021 18:59 JST
+```
+
+
diff --git a/eslint.config.ts b/eslint.config.ts
new file mode 100644
index 0000000..070af5e
--- /dev/null
+++ b/eslint.config.ts
@@ -0,0 +1,213 @@
+import tseslint from 'typescript-eslint';
+import globals from 'globals';
+
+export default tseslint.config(
+ ...tseslint.configs.strict,
+ ...tseslint.configs.stylistic,
+ {
+ languageOptions: {
+ ecmaVersion: 2021,
+ sourceType: 'module',
+ globals: {
+ ...globals.browser,
+ ...globals.node
+ },
+ parserOptions: {
+ project: './tsconfig.json',
+ tsconfigRootDir: import.meta.dirname
+ }
+ },
+ rules: {
+ '@typescript-eslint/no-extraneous-class': 'off',
+ '@typescript-eslint/no-unused-vars': ['error', { 'caughtErrors': 'none' }],
+ '@typescript-eslint/unified-signatures': ['error', { 'ignoreDifferentlyNamedParameters': true }],
+ 'array-bracket-spacing': ['warn', 'never'],
+ 'array-callback-return': 'error',
+ 'constructor-super': 'error',
+ 'for-direction': 'error',
+ 'getter-return': 'error',
+ 'no-async-promise-executor': 'error',
+ 'no-class-assign': 'error',
+ 'no-compare-neg-zero': 'error',
+ 'no-cond-assign': 'error',
+ 'no-const-assign': 'error',
+ 'no-constant-binary-expression': 'error',
+ 'no-constant-condition': 'error',
+ 'no-constructor-return': 'error',
+ 'no-control-regex': 'error',
+ 'no-debugger': 'error',
+ 'no-dupe-args': 'error',
+ 'no-dupe-class-members': 'error',
+ 'no-dupe-else-if': 'error',
+ 'no-dupe-keys': 'error',
+ 'no-duplicate-case': 'error',
+ 'no-empty-character-class': 'error',
+ 'no-empty-pattern': 'error',
+ 'no-ex-assign': 'error',
+ 'no-fallthrough': 'error',
+ 'no-func-assign': 'error',
+ 'no-import-assign': 'error',
+ 'no-inner-declarations': 'error',
+ 'no-invalid-regexp': 'error',
+ 'no-irregular-whitespace': 'error',
+ 'no-loss-of-precision': 'error',
+ 'no-misleading-character-class': 'error',
+ 'no-new-native-nonconstructor': 'error',
+ 'no-new-symbol': 'error',
+ 'no-obj-calls': 'error',
+ 'no-self-assign': 'error',
+ 'no-self-compare': 'error',
+ 'no-setter-return': 'error',
+ 'no-sparse-arrays': 'error',
+ 'no-template-curly-in-string': 'error',
+ 'no-this-before-super': 'error',
+ 'no-undef': 'error',
+ 'no-unexpected-multiline': 'error',
+ 'no-unmodified-loop-condition': 'error',
+ 'no-unreachable': 'error',
+ 'no-unreachable-loop': 'error',
+ 'no-unsafe-finally': 'error',
+ 'no-unsafe-negation': 'error',
+ 'no-unsafe-optional-chaining': 'error',
+ 'no-unused-private-class-members': 'error',
+ 'no-use-before-define': 'error',
+ 'no-useless-backreference': 'error',
+ 'require-atomic-updates': 'error',
+ 'use-isnan': 'error',
+ 'valid-typeof': 'error',
+ 'accessor-pairs': 'error',
+ 'block-scoped-var': 'error',
+ 'consistent-return': 'error',
+ 'curly': 'error',
+ 'default-case-last': 'error',
+ 'dot-notation': 'error',
+ 'eqeqeq': ['error', 'smart'],
+ 'func-name-matching': 'error',
+ 'func-style': ['error', 'expression', { 'overrides': { 'namedExports': 'ignore' } }],
+ 'grouped-accessor-pairs': 'error',
+ 'id-denylist': 'error',
+ 'id-match': 'error',
+ 'max-depth': 'error',
+ 'max-nested-callbacks': 'error',
+ 'new-cap': 'error',
+ 'no-array-constructor': 'error',
+ 'no-caller': 'error',
+ 'no-delete-var': 'error',
+ 'no-div-regex': 'error',
+ 'no-else-return': 'error',
+ 'no-empty-static-block': 'error',
+ 'no-eval': 'error',
+ 'no-extend-native': 'error',
+ 'no-extra-bind': 'error',
+ 'no-extra-boolean-cast': 'error',
+ 'no-extra-label': 'error',
+ 'no-extra-semi': 'error',
+ 'no-floating-decimal': 'error',
+ 'no-global-assign': 'error',
+ 'no-implicit-globals': 'error',
+ 'no-implied-eval': 'error',
+ 'no-iterator': 'error',
+ 'no-label-var': 'error',
+ 'no-labels': 'error',
+ 'no-lone-blocks': 'error',
+ 'no-lonely-if': 'error',
+ 'no-loop-func': 'error',
+ 'no-multi-assign': ['error', { 'ignoreNonDeclaration': true }],
+ 'no-multi-str': 'error',
+ 'no-negated-condition': 'error',
+ 'no-new': 'error',
+ 'no-new-func': 'error',
+ 'no-new-object': 'error',
+ 'no-new-wrappers': 'error',
+ 'no-nonoctal-decimal-escape': 'error',
+ 'no-octal': 'error',
+ 'no-octal-escape': 'error',
+ 'no-proto': 'error',
+ 'no-regex-spaces': 'error',
+ 'no-restricted-exports': 'error',
+ 'no-restricted-globals': 'error',
+ 'no-restricted-imports': 'error',
+ 'no-restricted-properties': 'error',
+ 'no-restricted-syntax': 'error',
+ 'no-return-assign': 'error',
+ 'no-return-await': 'error',
+ 'no-script-url': 'error',
+ 'no-sequences': 'error',
+ 'no-shadow': 'error',
+ 'no-shadow-restricted-names': 'error',
+ 'no-throw-literal': 'error',
+ 'no-undef-init': 'error',
+ 'no-unneeded-ternary': 'error',
+ 'no-unused-expressions': 'error',
+ 'no-unused-labels': 'error',
+ 'no-useless-call': 'error',
+ 'no-useless-catch': 'error',
+ 'no-useless-computed-key': 'error',
+ 'no-useless-concat': 'error',
+ 'no-useless-escape': 'error',
+ 'no-useless-rename': 'error',
+ 'no-useless-return': 'error',
+ 'no-void': 'error',
+ 'no-warning-comments': 'warn',
+ 'no-with': 'error',
+ 'operator-assignment': 'error',
+ 'prefer-const': 'error',
+ 'prefer-exponentiation-operator': 'error',
+ 'prefer-numeric-literals': 'error',
+ 'prefer-object-has-own': 'error',
+ 'prefer-object-spread': 'error',
+ 'prefer-promise-reject-errors': ['error', { 'allowEmptyReject': true }],
+ 'prefer-regex-literals': 'error',
+ 'prefer-rest-params': 'error',
+ 'prefer-spread': 'error',
+ 'radix': 'error',
+ 'require-await': 'error',
+ 'require-yield': 'error',
+ 'symbol-description': 'error',
+ 'yoda': 'error',
+ 'arrow-spacing': 'warn',
+ 'block-spacing': 'warn',
+ 'comma-dangle': 'warn',
+ 'comma-spacing': 'warn',
+ 'comma-style': 'warn',
+ 'computed-property-spacing': 'warn',
+ 'dot-location': ['warn', 'property'],
+ 'eol-last': 'warn',
+ 'func-call-spacing': 'warn',
+ 'generator-star-spacing': 'warn',
+ 'implicit-arrow-linebreak': 'warn',
+ 'indent': ['warn', 2, { 'ignoreComments': true }],
+ 'jsx-quotes': 'warn',
+ 'key-spacing': 'warn',
+ 'keyword-spacing': 'warn',
+ 'linebreak-style': 'warn',
+ 'lines-between-class-members': 'warn',
+ 'new-parens': 'warn',
+ 'no-extra-parens': ['warn', 'functions'],
+ 'no-mixed-spaces-and-tabs': 'warn',
+ 'no-multi-spaces': ['warn', { 'ignoreEOLComments': true }],
+ 'no-tabs': 'warn',
+ 'no-trailing-spaces': 'warn',
+ 'no-whitespace-before-property': 'warn',
+ 'nonblock-statement-body-position': 'warn',
+ 'object-curly-newline': 'warn',
+ 'object-curly-spacing': ['warn', 'always'],
+ 'padding-line-between-statements': 'warn',
+ 'quotes': ['warn', 'single'],
+ 'rest-spread-spacing': 'warn',
+ 'semi': 'warn',
+ 'semi-spacing': 'warn',
+ 'semi-style': 'warn',
+ 'space-before-blocks': 'warn',
+ 'space-in-parens': 'warn',
+ 'space-infix-ops': 'warn',
+ 'space-unary-ops': 'warn',
+ 'switch-colon-spacing': 'warn',
+ 'template-curly-spacing': 'warn',
+ 'template-tag-spacing': 'warn',
+ 'unicode-bom': 'warn',
+ 'wrap-iife': ['warn', 'any'],
+ 'yield-star-spacing': 'warn'
+ }
+ }
+);
diff --git a/esm/date-and-time.es.js b/esm/date-and-time.es.js
deleted file mode 100644
index 0667657..0000000
--- a/esm/date-and-time.es.js
+++ /dev/null
@@ -1,512 +0,0 @@
-/**
- * @preserve date-and-time (c) KNOWLEDGECODE | MIT
- */
-
-var locales = {},
- plugins = {},
- lang = 'en',
- _res = {
- MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- dddd: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
- ddd: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- dd: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
- A: ['AM', 'PM']
- },
- _formatter = {
- YYYY: function (d/*, formatString*/) { return ('000' + d.getFullYear()).slice(-4); },
- YY: function (d/*, formatString*/) { return ('0' + d.getFullYear()).slice(-2); },
- Y: function (d/*, formatString*/) { return '' + d.getFullYear(); },
- MMMM: function (d/*, formatString*/) { return this.res.MMMM[d.getMonth()]; },
- MMM: function (d/*, formatString*/) { return this.res.MMM[d.getMonth()]; },
- MM: function (d/*, formatString*/) { return ('0' + (d.getMonth() + 1)).slice(-2); },
- M: function (d/*, formatString*/) { return '' + (d.getMonth() + 1); },
- DD: function (d/*, formatString*/) { return ('0' + d.getDate()).slice(-2); },
- D: function (d/*, formatString*/) { return '' + d.getDate(); },
- HH: function (d/*, formatString*/) { return ('0' + d.getHours()).slice(-2); },
- H: function (d/*, formatString*/) { return '' + d.getHours(); },
- A: function (d/*, formatString*/) { return this.res.A[d.getHours() > 11 | 0]; },
- hh: function (d/*, formatString*/) { return ('0' + (d.getHours() % 12 || 12)).slice(-2); },
- h: function (d/*, formatString*/) { return '' + (d.getHours() % 12 || 12); },
- mm: function (d/*, formatString*/) { return ('0' + d.getMinutes()).slice(-2); },
- m: function (d/*, formatString*/) { return '' + d.getMinutes(); },
- ss: function (d/*, formatString*/) { return ('0' + d.getSeconds()).slice(-2); },
- s: function (d/*, formatString*/) { return '' + d.getSeconds(); },
- SSS: function (d/*, formatString*/) { return ('00' + d.getMilliseconds()).slice(-3); },
- SS: function (d/*, formatString*/) { return ('0' + (d.getMilliseconds() / 10 | 0)).slice(-2); },
- S: function (d/*, formatString*/) { return '' + (d.getMilliseconds() / 100 | 0); },
- dddd: function (d/*, formatString*/) { return this.res.dddd[d.getDay()]; },
- ddd: function (d/*, formatString*/) { return this.res.ddd[d.getDay()]; },
- dd: function (d/*, formatString*/) { return this.res.dd[d.getDay()]; },
- Z: function (d/*, formatString*/) {
- var offset = d.getTimezoneOffset() / 0.6 | 0;
- return (offset > 0 ? '-' : '+') + ('000' + Math.abs(offset - (offset % 100 * 0.4 | 0))).slice(-4);
- },
- ZZ: function (d/*, formatString*/) {
- var offset = d.getTimezoneOffset();
- var mod = Math.abs(offset);
- return (offset > 0 ? '-' : '+') + ('0' + (mod / 60 | 0)).slice(-2) + ':' + ('0' + mod % 60).slice(-2);
- },
- post: function (str) { return str; },
- res: _res
- },
- _parser = {
- YYYY: function (str/*, formatString */) { return this.exec(/^\d{4}/, str); },
- Y: function (str/*, formatString */) { return this.exec(/^\d{1,4}/, str); },
- MMMM: function (str/*, formatString */) {
- var result = this.find(this.res.MMMM, str);
- result.value++;
- return result;
- },
- MMM: function (str/*, formatString */) {
- var result = this.find(this.res.MMM, str);
- result.value++;
- return result;
- },
- MM: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- M: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- DD: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- D: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- HH: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- H: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- A: function (str/*, formatString */) { return this.find(this.res.A, str); },
- hh: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- h: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- mm: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- m: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- ss: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- s: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- SSS: function (str/*, formatString */) { return this.exec(/^\d{1,3}/, str); },
- SS: function (str/*, formatString */) {
- var result = this.exec(/^\d\d?/, str);
- result.value *= 10;
- return result;
- },
- S: function (str/*, formatString */) {
- var result = this.exec(/^\d/, str);
- result.value *= 100;
- return result;
- },
- Z: function (str/*, formatString */) {
- var result = this.exec(/^[+-]\d{2}[0-5]\d/, str);
- result.value = (result.value / 100 | 0) * -60 - result.value % 100;
- return result;
- },
- ZZ: function (str/*, formatString */) {
- var arr = /^([+-])(\d{2}):([0-5]\d)/.exec(str) || ['', '', '', ''];
- return { value: 0 - ((arr[1] + arr[2] | 0) * 60 + (arr[1] + arr[3] | 0)), length: arr[0].length };
- },
- h12: function (h, a) { return (h === 12 ? 0 : h) + a * 12; },
- exec: function (re, str) {
- var result = (re.exec(str) || [''])[0];
- return { value: result | 0, length: result.length };
- },
- find: function (array, str) {
- var index = -1, length = 0;
-
- for (var i = 0, len = array.length, item; i < len; i++) {
- item = array[i];
- if (!str.indexOf(item) && item.length > length) {
- index = i;
- length = item.length;
- }
- }
- return { value: index, length: length };
- },
- pre: function (str) { return str; },
- res: _res
- },
- extend = function (base, props, override, res) {
- var obj = {}, key;
-
- for (key in base) {
- obj[key] = base[key];
- }
- for (key in props || {}) {
- if (!(!!override ^ !!obj[key])) {
- obj[key] = props[key];
- }
- }
- if (res) {
- obj.res = res;
- }
- return obj;
- },
- proto = {
- _formatter: _formatter,
- _parser: _parser
- },
- date;
-
-/**
- * Compiling format strings
- * @param {string} formatString - A format string
- * @returns {Array.} A compiled object
- */
-proto.compile = function (formatString) {
- return [formatString].concat(formatString.match(/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g) || []);
-};
-
-/**
- * Formatting date and time objects (Date -> String)
- * @param {Date} dateObj - A Date object
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Output as UTC
- * @returns {string} A formatted string
- */
-proto.format = function (dateObj, arg, utc) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- formatter = ctx._formatter,
- d = (function () {
- if (utc) {
- var u = new Date(dateObj.getTime());
-
- u.getFullYear = u.getUTCFullYear;
- u.getMonth = u.getUTCMonth;
- u.getDate = u.getUTCDate;
- u.getHours = u.getUTCHours;
- u.getMinutes = u.getUTCMinutes;
- u.getSeconds = u.getUTCSeconds;
- u.getMilliseconds = u.getUTCMilliseconds;
- u.getDay = u.getUTCDay;
- u.getTimezoneOffset = function () { return 0; };
- u.getTimezoneName = function () { return 'UTC'; };
- return u;
- }
- return dateObj;
- }()),
- comment = /^\[(.*)\]$/, str = '';
-
- for (var i = 1, len = pattern.length, token; i < len; i++) {
- token = pattern[i];
- str += formatter[token]
- ? formatter.post(formatter[token](d, pattern[0]))
- : comment.test(token) ? token.replace(comment, '$1') : token;
- }
- return str;
-};
-
-/**
- * Pre-parsing date and time strings
- * @param {string} dateString - A date and time string
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Input as UTC
- * @returns {Object} A pre-parsed result object
- */
-proto.preparse = function (dateString, arg) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- parser = ctx._parser,
- dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 0, _match: 0 },
- wildcard = ' ', comment = /^\[(.*)\]$/, ellipsis = '...';
-
- dateString = parser.pre(dateString);
- for (var i = 1, len = pattern.length, token, str, result; i < len; i++) {
- token = pattern[i];
- str = dateString.substring(dt._index);
-
- if (parser[token]) {
- result = parser[token](str, pattern[0]);
- if (!result.length) {
- break;
- }
- dt[result.token || token.charAt(0)] = result.value;
- dt._index += result.length;
- dt._match++;
- } else if (token === str.charAt(0) || token === wildcard) {
- dt._index++;
- } else if (comment.test(token) && !str.indexOf(token.replace(comment, '$1'))) {
- dt._index += token.length - 2;
- } else if (token === ellipsis) {
- dt._index = dateString.length;
- break;
- } else {
- break;
- }
- }
- dt.H = dt.H || parser.h12(dt.h, dt.A);
- dt._length = dateString.length;
- return dt;
-};
-
-/**
- * Parsing of date and time string (String -> Date)
- * @param {string} dateString - A date-time string
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Input as UTC
- * @returns {Date} A Date object
- */
-proto.parse = function (dateString, arg, utc) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- dt = ctx.preparse(dateString, pattern);
-
- if (ctx.isValid(dt)) {
- dt.M -= dt.Y < 100 ? 22801 : 1; // 22801 = 1900 * 12 + 1
- if (utc || ~ctx._parser.find(pattern, 'ZZ').value) {
- return new Date(Date.UTC(dt.Y, dt.M, dt.D, dt.H, dt.m + dt.Z, dt.s, dt.S));
- }
- return new Date(dt.Y, dt.M, dt.D, dt.H, dt.m, dt.s, dt.S);
- }
- return new Date(NaN);
-};
-
-/**
- * Date and time string validation
- * @param {Object|string} arg1 - A pre-parsed result object or a date and time string
- * @param {string|Array.} [arg2] - A format string or its compiled object
- * @returns {boolean} Whether the date and time string is a valid date and time
- */
-proto.isValid = function (arg1, arg2) {
- var ctx = this || date, dt = typeof arg1 === 'string' ? ctx.preparse(arg1, arg2) : arg1;
-
- return !(
- dt._index < 1 || dt._length < 1 || dt._index - dt._length || dt._match < 1
- || dt.Y < 1 || dt.Y > 9999 || dt.M < 1 || dt.M > 12 || dt.D < 1 || dt.D > new Date(dt.Y, dt.M, 0).getDate()
- || dt.H < 0 || dt.H > 23 || dt.m < 0 || dt.m > 59 || dt.s < 0 || dt.s > 59 || dt.S < 0 || dt.S > 999
- || dt.Z < -840 || dt.Z > 720
- );
-};
-
-/**
- * Format transformation of date and time string (String -> String)
- * @param {string} dateString - A date and time string
- * @param {string|Array.} arg1 - A format string or its compiled object before transformation
- * @param {string|Array.} arg2 - A format string or its compiled object after transformation
- * @param {boolean} [utc] - Output as UTC
- * @returns {string} A formatted string
- */
-proto.transform = function (dateString, arg1, arg2, utc) {
- const ctx = this || date;
- return ctx.format(ctx.parse(dateString, arg1), arg2, utc);
-};
-
-/**
- * Adding years
- * @param {Date} dateObj - A Date object
- * @param {number} years - Number of years to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addYears = function (dateObj, years, utc) {
- return (this || date).addMonths(dateObj, years * 12, utc);
-};
-
-/**
- * Adding months
- * @param {Date} dateObj - A Date object
- * @param {number} months - Number of months to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addMonths = function (dateObj, months, utc) {
- var d = new Date(dateObj.getTime());
-
- if (utc) {
- d.setUTCMonth(d.getUTCMonth() + months);
- if (d.getUTCDate() < dateObj.getUTCDate()) {
- d.setUTCDate(0);
- return d;
- }
- } else {
- d.setMonth(d.getMonth() + months);
- if (d.getDate() < dateObj.getDate()) {
- d.setDate(0);
- return d;
- }
- }
- return d;
-};
-
-/**
- * Adding days
- * @param {Date} dateObj - A Date object
- * @param {number} days - Number of days to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addDays = function (dateObj, days, utc) {
- var d = new Date(dateObj.getTime());
-
- if (utc) {
- d.setUTCDate(d.getUTCDate() + days);
- } else {
- d.setDate(d.getDate() + days);
- }
- return d;
-};
-
-/**
- * Adding hours
- * @param {Date} dateObj - A Date object
- * @param {number} hours - Number of hours to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addHours = function (dateObj, hours) {
- return new Date(dateObj.getTime() + hours * 60 * 60 * 1000);
-};
-
-/**
- * Adding minutes
- * @param {Date} dateObj - A Date object
- * @param {number} minutes - Number of minutes to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addMinutes = function (dateObj, minutes) {
- return new Date(dateObj.getTime() + minutes * 60 * 1000);
-};
-
-/**
- * Adding seconds
- * @param {Date} dateObj - A Date object
- * @param {number} seconds - Number of seconds to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addSeconds = function (dateObj, seconds) {
- return new Date(dateObj.getTime() + seconds * 1000);
-};
-
-/**
- * Adding milliseconds
- * @param {Date} dateObj - A Date object
- * @param {number} milliseconds - Number of milliseconds to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addMilliseconds = function (dateObj, milliseconds) {
- return new Date(dateObj.getTime() + milliseconds);
-};
-
-/**
- * Subtracting two dates (date1 - date2)
- * @param {Date} date1 - A Date object
- * @param {Date} date2 - A Date object
- * @returns {Object} The result object of subtracting date2 from date1
- */
-proto.subtract = function (date1, date2) {
- var delta = date1.getTime() - date2.getTime();
-
- return {
- toMilliseconds: function () {
- return delta;
- },
- toSeconds: function () {
- return delta / 1000;
- },
- toMinutes: function () {
- return delta / 60000;
- },
- toHours: function () {
- return delta / 3600000;
- },
- toDays: function () {
- return delta / 86400000;
- }
- };
-};
-
-/**
- * Whether a year is a leap year
- * @param {number} y - A year to check
- * @returns {boolean} Whether the year is a leap year
- */
-proto.isLeapYear = function (y) {
- return (!(y % 4) && !!(y % 100)) || !(y % 400);
-};
-
-/**
- * Comparison of two dates
- * @param {Date} date1 - A Date object
- * @param {Date} date2 - A Date object
- * @returns {boolean} Whether the two dates are the same day (time is ignored)
- */
-proto.isSameDay = function (date1, date2) {
- return date1.toDateString() === date2.toDateString();
-};
-
-/**
- * Definition of new locale
- * @param {string} code - A language code
- * @param {Function} locale - A locale installer
- * @returns {void}
- */
-proto.locale = function (code, locale) {
- if (!locales[code]) {
- locales[code] = locale;
- }
-};
-
-/**
- * Definition of new plugin
- * @param {string} name - A plugin name
- * @param {Function} plugin - A plugin installer
- * @returns {void}
- */
-proto.plugin = function (name, plugin) {
- if (!plugins[name]) {
- plugins[name] = plugin;
- }
-};
-
-date = extend(proto);
-
-/**
- * Changing locales
- * @param {Function|string} [locale] - A locale installer or language code
- * @returns {string} The current language code
- */
-date.locale = function (locale) {
- var install = typeof locale === 'function' ? locale : date.locale[locale];
-
- if (!install) {
- return lang;
- }
- lang = install(proto);
-
- var extension = locales[lang] || {};
- var res = extend(_res, extension.res, true);
- var formatter = extend(_formatter, extension.formatter, true, res);
- var parser = extend(_parser, extension.parser, true, res);
-
- date._formatter = formatter;
- date._parser = parser;
-
- for (var plugin in plugins) {
- date.extend(plugins[plugin]);
- }
-
- return lang;
-};
-
-/**
- * Functional extension
- * @param {Object} extension - An extension object
- * @returns {void}
- */
-date.extend = function (extension) {
- var res = extend(date._parser.res, extension.res);
- var extender = extension.extender || {};
-
- date._formatter = extend(date._formatter, extension.formatter, false, res);
- date._parser = extend(date._parser, extension.parser, false, res);
-
- for (var key in extender) {
- if (!date[key]) {
- date[key] = extender[key];
- }
- }
-};
-
-/**
- * Importing plugins
- * @param {Function|string} plugin - A plugin installer or plugin name
- * @returns {void}
- */
-date.plugin = function (plugin) {
- var install = typeof plugin === 'function' ? plugin : date.plugin[plugin];
-
- if (install) {
- date.extend(plugins[install(proto, date)] || {});
- }
-};
-
-var date$1 = date;
-
-export { date$1 as default };
diff --git a/esm/date-and-time.es.min.js b/esm/date-and-time.es.min.js
deleted file mode 100644
index d3e818e..0000000
--- a/esm/date-and-time.es.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * @preserve date-and-time (c) KNOWLEDGECODE | MIT
- */
-var e,t={},n={},r="en",u={MMMM:["January","February","March","April","May","June","July","August","September","October","November","December"],MMM:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd:["Su","Mo","Tu","We","Th","Fr","Sa"],A:["AM","PM"]},i={YYYY:function(e){return("000"+e.getFullYear()).slice(-4)},YY:function(e){return("0"+e.getFullYear()).slice(-2)},Y:function(e){return""+e.getFullYear()},MMMM:function(e){return this.res.MMMM[e.getMonth()]},MMM:function(e){return this.res.MMM[e.getMonth()]},MM:function(e){return("0"+(e.getMonth()+1)).slice(-2)},M:function(e){return""+(e.getMonth()+1)},DD:function(e){return("0"+e.getDate()).slice(-2)},D:function(e){return""+e.getDate()},HH:function(e){return("0"+e.getHours()).slice(-2)},H:function(e){return""+e.getHours()},A:function(e){return this.res.A[e.getHours()>11|0]},hh:function(e){return("0"+(e.getHours()%12||12)).slice(-2)},h:function(e){return""+(e.getHours()%12||12)},mm:function(e){return("0"+e.getMinutes()).slice(-2)},m:function(e){return""+e.getMinutes()},ss:function(e){return("0"+e.getSeconds()).slice(-2)},s:function(e){return""+e.getSeconds()},SSS:function(e){return("00"+e.getMilliseconds()).slice(-3)},SS:function(e){return("0"+(e.getMilliseconds()/10|0)).slice(-2)},S:function(e){return""+(e.getMilliseconds()/100|0)},dddd:function(e){return this.res.dddd[e.getDay()]},ddd:function(e){return this.res.ddd[e.getDay()]},dd:function(e){return this.res.dd[e.getDay()]},Z:function(e){var t=e.getTimezoneOffset()/.6|0;return(t>0?"-":"+")+("000"+Math.abs(t-(t%100*.4|0))).slice(-4)},ZZ:function(e){var t=e.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+("0"+(n/60|0)).slice(-2)+":"+("0"+n%60).slice(-2)},post:function(e){return e},res:u},o={YYYY:function(e){return this.exec(/^\d{4}/,e)},Y:function(e){return this.exec(/^\d{1,4}/,e)},MMMM:function(e){var t=this.find(this.res.MMMM,e);return t.value++,t},MMM:function(e){var t=this.find(this.res.MMM,e);return t.value++,t},MM:function(e){return this.exec(/^\d\d/,e)},M:function(e){return this.exec(/^\d\d?/,e)},DD:function(e){return this.exec(/^\d\d/,e)},D:function(e){return this.exec(/^\d\d?/,e)},HH:function(e){return this.exec(/^\d\d/,e)},H:function(e){return this.exec(/^\d\d?/,e)},A:function(e){return this.find(this.res.A,e)},hh:function(e){return this.exec(/^\d\d/,e)},h:function(e){return this.exec(/^\d\d?/,e)},mm:function(e){return this.exec(/^\d\d/,e)},m:function(e){return this.exec(/^\d\d?/,e)},ss:function(e){return this.exec(/^\d\d/,e)},s:function(e){return this.exec(/^\d\d?/,e)},SSS:function(e){return this.exec(/^\d{1,3}/,e)},SS:function(e){var t=this.exec(/^\d\d?/,e);return t.value*=10,t},S:function(e){var t=this.exec(/^\d/,e);return t.value*=100,t},Z:function(e){var t=this.exec(/^[+-]\d{2}[0-5]\d/,e);return t.value=-60*(t.value/100|0)-t.value%100,t},ZZ:function(e){var t=/^([+-])(\d{2}):([0-5]\d)/.exec(e)||["","","",""];return{value:0-(60*(t[1]+t[2]|0)+(t[1]+t[3]|0)),length:t[0].length}},h12:function(e,t){return(12===e?0:e)+12*t},exec:function(e,t){var n=(e.exec(t)||[""])[0];return{value:0|n,length:n.length}},find:function(e,t){for(var n,r=-1,u=0,i=0,o=e.length;iu&&(r=i,u=n.length);return{value:r,length:u}},pre:function(e){return e},res:u},s=function(e,t,n,r){var u,i={};for(u in e)i[u]=e[u];for(u in t||{})!!n^!!i[u]||(i[u]=t[u]);return r&&(i.res=r),i},a={_formatter:i,_parser:o};a.compile=function(e){return[e].concat(e.match(/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g)||[])},a.format=function(t,n,r){for(var u,i=this||e,o="string"==typeof n?i.compile(n):n,s=i._formatter,a=function(){if(r){var e=new Date(t.getTime());return e.getFullYear=e.getUTCFullYear,e.getMonth=e.getUTCMonth,e.getDate=e.getUTCDate,e.getHours=e.getUTCHours,e.getMinutes=e.getUTCMinutes,e.getSeconds=e.getUTCSeconds,e.getMilliseconds=e.getUTCMilliseconds,e.getDay=e.getUTCDay,e.getTimezoneOffset=function(){return 0},e.getTimezoneName=function(){return"UTC"},e}return t}(),c=/^\[(.*)\]$/,f="",d=1,g=o.length;d9999||r.M<1||r.M>12||r.D<1||r.D>new Date(r.Y,r.M,0).getDate()||r.H<0||r.H>23||r.m<0||r.m>59||r.s<0||r.s>59||r.S<0||r.S>999||r.Z<-840||r.Z>720)},a.transform=function(t,n,r,u){const i=this||e;return i.format(i.parse(t,n),r,u)},a.addYears=function(t,n,r){return(this||e).addMonths(t,12*n,r)},a.addMonths=function(e,t,n){var r=new Date(e.getTime());if(n){if(r.setUTCMonth(r.getUTCMonth()+t),r.getUTCDate() 11 | 0]; },
- hh: function (d/*, formatString*/) { return ('0' + (d.getHours() % 12 || 12)).slice(-2); },
- h: function (d/*, formatString*/) { return '' + (d.getHours() % 12 || 12); },
- mm: function (d/*, formatString*/) { return ('0' + d.getMinutes()).slice(-2); },
- m: function (d/*, formatString*/) { return '' + d.getMinutes(); },
- ss: function (d/*, formatString*/) { return ('0' + d.getSeconds()).slice(-2); },
- s: function (d/*, formatString*/) { return '' + d.getSeconds(); },
- SSS: function (d/*, formatString*/) { return ('00' + d.getMilliseconds()).slice(-3); },
- SS: function (d/*, formatString*/) { return ('0' + (d.getMilliseconds() / 10 | 0)).slice(-2); },
- S: function (d/*, formatString*/) { return '' + (d.getMilliseconds() / 100 | 0); },
- dddd: function (d/*, formatString*/) { return this.res.dddd[d.getDay()]; },
- ddd: function (d/*, formatString*/) { return this.res.ddd[d.getDay()]; },
- dd: function (d/*, formatString*/) { return this.res.dd[d.getDay()]; },
- Z: function (d/*, formatString*/) {
- var offset = d.getTimezoneOffset() / 0.6 | 0;
- return (offset > 0 ? '-' : '+') + ('000' + Math.abs(offset - (offset % 100 * 0.4 | 0))).slice(-4);
- },
- ZZ: function (d/*, formatString*/) {
- var offset = d.getTimezoneOffset();
- var mod = Math.abs(offset);
- return (offset > 0 ? '-' : '+') + ('0' + (mod / 60 | 0)).slice(-2) + ':' + ('0' + mod % 60).slice(-2);
- },
- post: function (str) { return str; },
- res: _res
- },
- _parser = {
- YYYY: function (str/*, formatString */) { return this.exec(/^\d{4}/, str); },
- Y: function (str/*, formatString */) { return this.exec(/^\d{1,4}/, str); },
- MMMM: function (str/*, formatString */) {
- var result = this.find(this.res.MMMM, str);
- result.value++;
- return result;
- },
- MMM: function (str/*, formatString */) {
- var result = this.find(this.res.MMM, str);
- result.value++;
- return result;
- },
- MM: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- M: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- DD: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- D: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- HH: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- H: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- A: function (str/*, formatString */) { return this.find(this.res.A, str); },
- hh: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- h: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- mm: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- m: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- ss: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- s: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- SSS: function (str/*, formatString */) { return this.exec(/^\d{1,3}/, str); },
- SS: function (str/*, formatString */) {
- var result = this.exec(/^\d\d?/, str);
- result.value *= 10;
- return result;
- },
- S: function (str/*, formatString */) {
- var result = this.exec(/^\d/, str);
- result.value *= 100;
- return result;
- },
- Z: function (str/*, formatString */) {
- var result = this.exec(/^[+-]\d{2}[0-5]\d/, str);
- result.value = (result.value / 100 | 0) * -60 - result.value % 100;
- return result;
- },
- ZZ: function (str/*, formatString */) {
- var arr = /^([+-])(\d{2}):([0-5]\d)/.exec(str) || ['', '', '', ''];
- return { value: 0 - ((arr[1] + arr[2] | 0) * 60 + (arr[1] + arr[3] | 0)), length: arr[0].length };
- },
- h12: function (h, a) { return (h === 12 ? 0 : h) + a * 12; },
- exec: function (re, str) {
- var result = (re.exec(str) || [''])[0];
- return { value: result | 0, length: result.length };
- },
- find: function (array, str) {
- var index = -1, length = 0;
-
- for (var i = 0, len = array.length, item; i < len; i++) {
- item = array[i];
- if (!str.indexOf(item) && item.length > length) {
- index = i;
- length = item.length;
- }
- }
- return { value: index, length: length };
- },
- pre: function (str) { return str; },
- res: _res
- },
- extend = function (base, props, override, res) {
- var obj = {}, key;
-
- for (key in base) {
- obj[key] = base[key];
- }
- for (key in props || {}) {
- if (!(!!override ^ !!obj[key])) {
- obj[key] = props[key];
- }
- }
- if (res) {
- obj.res = res;
- }
- return obj;
- },
- proto = {
- _formatter: _formatter,
- _parser: _parser
- },
- date;
-
-/**
- * Compiling format strings
- * @param {string} formatString - A format string
- * @returns {Array.} A compiled object
- */
-proto.compile = function (formatString) {
- return [formatString].concat(formatString.match(/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g) || []);
-};
-
-/**
- * Formatting date and time objects (Date -> String)
- * @param {Date} dateObj - A Date object
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Output as UTC
- * @returns {string} A formatted string
- */
-proto.format = function (dateObj, arg, utc) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- formatter = ctx._formatter,
- d = (function () {
- if (utc) {
- var u = new Date(dateObj.getTime());
-
- u.getFullYear = u.getUTCFullYear;
- u.getMonth = u.getUTCMonth;
- u.getDate = u.getUTCDate;
- u.getHours = u.getUTCHours;
- u.getMinutes = u.getUTCMinutes;
- u.getSeconds = u.getUTCSeconds;
- u.getMilliseconds = u.getUTCMilliseconds;
- u.getDay = u.getUTCDay;
- u.getTimezoneOffset = function () { return 0; };
- u.getTimezoneName = function () { return 'UTC'; };
- return u;
- }
- return dateObj;
- }()),
- comment = /^\[(.*)\]$/, str = '';
-
- for (var i = 1, len = pattern.length, token; i < len; i++) {
- token = pattern[i];
- str += formatter[token]
- ? formatter.post(formatter[token](d, pattern[0]))
- : comment.test(token) ? token.replace(comment, '$1') : token;
- }
- return str;
-};
-
-/**
- * Pre-parsing date and time strings
- * @param {string} dateString - A date and time string
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Input as UTC
- * @returns {Object} A pre-parsed result object
- */
-proto.preparse = function (dateString, arg) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- parser = ctx._parser,
- dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 0, _match: 0 },
- wildcard = ' ', comment = /^\[(.*)\]$/, ellipsis = '...';
-
- dateString = parser.pre(dateString);
- for (var i = 1, len = pattern.length, token, str, result; i < len; i++) {
- token = pattern[i];
- str = dateString.substring(dt._index);
-
- if (parser[token]) {
- result = parser[token](str, pattern[0]);
- if (!result.length) {
- break;
- }
- dt[result.token || token.charAt(0)] = result.value;
- dt._index += result.length;
- dt._match++;
- } else if (token === str.charAt(0) || token === wildcard) {
- dt._index++;
- } else if (comment.test(token) && !str.indexOf(token.replace(comment, '$1'))) {
- dt._index += token.length - 2;
- } else if (token === ellipsis) {
- dt._index = dateString.length;
- break;
- } else {
- break;
- }
- }
- dt.H = dt.H || parser.h12(dt.h, dt.A);
- dt._length = dateString.length;
- return dt;
-};
-
-/**
- * Parsing of date and time string (String -> Date)
- * @param {string} dateString - A date-time string
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Input as UTC
- * @returns {Date} A Date object
- */
-proto.parse = function (dateString, arg, utc) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- dt = ctx.preparse(dateString, pattern);
-
- if (ctx.isValid(dt)) {
- dt.M -= dt.Y < 100 ? 22801 : 1; // 22801 = 1900 * 12 + 1
- if (utc || ~ctx._parser.find(pattern, 'ZZ').value) {
- return new Date(Date.UTC(dt.Y, dt.M, dt.D, dt.H, dt.m + dt.Z, dt.s, dt.S));
- }
- return new Date(dt.Y, dt.M, dt.D, dt.H, dt.m, dt.s, dt.S);
- }
- return new Date(NaN);
-};
-
-/**
- * Date and time string validation
- * @param {Object|string} arg1 - A pre-parsed result object or a date and time string
- * @param {string|Array.} [arg2] - A format string or its compiled object
- * @returns {boolean} Whether the date and time string is a valid date and time
- */
-proto.isValid = function (arg1, arg2) {
- var ctx = this || date, dt = typeof arg1 === 'string' ? ctx.preparse(arg1, arg2) : arg1;
-
- return !(
- dt._index < 1 || dt._length < 1 || dt._index - dt._length || dt._match < 1
- || dt.Y < 1 || dt.Y > 9999 || dt.M < 1 || dt.M > 12 || dt.D < 1 || dt.D > new Date(dt.Y, dt.M, 0).getDate()
- || dt.H < 0 || dt.H > 23 || dt.m < 0 || dt.m > 59 || dt.s < 0 || dt.s > 59 || dt.S < 0 || dt.S > 999
- || dt.Z < -840 || dt.Z > 720
- );
-};
-
-/**
- * Format transformation of date and time string (String -> String)
- * @param {string} dateString - A date and time string
- * @param {string|Array.} arg1 - A format string or its compiled object before transformation
- * @param {string|Array.} arg2 - A format string or its compiled object after transformation
- * @param {boolean} [utc] - Output as UTC
- * @returns {string} A formatted string
- */
-proto.transform = function (dateString, arg1, arg2, utc) {
- const ctx = this || date;
- return ctx.format(ctx.parse(dateString, arg1), arg2, utc);
-};
-
-/**
- * Adding years
- * @param {Date} dateObj - A Date object
- * @param {number} years - Number of years to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addYears = function (dateObj, years, utc) {
- return (this || date).addMonths(dateObj, years * 12, utc);
-};
-
-/**
- * Adding months
- * @param {Date} dateObj - A Date object
- * @param {number} months - Number of months to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addMonths = function (dateObj, months, utc) {
- var d = new Date(dateObj.getTime());
-
- if (utc) {
- d.setUTCMonth(d.getUTCMonth() + months);
- if (d.getUTCDate() < dateObj.getUTCDate()) {
- d.setUTCDate(0);
- return d;
- }
- } else {
- d.setMonth(d.getMonth() + months);
- if (d.getDate() < dateObj.getDate()) {
- d.setDate(0);
- return d;
- }
- }
- return d;
-};
-
-/**
- * Adding days
- * @param {Date} dateObj - A Date object
- * @param {number} days - Number of days to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addDays = function (dateObj, days, utc) {
- var d = new Date(dateObj.getTime());
-
- if (utc) {
- d.setUTCDate(d.getUTCDate() + days);
- } else {
- d.setDate(d.getDate() + days);
- }
- return d;
-};
-
-/**
- * Adding hours
- * @param {Date} dateObj - A Date object
- * @param {number} hours - Number of hours to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addHours = function (dateObj, hours) {
- return new Date(dateObj.getTime() + hours * 60 * 60 * 1000);
-};
-
-/**
- * Adding minutes
- * @param {Date} dateObj - A Date object
- * @param {number} minutes - Number of minutes to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addMinutes = function (dateObj, minutes) {
- return new Date(dateObj.getTime() + minutes * 60 * 1000);
-};
-
-/**
- * Adding seconds
- * @param {Date} dateObj - A Date object
- * @param {number} seconds - Number of seconds to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addSeconds = function (dateObj, seconds) {
- return new Date(dateObj.getTime() + seconds * 1000);
-};
-
-/**
- * Adding milliseconds
- * @param {Date} dateObj - A Date object
- * @param {number} milliseconds - Number of milliseconds to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addMilliseconds = function (dateObj, milliseconds) {
- return new Date(dateObj.getTime() + milliseconds);
-};
-
-/**
- * Subtracting two dates (date1 - date2)
- * @param {Date} date1 - A Date object
- * @param {Date} date2 - A Date object
- * @returns {Object} The result object of subtracting date2 from date1
- */
-proto.subtract = function (date1, date2) {
- var delta = date1.getTime() - date2.getTime();
-
- return {
- toMilliseconds: function () {
- return delta;
- },
- toSeconds: function () {
- return delta / 1000;
- },
- toMinutes: function () {
- return delta / 60000;
- },
- toHours: function () {
- return delta / 3600000;
- },
- toDays: function () {
- return delta / 86400000;
- }
- };
-};
-
-/**
- * Whether a year is a leap year
- * @param {number} y - A year to check
- * @returns {boolean} Whether the year is a leap year
- */
-proto.isLeapYear = function (y) {
- return (!(y % 4) && !!(y % 100)) || !(y % 400);
-};
-
-/**
- * Comparison of two dates
- * @param {Date} date1 - A Date object
- * @param {Date} date2 - A Date object
- * @returns {boolean} Whether the two dates are the same day (time is ignored)
- */
-proto.isSameDay = function (date1, date2) {
- return date1.toDateString() === date2.toDateString();
-};
-
-/**
- * Definition of new locale
- * @param {string} code - A language code
- * @param {Function} locale - A locale installer
- * @returns {void}
- */
-proto.locale = function (code, locale) {
- if (!locales[code]) {
- locales[code] = locale;
- }
-};
-
-/**
- * Definition of new plugin
- * @param {string} name - A plugin name
- * @param {Function} plugin - A plugin installer
- * @returns {void}
- */
-proto.plugin = function (name, plugin) {
- if (!plugins[name]) {
- plugins[name] = plugin;
- }
-};
-
-date = extend(proto);
-
-/**
- * Changing locales
- * @param {Function|string} [locale] - A locale installer or language code
- * @returns {string} The current language code
- */
-date.locale = function (locale) {
- var install = typeof locale === 'function' ? locale : date.locale[locale];
-
- if (!install) {
- return lang;
- }
- lang = install(proto);
-
- var extension = locales[lang] || {};
- var res = extend(_res, extension.res, true);
- var formatter = extend(_formatter, extension.formatter, true, res);
- var parser = extend(_parser, extension.parser, true, res);
-
- date._formatter = formatter;
- date._parser = parser;
-
- for (var plugin in plugins) {
- date.extend(plugins[plugin]);
- }
-
- return lang;
-};
-
-/**
- * Functional extension
- * @param {Object} extension - An extension object
- * @returns {void}
- */
-date.extend = function (extension) {
- var res = extend(date._parser.res, extension.res);
- var extender = extension.extender || {};
-
- date._formatter = extend(date._formatter, extension.formatter, false, res);
- date._parser = extend(date._parser, extension.parser, false, res);
-
- for (var key in extender) {
- if (!date[key]) {
- date[key] = extender[key];
- }
- }
-};
-
-/**
- * Importing plugins
- * @param {Function|string} plugin - A plugin installer or plugin name
- * @returns {void}
- */
-date.plugin = function (plugin) {
- var install = typeof plugin === 'function' ? plugin : date.plugin[plugin];
-
- if (install) {
- date.extend(plugins[install(proto, date)] || {});
- }
-};
-
-var date$1 = date;
-
-export { date$1 as default };
diff --git a/esm/locale/ar.es.js b/esm/locale/ar.es.js
deleted file mode 100644
index c32046f..0000000
--- a/esm/locale/ar.es.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Arabic (ar)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ar = function (date) {
- var code = 'ar';
-
- date.locale(code, {
- res: {
- MMMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- MMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- dddd: ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
- ddd: ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
- dd: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
- A: ['ص', 'م']
- },
- formatter: {
- post: function (str) {
- var num = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '٠': 0, '١': 1, '٢': 2, '٣': 3, '٤': 4, '٥': 5, '٦': 6, '٧': 7, '٨': 8, '٩': 9 };
- return str.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export { ar as default };
diff --git a/esm/locale/ar.mjs b/esm/locale/ar.mjs
deleted file mode 100644
index c32046f..0000000
--- a/esm/locale/ar.mjs
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Arabic (ar)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ar = function (date) {
- var code = 'ar';
-
- date.locale(code, {
- res: {
- MMMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- MMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- dddd: ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
- ddd: ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
- dd: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
- A: ['ص', 'م']
- },
- formatter: {
- post: function (str) {
- var num = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '٠': 0, '١': 1, '٢': 2, '٣': 3, '٤': 4, '٥': 5, '٦': 6, '٧': 7, '٨': 8, '٩': 9 };
- return str.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export { ar as default };
diff --git a/esm/locale/az.es.js b/esm/locale/az.es.js
deleted file mode 100644
index e7871c0..0000000
--- a/esm/locale/az.es.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Azerbaijani (az)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var az = function (date) {
- var code = 'az';
-
- date.locale(code, {
- res: {
- MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
- MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
- dddd: ['Bazar', 'Bazar ertəsi', 'Çərşənbə axşamı', 'Çərşənbə', 'Cümə axşamı', 'Cümə', 'Şənbə'],
- ddd: ['Baz', 'BzE', 'ÇAx', 'Çər', 'CAx', 'Cüm', 'Şən'],
- dd: ['Bz', 'BE', 'ÇA', 'Çə', 'CA', 'Cü', 'Şə'],
- A: ['gecə', 'səhər', 'gündüz', 'axşam']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // gecə
- } else if (h < 12) {
- return this.res.A[1]; // səhər
- } else if (h < 17) {
- return this.res.A[2]; // gündüz
- }
- return this.res.A[3]; // axşam
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // gecə, səhər
- }
- return h > 11 ? h : h + 12; // gündüz, axşam
- }
- }
- });
- return code;
-};
-
-export { az as default };
diff --git a/esm/locale/az.mjs b/esm/locale/az.mjs
deleted file mode 100644
index e7871c0..0000000
--- a/esm/locale/az.mjs
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Azerbaijani (az)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var az = function (date) {
- var code = 'az';
-
- date.locale(code, {
- res: {
- MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
- MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
- dddd: ['Bazar', 'Bazar ertəsi', 'Çərşənbə axşamı', 'Çərşənbə', 'Cümə axşamı', 'Cümə', 'Şənbə'],
- ddd: ['Baz', 'BzE', 'ÇAx', 'Çər', 'CAx', 'Cüm', 'Şən'],
- dd: ['Bz', 'BE', 'ÇA', 'Çə', 'CA', 'Cü', 'Şə'],
- A: ['gecə', 'səhər', 'gündüz', 'axşam']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // gecə
- } else if (h < 12) {
- return this.res.A[1]; // səhər
- } else if (h < 17) {
- return this.res.A[2]; // gündüz
- }
- return this.res.A[3]; // axşam
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // gecə, səhər
- }
- return h > 11 ? h : h + 12; // gündüz, axşam
- }
- }
- });
- return code;
-};
-
-export { az as default };
diff --git a/esm/locale/bn.es.js b/esm/locale/bn.es.js
deleted file mode 100644
index 4ab7e8c..0000000
--- a/esm/locale/bn.es.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Bengali (bn)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var bn = function (date) {
- var code = 'bn';
-
- date.locale(code, {
- res: {
- MMMM: ['জানুয়ারী', 'ফেবুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
- MMM: ['জানু', 'ফেব', 'মার্চ', 'এপর', 'মে', 'জুন', 'জুল', 'অগ', 'সেপ্ট', 'অক্টো', 'নভ', 'ডিসেম্'],
- dddd: ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পত্তিবার', 'শুক্রবার', 'শনিবার'],
- ddd: ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পত্তি', 'শুক্র', 'শনি'],
- dd: ['রব', 'সম', 'মঙ্গ', 'বু', 'ব্রিহ', 'শু', 'শনি'],
- A: ['রাত', 'সকাল', 'দুপুর', 'বিকাল']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // রাত
- } else if (h < 10) {
- return this.res.A[1]; // সকাল
- } else if (h < 17) {
- return this.res.A[2]; // দুপুর
- } else if (h < 20) {
- return this.res.A[3]; // বিকাল
- }
- return this.res.A[0]; // রাত
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // রাত
- } else if (a < 2) {
- return h; // সকাল
- } else if (a < 3) {
- return h > 9 ? h : h + 12; // দুপুর
- }
- return h + 12; // বিকাল
- }
- }
- });
- return code;
-};
-
-export { bn as default };
diff --git a/esm/locale/bn.mjs b/esm/locale/bn.mjs
deleted file mode 100644
index 4ab7e8c..0000000
--- a/esm/locale/bn.mjs
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Bengali (bn)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var bn = function (date) {
- var code = 'bn';
-
- date.locale(code, {
- res: {
- MMMM: ['জানুয়ারী', 'ফেবুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
- MMM: ['জানু', 'ফেব', 'মার্চ', 'এপর', 'মে', 'জুন', 'জুল', 'অগ', 'সেপ্ট', 'অক্টো', 'নভ', 'ডিসেম্'],
- dddd: ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পত্তিবার', 'শুক্রবার', 'শনিবার'],
- ddd: ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পত্তি', 'শুক্র', 'শনি'],
- dd: ['রব', 'সম', 'মঙ্গ', 'বু', 'ব্রিহ', 'শু', 'শনি'],
- A: ['রাত', 'সকাল', 'দুপুর', 'বিকাল']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // রাত
- } else if (h < 10) {
- return this.res.A[1]; // সকাল
- } else if (h < 17) {
- return this.res.A[2]; // দুপুর
- } else if (h < 20) {
- return this.res.A[3]; // বিকাল
- }
- return this.res.A[0]; // রাত
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // রাত
- } else if (a < 2) {
- return h; // সকাল
- } else if (a < 3) {
- return h > 9 ? h : h + 12; // দুপুর
- }
- return h + 12; // বিকাল
- }
- }
- });
- return code;
-};
-
-export { bn as default };
diff --git a/esm/locale/cs.es.js b/esm/locale/cs.es.js
deleted file mode 100644
index cec88e4..0000000
--- a/esm/locale/cs.es.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Czech (cs)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var cs = function (date) {
- var code = 'cs';
-
- date.locale(code, {
- res: {
- MMMM: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
- MMM: ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'],
- dddd: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
- ddd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
- dd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so']
- }
- });
- return code;
-};
-
-export { cs as default };
diff --git a/esm/locale/cs.mjs b/esm/locale/cs.mjs
deleted file mode 100644
index cec88e4..0000000
--- a/esm/locale/cs.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Czech (cs)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var cs = function (date) {
- var code = 'cs';
-
- date.locale(code, {
- res: {
- MMMM: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
- MMM: ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'],
- dddd: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
- ddd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
- dd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so']
- }
- });
- return code;
-};
-
-export { cs as default };
diff --git a/esm/locale/de.es.js b/esm/locale/de.es.js
deleted file mode 100644
index 12fec72..0000000
--- a/esm/locale/de.es.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve German (de)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var de = function (date) {
- var code = 'de';
-
- date.locale(code, {
- res: {
- MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
- MMM: ['Jan.', 'Febr.', 'Mrz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'],
- dddd: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
- ddd: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
- dd: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
- A: ['Uhr nachmittags', 'Uhr morgens']
- }
- });
- return code;
-};
-
-export { de as default };
diff --git a/esm/locale/de.mjs b/esm/locale/de.mjs
deleted file mode 100644
index 12fec72..0000000
--- a/esm/locale/de.mjs
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve German (de)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var de = function (date) {
- var code = 'de';
-
- date.locale(code, {
- res: {
- MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
- MMM: ['Jan.', 'Febr.', 'Mrz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'],
- dddd: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
- ddd: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
- dd: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
- A: ['Uhr nachmittags', 'Uhr morgens']
- }
- });
- return code;
-};
-
-export { de as default };
diff --git a/esm/locale/dk.es.js b/esm/locale/dk.es.js
deleted file mode 100644
index 6d1b898..0000000
--- a/esm/locale/dk.es.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Danish (DK)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var dk = function (date) {
- var code = 'dk';
-
- date.locale(code, {
- res: {
- MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
- MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
- ddd: ['søn', 'man', 'tir', 'ons', 'tors', 'fre', 'lør'],
- dd: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø']
- }
- });
- return code;
-};
-
-export { dk as default };
diff --git a/esm/locale/dk.mjs b/esm/locale/dk.mjs
deleted file mode 100644
index 6d1b898..0000000
--- a/esm/locale/dk.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Danish (DK)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var dk = function (date) {
- var code = 'dk';
-
- date.locale(code, {
- res: {
- MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
- MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
- ddd: ['søn', 'man', 'tir', 'ons', 'tors', 'fre', 'lør'],
- dd: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø']
- }
- });
- return code;
-};
-
-export { dk as default };
diff --git a/esm/locale/el.es.js b/esm/locale/el.es.js
deleted file mode 100644
index 09cb56d..0000000
--- a/esm/locale/el.es.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Greek (el)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var el = function (date) {
- var code = 'el';
-
- date.locale(code, {
- res: {
- MMMM: [
- ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
- ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
- ],
- MMM: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
- dddd: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
- ddd: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
- dd: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
- A: ['πμ', 'μμ']
- },
- formatter: {
- MMMM: function (d, formatString) {
- return this.res.MMMM[/D.*MMMM/.test(formatString) | 0][d.getMonth()];
- },
- hh: function (d) {
- return ('0' + d.getHours() % 12).slice(-2);
- },
- h: function (d) {
- return d.getHours() % 12;
- }
- },
- parser: {
- MMMM: function (str, formatString) {
- var result = this.find(this.res.MMMM[/D.*MMMM/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export { el as default };
diff --git a/esm/locale/el.mjs b/esm/locale/el.mjs
deleted file mode 100644
index 09cb56d..0000000
--- a/esm/locale/el.mjs
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Greek (el)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var el = function (date) {
- var code = 'el';
-
- date.locale(code, {
- res: {
- MMMM: [
- ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
- ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
- ],
- MMM: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
- dddd: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
- ddd: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
- dd: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
- A: ['πμ', 'μμ']
- },
- formatter: {
- MMMM: function (d, formatString) {
- return this.res.MMMM[/D.*MMMM/.test(formatString) | 0][d.getMonth()];
- },
- hh: function (d) {
- return ('0' + d.getHours() % 12).slice(-2);
- },
- h: function (d) {
- return d.getHours() % 12;
- }
- },
- parser: {
- MMMM: function (str, formatString) {
- var result = this.find(this.res.MMMM[/D.*MMMM/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export { el as default };
diff --git a/esm/locale/en.es.js b/esm/locale/en.es.js
deleted file mode 100644
index 34ad70e..0000000
--- a/esm/locale/en.es.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Englis (en)
- * @preserve This is a dummy module.
- */
-
-var en = function (date) {
- var code = 'en';
-
- return code;
-};
-
-export { en as default };
diff --git a/esm/locale/en.mjs b/esm/locale/en.mjs
deleted file mode 100644
index 34ad70e..0000000
--- a/esm/locale/en.mjs
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Englis (en)
- * @preserve This is a dummy module.
- */
-
-var en = function (date) {
- var code = 'en';
-
- return code;
-};
-
-export { en as default };
diff --git a/esm/locale/es.es.js b/esm/locale/es.es.js
deleted file mode 100644
index bd6a5f2..0000000
--- a/esm/locale/es.es.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Spanish (es)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var es = function (date) {
- var code = 'es';
-
- date.locale(code, {
- res: {
- MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
- MMM: ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'],
- dddd: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
- ddd: ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'],
- dd: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
- A: ['de la mañana', 'de la tarde', 'de la noche']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 12) {
- return this.res.A[0]; // de la mañana
- } else if (h < 19) {
- return this.res.A[1]; // de la tarde
- }
- return this.res.A[2]; // de la noche
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // de la mañana
- }
- return h > 11 ? h : h + 12; // de la tarde, de la noche
- }
- }
- });
- return code;
-};
-
-export { es as default };
diff --git a/esm/locale/es.mjs b/esm/locale/es.mjs
deleted file mode 100644
index bd6a5f2..0000000
--- a/esm/locale/es.mjs
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Spanish (es)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var es = function (date) {
- var code = 'es';
-
- date.locale(code, {
- res: {
- MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
- MMM: ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'],
- dddd: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
- ddd: ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'],
- dd: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
- A: ['de la mañana', 'de la tarde', 'de la noche']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 12) {
- return this.res.A[0]; // de la mañana
- } else if (h < 19) {
- return this.res.A[1]; // de la tarde
- }
- return this.res.A[2]; // de la noche
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // de la mañana
- }
- return h > 11 ? h : h + 12; // de la tarde, de la noche
- }
- }
- });
- return code;
-};
-
-export { es as default };
diff --git a/esm/locale/fa.es.js b/esm/locale/fa.es.js
deleted file mode 100644
index 05772e1..0000000
--- a/esm/locale/fa.es.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Persian (fa)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var fa = function (date) {
- var code = 'fa';
-
- date.locale(code, {
- res: {
- MMMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- MMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- dddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- ddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- dd: ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
- A: ['قبل از ظهر', 'بعد از ظهر']
- },
- formatter: {
- post: function (str) {
- var num = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '۰': 0, '۱': 1, '۲': 2, '۳': 3, '۴': 4, '۵': 5, '۶': 6, '۷': 7, '۸': 8, '۹': 9 };
- return str.replace(/[۰۱۲۳۴۵۶۷۸۹]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export { fa as default };
diff --git a/esm/locale/fa.mjs b/esm/locale/fa.mjs
deleted file mode 100644
index 05772e1..0000000
--- a/esm/locale/fa.mjs
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Persian (fa)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var fa = function (date) {
- var code = 'fa';
-
- date.locale(code, {
- res: {
- MMMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- MMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- dddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- ddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- dd: ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
- A: ['قبل از ظهر', 'بعد از ظهر']
- },
- formatter: {
- post: function (str) {
- var num = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '۰': 0, '۱': 1, '۲': 2, '۳': 3, '۴': 4, '۵': 5, '۶': 6, '۷': 7, '۸': 8, '۹': 9 };
- return str.replace(/[۰۱۲۳۴۵۶۷۸۹]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export { fa as default };
diff --git a/esm/locale/fr.es.js b/esm/locale/fr.es.js
deleted file mode 100644
index 018f11e..0000000
--- a/esm/locale/fr.es.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve French (fr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var fr = function (date) {
- var code = 'fr';
-
- date.locale(code, {
- res: {
- MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
- MMM: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
- dddd: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
- ddd: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
- dd: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
- A: ['matin', 'l\'après-midi']
- }
- });
- return code;
-};
-
-export { fr as default };
diff --git a/esm/locale/fr.mjs b/esm/locale/fr.mjs
deleted file mode 100644
index 018f11e..0000000
--- a/esm/locale/fr.mjs
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve French (fr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var fr = function (date) {
- var code = 'fr';
-
- date.locale(code, {
- res: {
- MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
- MMM: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
- dddd: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
- ddd: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
- dd: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
- A: ['matin', 'l\'après-midi']
- }
- });
- return code;
-};
-
-export { fr as default };
diff --git a/esm/locale/hi.es.js b/esm/locale/hi.es.js
deleted file mode 100644
index 90b05d2..0000000
--- a/esm/locale/hi.es.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Hindi (hi)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var hi = function (date) {
- var code = 'hi';
-
- date.locale(code, {
- res: {
- MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'],
- MMM: ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'],
- dddd: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'],
- ddd: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'],
- dd: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
- A: ['रात', 'सुबह', 'दोपहर', 'शाम']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // रात
- } else if (h < 10) {
- return this.res.A[1]; // सुबह
- } else if (h < 17) {
- return this.res.A[2]; // दोपहर
- } else if (h < 20) {
- return this.res.A[3]; // शाम
- }
- return this.res.A[0]; // रात
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // रात
- } else if (a < 2) {
- return h; // सुबह
- } else if (a < 3) {
- return h > 9 ? h : h + 12; // दोपहर
- }
- return h + 12; // शाम
- }
- }
- });
- return code;
-};
-
-export { hi as default };
diff --git a/esm/locale/hi.mjs b/esm/locale/hi.mjs
deleted file mode 100644
index 90b05d2..0000000
--- a/esm/locale/hi.mjs
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Hindi (hi)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var hi = function (date) {
- var code = 'hi';
-
- date.locale(code, {
- res: {
- MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'],
- MMM: ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'],
- dddd: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'],
- ddd: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'],
- dd: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
- A: ['रात', 'सुबह', 'दोपहर', 'शाम']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // रात
- } else if (h < 10) {
- return this.res.A[1]; // सुबह
- } else if (h < 17) {
- return this.res.A[2]; // दोपहर
- } else if (h < 20) {
- return this.res.A[3]; // शाम
- }
- return this.res.A[0]; // रात
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // रात
- } else if (a < 2) {
- return h; // सुबह
- } else if (a < 3) {
- return h > 9 ? h : h + 12; // दोपहर
- }
- return h + 12; // शाम
- }
- }
- });
- return code;
-};
-
-export { hi as default };
diff --git a/esm/locale/hu.es.js b/esm/locale/hu.es.js
deleted file mode 100644
index 088053e..0000000
--- a/esm/locale/hu.es.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Hungarian (hu)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var hu = function (date) {
- var code = 'hu';
-
- date.locale(code, {
- res: {
- MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'],
- MMM: ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'],
- dddd: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'],
- ddd: ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'],
- dd: ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'],
- A: ['de', 'du']
- }
- });
- return code;
-};
-
-export { hu as default };
diff --git a/esm/locale/hu.mjs b/esm/locale/hu.mjs
deleted file mode 100644
index 088053e..0000000
--- a/esm/locale/hu.mjs
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Hungarian (hu)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var hu = function (date) {
- var code = 'hu';
-
- date.locale(code, {
- res: {
- MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'],
- MMM: ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'],
- dddd: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'],
- ddd: ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'],
- dd: ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'],
- A: ['de', 'du']
- }
- });
- return code;
-};
-
-export { hu as default };
diff --git a/esm/locale/id.es.js b/esm/locale/id.es.js
deleted file mode 100644
index fcb7f77..0000000
--- a/esm/locale/id.es.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Indonesian (id)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var id = function (date) {
- var code = 'id';
-
- date.locale(code, {
- res: {
- MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'],
- dddd: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
- ddd: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
- dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'],
- A: ['pagi', 'siang', 'sore', 'malam']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 11) {
- return this.res.A[0]; // pagi
- } else if (h < 15) {
- return this.res.A[1]; // siang
- } else if (h < 19) {
- return this.res.A[2]; // sore
- }
- return this.res.A[3]; // malam
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // pagi
- } else if (a < 2) {
- return h >= 11 ? h : h + 12; // siang
- }
- return h + 12; // sore, malam
- }
- }
- });
- return code;
-};
-
-export { id as default };
diff --git a/esm/locale/id.mjs b/esm/locale/id.mjs
deleted file mode 100644
index fcb7f77..0000000
--- a/esm/locale/id.mjs
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Indonesian (id)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var id = function (date) {
- var code = 'id';
-
- date.locale(code, {
- res: {
- MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'],
- dddd: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
- ddd: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
- dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'],
- A: ['pagi', 'siang', 'sore', 'malam']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 11) {
- return this.res.A[0]; // pagi
- } else if (h < 15) {
- return this.res.A[1]; // siang
- } else if (h < 19) {
- return this.res.A[2]; // sore
- }
- return this.res.A[3]; // malam
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // pagi
- } else if (a < 2) {
- return h >= 11 ? h : h + 12; // siang
- }
- return h + 12; // sore, malam
- }
- }
- });
- return code;
-};
-
-export { id as default };
diff --git a/esm/locale/it.es.js b/esm/locale/it.es.js
deleted file mode 100644
index 7fe0c30..0000000
--- a/esm/locale/it.es.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Italian (it)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var it = function (date) {
- var code = 'it';
-
- date.locale(code, {
- res: {
- MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],
- MMM: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
- dddd: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
- ddd: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
- dd: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
- A: ['di mattina', 'di pomerrigio']
- }
- });
- return code;
-};
-
-export { it as default };
diff --git a/esm/locale/it.mjs b/esm/locale/it.mjs
deleted file mode 100644
index 7fe0c30..0000000
--- a/esm/locale/it.mjs
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Italian (it)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var it = function (date) {
- var code = 'it';
-
- date.locale(code, {
- res: {
- MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],
- MMM: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
- dddd: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
- ddd: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
- dd: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
- A: ['di mattina', 'di pomerrigio']
- }
- });
- return code;
-};
-
-export { it as default };
diff --git a/esm/locale/ja.es.js b/esm/locale/ja.es.js
deleted file mode 100644
index ca5576e..0000000
--- a/esm/locale/ja.es.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Japanese (ja)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ja = function (date) {
- var code = 'ja';
-
- date.locale(code, {
- res: {
- MMMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
- ddd: ['日', '月', '火', '水', '木', '金', '土'],
- dd: ['日', '月', '火', '水', '木', '金', '土'],
- A: ['午前', '午後']
- },
- formatter: {
- hh: function (d) {
- return ('0' + d.getHours() % 12).slice(-2);
- },
- h: function (d) {
- return d.getHours() % 12;
- }
- }
- });
- return code;
-};
-
-export { ja as default };
diff --git a/esm/locale/ja.mjs b/esm/locale/ja.mjs
deleted file mode 100644
index ca5576e..0000000
--- a/esm/locale/ja.mjs
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Japanese (ja)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ja = function (date) {
- var code = 'ja';
-
- date.locale(code, {
- res: {
- MMMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
- ddd: ['日', '月', '火', '水', '木', '金', '土'],
- dd: ['日', '月', '火', '水', '木', '金', '土'],
- A: ['午前', '午後']
- },
- formatter: {
- hh: function (d) {
- return ('0' + d.getHours() % 12).slice(-2);
- },
- h: function (d) {
- return d.getHours() % 12;
- }
- }
- });
- return code;
-};
-
-export { ja as default };
diff --git a/esm/locale/jv.es.js b/esm/locale/jv.es.js
deleted file mode 100644
index 15e0629..0000000
--- a/esm/locale/jv.es.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Javanese (jv)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var jv = function (date) {
- var code = 'jv';
-
- date.locale(code, {
- res: {
- MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'],
- dddd: ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'],
- ddd: ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'],
- dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'],
- A: ['enjing', 'siyang', 'sonten', 'ndalu']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 11) {
- return this.res.A[0]; // enjing
- } else if (h < 15) {
- return this.res.A[1]; // siyang
- } else if (h < 19) {
- return this.res.A[2]; // sonten
- }
- return this.res.A[3]; // ndalu
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // enjing
- } else if (a < 2) {
- return h >= 11 ? h : h + 12; // siyang
- }
- return h + 12; // sonten, ndalu
- }
- }
- });
- return code;
-};
-
-export { jv as default };
diff --git a/esm/locale/jv.mjs b/esm/locale/jv.mjs
deleted file mode 100644
index 15e0629..0000000
--- a/esm/locale/jv.mjs
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Javanese (jv)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var jv = function (date) {
- var code = 'jv';
-
- date.locale(code, {
- res: {
- MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'],
- dddd: ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'],
- ddd: ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'],
- dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'],
- A: ['enjing', 'siyang', 'sonten', 'ndalu']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 11) {
- return this.res.A[0]; // enjing
- } else if (h < 15) {
- return this.res.A[1]; // siyang
- } else if (h < 19) {
- return this.res.A[2]; // sonten
- }
- return this.res.A[3]; // ndalu
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // enjing
- } else if (a < 2) {
- return h >= 11 ? h : h + 12; // siyang
- }
- return h + 12; // sonten, ndalu
- }
- }
- });
- return code;
-};
-
-export { jv as default };
diff --git a/esm/locale/ko.es.js b/esm/locale/ko.es.js
deleted file mode 100644
index 1cdb51d..0000000
--- a/esm/locale/ko.es.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Korean (ko)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ko = function (date) {
- var code = 'ko';
-
- date.locale(code, {
- res: {
- MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- MMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- dddd: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
- ddd: ['일', '월', '화', '수', '목', '금', '토'],
- dd: ['일', '월', '화', '수', '목', '금', '토'],
- A: ['오전', '오후']
- }
- });
- return code;
-};
-
-export { ko as default };
diff --git a/esm/locale/ko.mjs b/esm/locale/ko.mjs
deleted file mode 100644
index 1cdb51d..0000000
--- a/esm/locale/ko.mjs
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Korean (ko)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ko = function (date) {
- var code = 'ko';
-
- date.locale(code, {
- res: {
- MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- MMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- dddd: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
- ddd: ['일', '월', '화', '수', '목', '금', '토'],
- dd: ['일', '월', '화', '수', '목', '금', '토'],
- A: ['오전', '오후']
- }
- });
- return code;
-};
-
-export { ko as default };
diff --git a/esm/locale/my.es.js b/esm/locale/my.es.js
deleted file mode 100644
index 6121d51..0000000
--- a/esm/locale/my.es.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Burmese (my)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var my = function (date) {
- var code = 'my';
-
- date.locale(code, {
- res: {
- MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'],
- MMM: ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'],
- dddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
- ddd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'],
- dd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ']
- },
- formatter: {
- post: function (str) {
- var num = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '၀': 0, '၁': 1, '၂': 2, '၃': 3, '၄': 4, '၅': 5, '၆': 6, '၇': 7, '၈': 8, '၉': 9 };
- return str.replace(/[၀၁၂၃၄၅၆၇၈၉]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export { my as default };
diff --git a/esm/locale/my.mjs b/esm/locale/my.mjs
deleted file mode 100644
index 6121d51..0000000
--- a/esm/locale/my.mjs
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Burmese (my)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var my = function (date) {
- var code = 'my';
-
- date.locale(code, {
- res: {
- MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'],
- MMM: ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'],
- dddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
- ddd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'],
- dd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ']
- },
- formatter: {
- post: function (str) {
- var num = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '၀': 0, '၁': 1, '၂': 2, '၃': 3, '၄': 4, '၅': 5, '၆': 6, '၇': 7, '၈': 8, '၉': 9 };
- return str.replace(/[၀၁၂၃၄၅၆၇၈၉]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export { my as default };
diff --git a/esm/locale/nl.es.js b/esm/locale/nl.es.js
deleted file mode 100644
index 851fd88..0000000
--- a/esm/locale/nl.es.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Dutch (nl)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var nl = function (date) {
- var code = 'nl';
-
- date.locale(code, {
- res: {
- MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
- MMM: [
- ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
- ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
- ],
- dddd: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
- ddd: ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'],
- dd: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za']
- },
- formatter: {
- MMM: function (d, formatString) {
- return this.res.MMM[/-MMM-/.test(formatString) | 0][d.getMonth()];
- }
- },
- parser: {
- MMM: function (str, formatString) {
- var result = this.find(this.res.MMM[/-MMM-/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export { nl as default };
diff --git a/esm/locale/nl.mjs b/esm/locale/nl.mjs
deleted file mode 100644
index 851fd88..0000000
--- a/esm/locale/nl.mjs
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Dutch (nl)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var nl = function (date) {
- var code = 'nl';
-
- date.locale(code, {
- res: {
- MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
- MMM: [
- ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
- ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
- ],
- dddd: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
- ddd: ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'],
- dd: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za']
- },
- formatter: {
- MMM: function (d, formatString) {
- return this.res.MMM[/-MMM-/.test(formatString) | 0][d.getMonth()];
- }
- },
- parser: {
- MMM: function (str, formatString) {
- var result = this.find(this.res.MMM[/-MMM-/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export { nl as default };
diff --git a/esm/locale/pa-in.es.js b/esm/locale/pa-in.es.js
deleted file mode 100644
index 9dd45a4..0000000
--- a/esm/locale/pa-in.es.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Punjabi (pa-in)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pa_in = function (date) {
- var code = 'pa-in';
-
- date.locale(code, {
- res: {
- MMMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- MMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- dddd: ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'],
- ddd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- dd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- A: ['ਰਾਤ', 'ਸਵੇਰ', 'ਦੁਪਹਿਰ', 'ਸ਼ਾਮ']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ਰਾਤ
- } else if (h < 10) {
- return this.res.A[1]; // ਸਵੇਰ
- } else if (h < 17) {
- return this.res.A[2]; // ਦੁਪਹਿਰ
- } else if (h < 20) {
- return this.res.A[3]; // ਸ਼ਾਮ
- }
- return this.res.A[0]; // ਰਾਤ
- },
- post: function (str) {
- var num = ['੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // ਰਾਤ
- } else if (a < 2) {
- return h; // ਸਵੇਰ
- } else if (a < 3) {
- return h >= 10 ? h : h + 12; // ਦੁਪਹਿਰ
- }
- return h + 12; // ਸ਼ਾਮ
- },
- pre: function (str) {
- var map = { '੦': 0, '੧': 1, '੨': 2, '੩': 3, '੪': 4, '੫': 5, '੬': 6, '੭': 7, '੮': 8, '੯': 9 };
- return str.replace(/[੦੧੨੩੪੫੬੭੮੯]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export { pa_in as default };
diff --git a/esm/locale/pa-in.mjs b/esm/locale/pa-in.mjs
deleted file mode 100644
index 9dd45a4..0000000
--- a/esm/locale/pa-in.mjs
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Punjabi (pa-in)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pa_in = function (date) {
- var code = 'pa-in';
-
- date.locale(code, {
- res: {
- MMMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- MMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- dddd: ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'],
- ddd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- dd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- A: ['ਰਾਤ', 'ਸਵੇਰ', 'ਦੁਪਹਿਰ', 'ਸ਼ਾਮ']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ਰਾਤ
- } else if (h < 10) {
- return this.res.A[1]; // ਸਵੇਰ
- } else if (h < 17) {
- return this.res.A[2]; // ਦੁਪਹਿਰ
- } else if (h < 20) {
- return this.res.A[3]; // ਸ਼ਾਮ
- }
- return this.res.A[0]; // ਰਾਤ
- },
- post: function (str) {
- var num = ['੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // ਰਾਤ
- } else if (a < 2) {
- return h; // ਸਵੇਰ
- } else if (a < 3) {
- return h >= 10 ? h : h + 12; // ਦੁਪਹਿਰ
- }
- return h + 12; // ਸ਼ਾਮ
- },
- pre: function (str) {
- var map = { '੦': 0, '੧': 1, '੨': 2, '੩': 3, '੪': 4, '੫': 5, '੬': 6, '੭': 7, '੮': 8, '੯': 9 };
- return str.replace(/[੦੧੨੩੪੫੬੭੮੯]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export { pa_in as default };
diff --git a/esm/locale/pl.es.js b/esm/locale/pl.es.js
deleted file mode 100644
index 93e4acc..0000000
--- a/esm/locale/pl.es.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Polish (pl)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pl = function (date) {
- var code = 'pl';
-
- date.locale(code, {
- res: {
- MMMM: [
- ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'],
- ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia']
- ],
- MMM: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
- dddd: ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'],
- ddd: ['nie', 'pon', 'wt', 'śr', 'czw', 'pt', 'sb'],
- dd: ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So']
- },
- formatter: {
- MMMM: function (d, formatString) {
- return this.res.MMMM[/D MMMM/.test(formatString) | 0][d.getMonth()];
- }
- },
- parser: {
- MMMM: function (str, formatString) {
- var result = this.find(this.res.MMMM[/D MMMM/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export { pl as default };
diff --git a/esm/locale/pl.mjs b/esm/locale/pl.mjs
deleted file mode 100644
index 93e4acc..0000000
--- a/esm/locale/pl.mjs
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Polish (pl)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pl = function (date) {
- var code = 'pl';
-
- date.locale(code, {
- res: {
- MMMM: [
- ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'],
- ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia']
- ],
- MMM: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
- dddd: ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'],
- ddd: ['nie', 'pon', 'wt', 'śr', 'czw', 'pt', 'sb'],
- dd: ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So']
- },
- formatter: {
- MMMM: function (d, formatString) {
- return this.res.MMMM[/D MMMM/.test(formatString) | 0][d.getMonth()];
- }
- },
- parser: {
- MMMM: function (str, formatString) {
- var result = this.find(this.res.MMMM[/D MMMM/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export { pl as default };
diff --git a/esm/locale/pt.es.js b/esm/locale/pt.es.js
deleted file mode 100644
index ade645c..0000000
--- a/esm/locale/pt.es.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Portuguese (pt)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pt = function (date) {
- var code = 'pt';
-
- date.locale(code, {
- res: {
- MMMM: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
- MMM: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
- dddd: ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado'],
- ddd: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
- dd: ['Dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sáb'],
- A: ['da madrugada', 'da manhã', 'da tarde', 'da noite']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 5) {
- return this.res.A[0]; // da madrugada
- } else if (h < 12) {
- return this.res.A[1]; // da manhã
- } else if (h < 19) {
- return this.res.A[2]; // da tarde
- }
- return this.res.A[3]; // da noite
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // da madrugada, da manhã
- }
- return h > 11 ? h : h + 12; // da tarde, da noite
- }
- }
- });
- return code;
-};
-
-export { pt as default };
diff --git a/esm/locale/pt.mjs b/esm/locale/pt.mjs
deleted file mode 100644
index ade645c..0000000
--- a/esm/locale/pt.mjs
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Portuguese (pt)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pt = function (date) {
- var code = 'pt';
-
- date.locale(code, {
- res: {
- MMMM: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
- MMM: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
- dddd: ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado'],
- ddd: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
- dd: ['Dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sáb'],
- A: ['da madrugada', 'da manhã', 'da tarde', 'da noite']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 5) {
- return this.res.A[0]; // da madrugada
- } else if (h < 12) {
- return this.res.A[1]; // da manhã
- } else if (h < 19) {
- return this.res.A[2]; // da tarde
- }
- return this.res.A[3]; // da noite
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // da madrugada, da manhã
- }
- return h > 11 ? h : h + 12; // da tarde, da noite
- }
- }
- });
- return code;
-};
-
-export { pt as default };
diff --git a/esm/locale/ro.es.js b/esm/locale/ro.es.js
deleted file mode 100644
index 30b8b7c..0000000
--- a/esm/locale/ro.es.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Romanian (ro)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ro = function (date) {
- var code = 'ro';
-
- date.locale(code, {
- res: {
- MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'],
- MMM: ['ian.', 'febr.', 'mart.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'],
- dddd: ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'],
- ddd: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'],
- dd: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ']
- }
- });
- return code;
-};
-
-export { ro as default };
diff --git a/esm/locale/ro.mjs b/esm/locale/ro.mjs
deleted file mode 100644
index 30b8b7c..0000000
--- a/esm/locale/ro.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Romanian (ro)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ro = function (date) {
- var code = 'ro';
-
- date.locale(code, {
- res: {
- MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'],
- MMM: ['ian.', 'febr.', 'mart.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'],
- dddd: ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'],
- ddd: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'],
- dd: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ']
- }
- });
- return code;
-};
-
-export { ro as default };
diff --git a/esm/locale/ru.es.js b/esm/locale/ru.es.js
deleted file mode 100644
index 3529899..0000000
--- a/esm/locale/ru.es.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Russian (ru)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ru = function (date) {
- var code = 'ru';
-
- date.locale(code, {
- res: {
- MMMM: ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'],
- MMM: ['янв', 'фев', 'мар', 'апр', 'мая', 'июня', 'июля', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
- ddd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- dd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- A: ['ночи', 'утра', 'дня', 'вечера']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ночи
- } else if (h < 12) {
- return this.res.A[1]; // утра
- } else if (h < 17) {
- return this.res.A[2]; // дня
- }
- return this.res.A[3]; // вечера
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // ночи, утра
- }
- return h > 11 ? h : h + 12; // дня, вечера
- }
- }
- });
- return code;
-};
-
-export { ru as default };
diff --git a/esm/locale/ru.mjs b/esm/locale/ru.mjs
deleted file mode 100644
index 3529899..0000000
--- a/esm/locale/ru.mjs
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Russian (ru)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ru = function (date) {
- var code = 'ru';
-
- date.locale(code, {
- res: {
- MMMM: ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'],
- MMM: ['янв', 'фев', 'мар', 'апр', 'мая', 'июня', 'июля', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
- ddd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- dd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- A: ['ночи', 'утра', 'дня', 'вечера']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ночи
- } else if (h < 12) {
- return this.res.A[1]; // утра
- } else if (h < 17) {
- return this.res.A[2]; // дня
- }
- return this.res.A[3]; // вечера
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // ночи, утра
- }
- return h > 11 ? h : h + 12; // дня, вечера
- }
- }
- });
- return code;
-};
-
-export { ru as default };
diff --git a/esm/locale/rw.es.js b/esm/locale/rw.es.js
deleted file mode 100644
index 460e088..0000000
--- a/esm/locale/rw.es.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Kinyarwanda (rw)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var rw = function (date) {
- var code = 'rw';
-
- date.locale(code, {
- res: {
- MMMM: ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'],
- MMM: ['Mtr', 'Gas', 'Wer', 'Mta', 'Gic', 'Kmn', 'Nyk', 'Knm', 'Nze', 'Ukw', 'Ugu', 'Uku'],
- dddd: ['Ku cyumweru', 'Ku wambere', 'Ku wakabiri', 'Ku wagatatu', 'Ku wakane', 'Ku wagatanu', 'Ku wagatandatu'],
- ddd: ['Cyu', 'Mbe', 'Kbr', 'Gtt', 'Kne', 'Gtn', 'Gtd'],
- dd: ['Cy', 'Mb', 'Kb', 'Gt', 'Kn', 'Gn', 'Gd']
- }
- });
- return code;
-};
-
-export { rw as default };
diff --git a/esm/locale/rw.mjs b/esm/locale/rw.mjs
deleted file mode 100644
index 460e088..0000000
--- a/esm/locale/rw.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Kinyarwanda (rw)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var rw = function (date) {
- var code = 'rw';
-
- date.locale(code, {
- res: {
- MMMM: ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'],
- MMM: ['Mtr', 'Gas', 'Wer', 'Mta', 'Gic', 'Kmn', 'Nyk', 'Knm', 'Nze', 'Ukw', 'Ugu', 'Uku'],
- dddd: ['Ku cyumweru', 'Ku wambere', 'Ku wakabiri', 'Ku wagatatu', 'Ku wakane', 'Ku wagatanu', 'Ku wagatandatu'],
- ddd: ['Cyu', 'Mbe', 'Kbr', 'Gtt', 'Kne', 'Gtn', 'Gtd'],
- dd: ['Cy', 'Mb', 'Kb', 'Gt', 'Kn', 'Gn', 'Gd']
- }
- });
- return code;
-};
-
-export { rw as default };
diff --git a/esm/locale/sr.es.js b/esm/locale/sr.es.js
deleted file mode 100644
index a9b62fe..0000000
--- a/esm/locale/sr.es.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Serbian (sr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var sr = function (date) {
- var code = 'sr';
-
- date.locale(code, {
- res: {
- MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
- MMM: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
- dddd: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
- ddd: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
- dd: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su']
- }
- });
- return code;
-};
-
-export { sr as default };
diff --git a/esm/locale/sr.mjs b/esm/locale/sr.mjs
deleted file mode 100644
index a9b62fe..0000000
--- a/esm/locale/sr.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Serbian (sr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var sr = function (date) {
- var code = 'sr';
-
- date.locale(code, {
- res: {
- MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
- MMM: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
- dddd: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
- ddd: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
- dd: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su']
- }
- });
- return code;
-};
-
-export { sr as default };
diff --git a/esm/locale/sv.es.js b/esm/locale/sv.es.js
deleted file mode 100644
index e56a0d7..0000000
--- a/esm/locale/sv.es.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Swedish (SV)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var sv = function (date) {
- var code = 'sv';
-
- date.locale(code, {
- res: {
- MMMM: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
- MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
- ddd: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
- dd: ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö']
- }
- });
- return code;
-};
-
-export { sv as default };
diff --git a/esm/locale/sv.mjs b/esm/locale/sv.mjs
deleted file mode 100644
index e56a0d7..0000000
--- a/esm/locale/sv.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Swedish (SV)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var sv = function (date) {
- var code = 'sv';
-
- date.locale(code, {
- res: {
- MMMM: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
- MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
- ddd: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
- dd: ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö']
- }
- });
- return code;
-};
-
-export { sv as default };
diff --git a/esm/locale/th.es.js b/esm/locale/th.es.js
deleted file mode 100644
index e29a25a..0000000
--- a/esm/locale/th.es.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Thai (th)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var th = function (date) {
- var code = 'th';
-
- date.locale(code, {
- res: {
- MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'],
- MMM: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'],
- dddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'],
- ddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'],
- dd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
- A: ['ก่อนเที่ยง', 'หลังเที่ยง']
- }
- });
- return code;
-};
-
-export { th as default };
diff --git a/esm/locale/th.mjs b/esm/locale/th.mjs
deleted file mode 100644
index e29a25a..0000000
--- a/esm/locale/th.mjs
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Thai (th)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var th = function (date) {
- var code = 'th';
-
- date.locale(code, {
- res: {
- MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'],
- MMM: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'],
- dddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'],
- ddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'],
- dd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
- A: ['ก่อนเที่ยง', 'หลังเที่ยง']
- }
- });
- return code;
-};
-
-export { th as default };
diff --git a/esm/locale/tr.es.js b/esm/locale/tr.es.js
deleted file mode 100644
index 71070e5..0000000
--- a/esm/locale/tr.es.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Turkish (tr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var tr = function (date) {
- var code = 'tr';
-
- date.locale(code, {
- res: {
- MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
- MMM: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
- dddd: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
- ddd: ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'],
- dd: ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct']
- }
- });
- return code;
-};
-
-export { tr as default };
diff --git a/esm/locale/tr.mjs b/esm/locale/tr.mjs
deleted file mode 100644
index 71070e5..0000000
--- a/esm/locale/tr.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Turkish (tr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var tr = function (date) {
- var code = 'tr';
-
- date.locale(code, {
- res: {
- MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
- MMM: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
- dddd: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
- ddd: ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'],
- dd: ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct']
- }
- });
- return code;
-};
-
-export { tr as default };
diff --git a/esm/locale/uk.es.js b/esm/locale/uk.es.js
deleted file mode 100644
index b3ce91c..0000000
--- a/esm/locale/uk.es.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Ukrainian (uk)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var uk = function (date) {
- var code = 'uk';
-
- date.locale(code, {
- res: {
- MMMM: ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'],
- MMM: ['січ', 'лют', 'бер', 'квіт', 'трав', 'черв', 'лип', 'серп', 'вер', 'жовт', 'лист', 'груд'],
- dddd: [
- ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'],
- ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'],
- ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи']
- ],
- ddd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- dd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- A: ['ночі', 'ранку', 'дня', 'вечора']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ночі
- } else if (h < 12) {
- return this.res.A[1]; // ранку
- } else if (h < 17) {
- return this.res.A[2]; // дня
- }
- return this.res.A[3]; // вечора
- },
- dddd: function (d, formatString) {
- var type = 0;
- if (/(\[[ВвУу]\]) ?dddd/.test(formatString)) {
- type = 1;
- } else if (/\[?(?:минулої|наступної)? ?\] ?dddd/.test(formatString)) {
- type = 2;
- }
- return this.res.dddd[type][d.getDay()];
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // ночі, ранку
- }
- return h > 11 ? h : h + 12; // дня, вечора
- }
- }
- });
- return code;
-};
-
-export { uk as default };
diff --git a/esm/locale/uk.mjs b/esm/locale/uk.mjs
deleted file mode 100644
index b3ce91c..0000000
--- a/esm/locale/uk.mjs
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Ukrainian (uk)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var uk = function (date) {
- var code = 'uk';
-
- date.locale(code, {
- res: {
- MMMM: ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'],
- MMM: ['січ', 'лют', 'бер', 'квіт', 'трав', 'черв', 'лип', 'серп', 'вер', 'жовт', 'лист', 'груд'],
- dddd: [
- ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'],
- ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'],
- ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи']
- ],
- ddd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- dd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- A: ['ночі', 'ранку', 'дня', 'вечора']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ночі
- } else if (h < 12) {
- return this.res.A[1]; // ранку
- } else if (h < 17) {
- return this.res.A[2]; // дня
- }
- return this.res.A[3]; // вечора
- },
- dddd: function (d, formatString) {
- var type = 0;
- if (/(\[[ВвУу]\]) ?dddd/.test(formatString)) {
- type = 1;
- } else if (/\[?(?:минулої|наступної)? ?\] ?dddd/.test(formatString)) {
- type = 2;
- }
- return this.res.dddd[type][d.getDay()];
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // ночі, ранку
- }
- return h > 11 ? h : h + 12; // дня, вечора
- }
- }
- });
- return code;
-};
-
-export { uk as default };
diff --git a/esm/locale/uz.es.js b/esm/locale/uz.es.js
deleted file mode 100644
index e7f6db6..0000000
--- a/esm/locale/uz.es.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Uzbek (uz)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var uz = function (date) {
- var code = 'uz';
-
- date.locale(code, {
- res: {
- MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'],
- MMM: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd: ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'],
- ddd: ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'],
- dd: ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша']
- }
- });
- return code;
-};
-
-export { uz as default };
diff --git a/esm/locale/uz.mjs b/esm/locale/uz.mjs
deleted file mode 100644
index e7f6db6..0000000
--- a/esm/locale/uz.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Uzbek (uz)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var uz = function (date) {
- var code = 'uz';
-
- date.locale(code, {
- res: {
- MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'],
- MMM: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd: ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'],
- ddd: ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'],
- dd: ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша']
- }
- });
- return code;
-};
-
-export { uz as default };
diff --git a/esm/locale/vi.es.js b/esm/locale/vi.es.js
deleted file mode 100644
index 1bfe261..0000000
--- a/esm/locale/vi.es.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Vietnamese (vi)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var vi = function (date) {
- var code = 'vi';
-
- date.locale(code, {
- res: {
- MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'],
- MMM: ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'],
- dddd: ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'],
- ddd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- dd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- A: ['sa', 'ch']
- }
- });
- return code;
-};
-
-export { vi as default };
diff --git a/esm/locale/vi.mjs b/esm/locale/vi.mjs
deleted file mode 100644
index 1bfe261..0000000
--- a/esm/locale/vi.mjs
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Vietnamese (vi)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var vi = function (date) {
- var code = 'vi';
-
- date.locale(code, {
- res: {
- MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'],
- MMM: ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'],
- dddd: ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'],
- ddd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- dd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- A: ['sa', 'ch']
- }
- });
- return code;
-};
-
-export { vi as default };
diff --git a/esm/locale/zh-cn.es.js b/esm/locale/zh-cn.es.js
deleted file mode 100644
index 34f27d2..0000000
--- a/esm/locale/zh-cn.es.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Chinese (zh-cn)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var zh_cn = function (date) {
- var code = 'zh-cn';
-
- date.locale(code, {
- res: {
- MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd: ['日', '一', '二', '三', '四', '五', '六'],
- A: ['凌晨', '早上', '上午', '中午', '下午', '晚上']
- },
- formatter: {
- A: function (d) {
- var hm = d.getHours() * 100 + d.getMinutes();
- if (hm < 600) {
- return this.res.A[0]; // 凌晨
- } else if (hm < 900) {
- return this.res.A[1]; // 早上
- } else if (hm < 1130) {
- return this.res.A[2]; // 上午
- } else if (hm < 1230) {
- return this.res.A[3]; // 中午
- } else if (hm < 1800) {
- return this.res.A[4]; // 下午
- }
- return this.res.A[5]; // 晚上
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 4) {
- return h; // 凌晨, 早上, 上午, 中午
- }
- return h > 11 ? h : h + 12; // 下午, 晚上
- }
- }
- });
- return code;
-};
-
-export { zh_cn as default };
diff --git a/esm/locale/zh-cn.mjs b/esm/locale/zh-cn.mjs
deleted file mode 100644
index 34f27d2..0000000
--- a/esm/locale/zh-cn.mjs
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Chinese (zh-cn)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var zh_cn = function (date) {
- var code = 'zh-cn';
-
- date.locale(code, {
- res: {
- MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd: ['日', '一', '二', '三', '四', '五', '六'],
- A: ['凌晨', '早上', '上午', '中午', '下午', '晚上']
- },
- formatter: {
- A: function (d) {
- var hm = d.getHours() * 100 + d.getMinutes();
- if (hm < 600) {
- return this.res.A[0]; // 凌晨
- } else if (hm < 900) {
- return this.res.A[1]; // 早上
- } else if (hm < 1130) {
- return this.res.A[2]; // 上午
- } else if (hm < 1230) {
- return this.res.A[3]; // 中午
- } else if (hm < 1800) {
- return this.res.A[4]; // 下午
- }
- return this.res.A[5]; // 晚上
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 4) {
- return h; // 凌晨, 早上, 上午, 中午
- }
- return h > 11 ? h : h + 12; // 下午, 晚上
- }
- }
- });
- return code;
-};
-
-export { zh_cn as default };
diff --git a/esm/locale/zh-tw.es.js b/esm/locale/zh-tw.es.js
deleted file mode 100644
index 7950c0e..0000000
--- a/esm/locale/zh-tw.es.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Chinese (zh-tw)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var zh_tw = function (date) {
- var code = 'zh-tw';
-
- date.locale(code, {
- res: {
- MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd: ['日', '一', '二', '三', '四', '五', '六'],
- A: ['早上', '上午', '中午', '下午', '晚上']
- },
- formatter: {
- A: function (d) {
- var hm = d.getHours() * 100 + d.getMinutes();
- if (hm < 900) {
- return this.res.A[0]; // 早上
- } else if (hm < 1130) {
- return this.res.A[1]; // 上午
- } else if (hm < 1230) {
- return this.res.A[2]; // 中午
- } else if (hm < 1800) {
- return this.res.A[3]; // 下午
- }
- return this.res.A[4]; // 晚上
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 3) {
- return h; // 早上, 上午, 中午
- }
- return h > 11 ? h : h + 12; // 下午, 晚上
- }
- }
- });
- return code;
-};
-
-export { zh_tw as default };
diff --git a/esm/locale/zh-tw.mjs b/esm/locale/zh-tw.mjs
deleted file mode 100644
index 7950c0e..0000000
--- a/esm/locale/zh-tw.mjs
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Chinese (zh-tw)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var zh_tw = function (date) {
- var code = 'zh-tw';
-
- date.locale(code, {
- res: {
- MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd: ['日', '一', '二', '三', '四', '五', '六'],
- A: ['早上', '上午', '中午', '下午', '晚上']
- },
- formatter: {
- A: function (d) {
- var hm = d.getHours() * 100 + d.getMinutes();
- if (hm < 900) {
- return this.res.A[0]; // 早上
- } else if (hm < 1130) {
- return this.res.A[1]; // 上午
- } else if (hm < 1230) {
- return this.res.A[2]; // 中午
- } else if (hm < 1800) {
- return this.res.A[3]; // 下午
- }
- return this.res.A[4]; // 晚上
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 3) {
- return h; // 早上, 上午, 中午
- }
- return h > 11 ? h : h + 12; // 下午, 晚上
- }
- }
- });
- return code;
-};
-
-export { zh_tw as default };
diff --git a/esm/plugin/day-of-week.es.js b/esm/plugin/day-of-week.es.js
deleted file mode 100644
index 9250fe1..0000000
--- a/esm/plugin/day-of-week.es.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve day-of-week
- */
-
-var plugin = function (date) {
- var name = 'day-of-week';
-
- date.plugin(name, {
- parser: {
- dddd: function (str) { return this.find(this.res.dddd, str); },
- ddd: function (str) { return this.find(this.res.ddd, str); },
- dd: function (str) { return this.find(this.res.dd, str); }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/day-of-week.mjs b/esm/plugin/day-of-week.mjs
deleted file mode 100644
index 9250fe1..0000000
--- a/esm/plugin/day-of-week.mjs
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve day-of-week
- */
-
-var plugin = function (date) {
- var name = 'day-of-week';
-
- date.plugin(name, {
- parser: {
- dddd: function (str) { return this.find(this.res.dddd, str); },
- ddd: function (str) { return this.find(this.res.ddd, str); },
- dd: function (str) { return this.find(this.res.dd, str); }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/meridiem.es.js b/esm/plugin/meridiem.es.js
deleted file mode 100644
index 485aec9..0000000
--- a/esm/plugin/meridiem.es.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve meridiem
- */
-
-var plugin = function (date) {
- var name = 'meridiem';
-
- date.plugin(name, {
- res: {
- AA: ['A.M.', 'P.M.'],
- a: ['am', 'pm'],
- aa: ['a.m.', 'p.m.']
- },
- formatter: {
- AA: function (d) {
- return this.res.AA[d.getHours() > 11 | 0];
- },
- a: function (d) {
- return this.res.a[d.getHours() > 11 | 0];
- },
- aa: function (d) {
- return this.res.aa[d.getHours() > 11 | 0];
- }
- },
- parser: {
- AA: function (str) {
- var result = this.find(this.res.AA, str);
- result.token = 'A';
- return result;
- },
- a: function (str) {
- var result = this.find(this.res.a, str);
- result.token = 'A';
- return result;
- },
- aa: function (str) {
- var result = this.find(this.res.aa, str);
- result.token = 'A';
- return result;
- }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/meridiem.mjs b/esm/plugin/meridiem.mjs
deleted file mode 100644
index 485aec9..0000000
--- a/esm/plugin/meridiem.mjs
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve meridiem
- */
-
-var plugin = function (date) {
- var name = 'meridiem';
-
- date.plugin(name, {
- res: {
- AA: ['A.M.', 'P.M.'],
- a: ['am', 'pm'],
- aa: ['a.m.', 'p.m.']
- },
- formatter: {
- AA: function (d) {
- return this.res.AA[d.getHours() > 11 | 0];
- },
- a: function (d) {
- return this.res.a[d.getHours() > 11 | 0];
- },
- aa: function (d) {
- return this.res.aa[d.getHours() > 11 | 0];
- }
- },
- parser: {
- AA: function (str) {
- var result = this.find(this.res.AA, str);
- result.token = 'A';
- return result;
- },
- a: function (str) {
- var result = this.find(this.res.a, str);
- result.token = 'A';
- return result;
- },
- aa: function (str) {
- var result = this.find(this.res.aa, str);
- result.token = 'A';
- return result;
- }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/microsecond.es.js b/esm/plugin/microsecond.es.js
deleted file mode 100644
index af07520..0000000
--- a/esm/plugin/microsecond.es.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve microsecond
- */
-
-var plugin = function (date) {
- var name = 'microsecond';
-
- date.plugin(name, {
- parser: {
- SSSSSS: function (str) {
- var result = this.exec(/^\d{1,6}/, str);
- result.value = result.value / 1000 | 0;
- return result;
- },
- SSSSS: function (str) {
- var result = this.exec(/^\d{1,5}/, str);
- result.value = result.value / 100 | 0;
- return result;
- },
- SSSS: function (str) {
- var result = this.exec(/^\d{1,4}/, str);
- result.value = result.value / 10 | 0;
- return result;
- }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/microsecond.mjs b/esm/plugin/microsecond.mjs
deleted file mode 100644
index af07520..0000000
--- a/esm/plugin/microsecond.mjs
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve microsecond
- */
-
-var plugin = function (date) {
- var name = 'microsecond';
-
- date.plugin(name, {
- parser: {
- SSSSSS: function (str) {
- var result = this.exec(/^\d{1,6}/, str);
- result.value = result.value / 1000 | 0;
- return result;
- },
- SSSSS: function (str) {
- var result = this.exec(/^\d{1,5}/, str);
- result.value = result.value / 100 | 0;
- return result;
- },
- SSSS: function (str) {
- var result = this.exec(/^\d{1,4}/, str);
- result.value = result.value / 10 | 0;
- return result;
- }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/ordinal.es.js b/esm/plugin/ordinal.es.js
deleted file mode 100644
index 8407ddd..0000000
--- a/esm/plugin/ordinal.es.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve ordinal
- */
-
-var plugin = function (date) {
- var name = 'ordinal';
-
- date.plugin(name, {
- formatter: {
- DDD: function (d) {
- var day = d.getDate();
-
- switch (day) {
- case 1:
- case 21:
- case 31:
- return day + 'st';
- case 2:
- case 22:
- return day + 'nd';
- case 3:
- case 23:
- return day + 'rd';
- default:
- return day + 'th';
- }
- }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/ordinal.mjs b/esm/plugin/ordinal.mjs
deleted file mode 100644
index 8407ddd..0000000
--- a/esm/plugin/ordinal.mjs
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve ordinal
- */
-
-var plugin = function (date) {
- var name = 'ordinal';
-
- date.plugin(name, {
- formatter: {
- DDD: function (d) {
- var day = d.getDate();
-
- switch (day) {
- case 1:
- case 21:
- case 31:
- return day + 'st';
- case 2:
- case 22:
- return day + 'nd';
- case 3:
- case 23:
- return day + 'rd';
- default:
- return day + 'th';
- }
- }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/timespan.es.js b/esm/plugin/timespan.es.js
deleted file mode 100644
index f56b2a1..0000000
--- a/esm/plugin/timespan.es.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve timespan
- */
-
-var plugin = function (date) {
- var timeSpan = function (date1, date2) {
- var milliseconds = function (dt, time) {
- dt.S = time;
- return dt;
- },
- seconds = function (dt, time) {
- dt.s = time / 1000 | 0;
- return milliseconds(dt, Math.abs(time) % 1000);
- },
- minutes = function (dt, time) {
- dt.m = time / 60000 | 0;
- return seconds(dt, Math.abs(time) % 60000);
- },
- hours = function (dt, time) {
- dt.H = time / 3600000 | 0;
- return minutes(dt, Math.abs(time) % 3600000);
- },
- days = function (dt, time) {
- dt.D = time / 86400000 | 0;
- return hours(dt, Math.abs(time) % 86400000);
- },
- format = function (dt, formatString) {
- var pattern = date.compile(formatString);
- var str = '';
-
- for (var i = 1, len = pattern.length, token, value; i < len; i++) {
- token = pattern[i].charAt(0);
- if (token in dt) {
- value = '' + Math.abs(dt[token]);
- while (value.length < pattern[i].length) {
- value = '0' + value;
- }
- if (dt[token] < 0) {
- value = '-' + value;
- }
- str += value;
- } else {
- str += pattern[i].replace(/\[(.*)]/, '$1');
- }
- }
- return str;
- },
- delta = date1.getTime() - date2.getTime();
-
- return {
- toMilliseconds: function (formatString) {
- return format(milliseconds({}, delta), formatString);
- },
- toSeconds: function (formatString) {
- return format(seconds({}, delta), formatString);
- },
- toMinutes: function (formatString) {
- return format(minutes({}, delta), formatString);
- },
- toHours: function (formatString) {
- return format(hours({}, delta), formatString);
- },
- toDays: function (formatString) {
- return format(days({}, delta), formatString);
- }
- };
- };
- var name = 'timespan';
-
- date.plugin(name, { extender: { timeSpan: timeSpan } });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/timespan.mjs b/esm/plugin/timespan.mjs
deleted file mode 100644
index f56b2a1..0000000
--- a/esm/plugin/timespan.mjs
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve timespan
- */
-
-var plugin = function (date) {
- var timeSpan = function (date1, date2) {
- var milliseconds = function (dt, time) {
- dt.S = time;
- return dt;
- },
- seconds = function (dt, time) {
- dt.s = time / 1000 | 0;
- return milliseconds(dt, Math.abs(time) % 1000);
- },
- minutes = function (dt, time) {
- dt.m = time / 60000 | 0;
- return seconds(dt, Math.abs(time) % 60000);
- },
- hours = function (dt, time) {
- dt.H = time / 3600000 | 0;
- return minutes(dt, Math.abs(time) % 3600000);
- },
- days = function (dt, time) {
- dt.D = time / 86400000 | 0;
- return hours(dt, Math.abs(time) % 86400000);
- },
- format = function (dt, formatString) {
- var pattern = date.compile(formatString);
- var str = '';
-
- for (var i = 1, len = pattern.length, token, value; i < len; i++) {
- token = pattern[i].charAt(0);
- if (token in dt) {
- value = '' + Math.abs(dt[token]);
- while (value.length < pattern[i].length) {
- value = '0' + value;
- }
- if (dt[token] < 0) {
- value = '-' + value;
- }
- str += value;
- } else {
- str += pattern[i].replace(/\[(.*)]/, '$1');
- }
- }
- return str;
- },
- delta = date1.getTime() - date2.getTime();
-
- return {
- toMilliseconds: function (formatString) {
- return format(milliseconds({}, delta), formatString);
- },
- toSeconds: function (formatString) {
- return format(seconds({}, delta), formatString);
- },
- toMinutes: function (formatString) {
- return format(minutes({}, delta), formatString);
- },
- toHours: function (formatString) {
- return format(hours({}, delta), formatString);
- },
- toDays: function (formatString) {
- return format(days({}, delta), formatString);
- }
- };
- };
- var name = 'timespan';
-
- date.plugin(name, { extender: { timeSpan: timeSpan } });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/timezone.es.js b/esm/plugin/timezone.es.js
deleted file mode 100644
index 22c57e7..0000000
--- a/esm/plugin/timezone.es.js
+++ /dev/null
@@ -1,724 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve timezone
- */
-
-var plugin = function (proto, date) {
- var timeZones = {
- africa: {
- abidjan: [0, -968],
- accra: [0, -968],
- addis_ababa: [10800, 9900, 9000, 8836],
- algiers: [7200, 3600, 732, 561, 0],
- asmara: [10800, 9900, 9000, 8836],
- bamako: [0, -968],
- bangui: [3600, 1800, 815, 0],
- banjul: [0, -968],
- bissau: [0, -3600, -3740],
- blantyre: [7820, 7200],
- brazzaville: [3600, 1800, 815, 0],
- bujumbura: [7820, 7200],
- cairo: [10800, 7509, 7200],
- casablanca: [3600, 0, -1820],
- ceuta: [7200, 3600, 0, -1276],
- conakry: [0, -968],
- dakar: [0, -968],
- dar_es_salaam: [10800, 9900, 9000, 8836],
- djibouti: [10800, 9900, 9000, 8836],
- douala: [3600, 1800, 815, 0],
- el_aaiun: [3600, 0, -3168, -3600],
- freetown: [0, -968],
- gaborone: [7820, 7200],
- harare: [7820, 7200],
- johannesburg: [10800, 7200, 6720, 5400],
- juba: [10800, 7588, 7200],
- kampala: [10800, 9900, 9000, 8836],
- khartoum: [10800, 7808, 7200],
- kigali: [7820, 7200],
- kinshasa: [3600, 1800, 815, 0],
- lagos: [3600, 1800, 815, 0],
- libreville: [3600, 1800, 815, 0],
- lome: [0, -968],
- luanda: [3600, 1800, 815, 0],
- lubumbashi: [7820, 7200],
- lusaka: [7820, 7200],
- malabo: [3600, 1800, 815, 0],
- maputo: [7820, 7200],
- maseru: [10800, 7200, 6720, 5400],
- mbabane: [10800, 7200, 6720, 5400],
- mogadishu: [10800, 9900, 9000, 8836],
- monrovia: [0, -2588, -2670],
- nairobi: [10800, 9900, 9000, 8836],
- ndjamena: [7200, 3612, 3600],
- niamey: [3600, 1800, 815, 0],
- nouakchott: [0, -968],
- ouagadougou: [0, -968],
- 'porto-novo': [3600, 1800, 815, 0],
- sao_tome: [3600, 1616, 0, -2205],
- tripoli: [7200, 3600, 3164],
- tunis: [7200, 3600, 2444, 561],
- windhoek: [10800, 7200, 5400, 4104, 3600]
- },
- america: {
- adak: [44002, -32400, -36000, -39600, -42398],
- anchorage: [50424, -28800, -32400, -35976, -36000],
- anguilla: [-10800, -14400, -15865],
- antigua: [-10800, -14400, -15865],
- araguaina: [-7200, -10800, -11568],
- argentina: {
- buenos_aires: [-7200, -10800, -14028, -14400, -15408],
- catamarca: [-7200, -10800, -14400, -15408, -15788],
- cordoba: [-7200, -10800, -14400, -15408],
- jujuy: [-7200, -10800, -14400, -15408, -15672],
- la_rioja: [-7200, -10800, -14400, -15408, -16044],
- mendoza: [-7200, -10800, -14400, -15408, -16516],
- rio_gallegos: [-7200, -10800, -14400, -15408, -16612],
- salta: [-7200, -10800, -14400, -15408, -15700],
- san_juan: [-7200, -10800, -14400, -15408, -16444],
- san_luis: [-7200, -10800, -14400, -15408, -15924],
- tucuman: [-7200, -10800, -14400, -15408, -15652],
- ushuaia: [-7200, -10800, -14400, -15408, -16392]
- },
- aruba: [-10800, -14400, -15865],
- asuncion: [-10800, -13840, -14400],
- atikokan: [-18000, -19088, -19176],
- bahia_banderas: [-18000, -21600, -25200, -25260, -28800],
- bahia: [-7200, -9244, -10800],
- barbados: [-10800, -12600, -14309, -14400],
- belem: [-7200, -10800, -11636],
- belize: [-18000, -19800, -21168, -21600],
- 'blanc-sablon': [-10800, -14400, -15865],
- boa_vista: [-10800, -14400, -14560],
- bogota: [-14400, -17776, -18000],
- boise: [-21600, -25200, -27889, -28800],
- cambridge_bay: [0, -18000, -21600, -25200],
- campo_grande: [-10800, -13108, -14400],
- cancun: [-14400, -18000, -20824, -21600],
- caracas: [-14400, -16060, -16064, -16200],
- cayenne: [-10800, -12560, -14400],
- cayman: [-18000, -19088, -19176],
- chicago: [-18000, -21036, -21600],
- chihuahua: [-18000, -21600, -25200, -25460],
- ciudad_juarez: [-18000, -21600, -25200, -25556],
- costa_rica: [-18000, -20173, -21600],
- creston: [-21600, -25200, -26898],
- cuiaba: [-10800, -13460, -14400],
- curacao: [-10800, -14400, -15865],
- danmarkshavn: [0, -4480, -7200, -10800],
- dawson: [-25200, -28800, -32400, -33460],
- dawson_creek: [-25200, -28800, -28856],
- denver: [-21600, -25196, -25200],
- detroit: [-14400, -18000, -19931, -21600],
- dominica: [-10800, -14400, -15865],
- edmonton: [-21600, -25200, -27232],
- eirunepe: [-14400, -16768, -18000],
- el_salvador: [-18000, -21408, -21600],
- fortaleza: [-7200, -9240, -10800],
- fort_nelson: [-25200, -28800, -29447],
- glace_bay: [-10800, -14388, -14400],
- goose_bay: [-7200, -9000, -9052, -10800, -12600, -12652, -14400, -14500],
- grand_turk: [-14400, -17072, -18000, -18430],
- grenada: [-10800, -14400, -15865],
- guadeloupe: [-10800, -14400, -15865],
- guatemala: [-18000, -21600, -21724],
- guayaquil: [-14400, -18000, -18840, -19160],
- guyana: [-10800, -13500, -13959, -14400],
- halifax: [-10800, -14400, -15264],
- havana: [-14400, -18000, -19768, -19776],
- hermosillo: [-21600, -25200, -26632, -28800],
- indiana: {
- indianapolis: [-14400, -18000, -20678, -21600],
- knox: [-18000, -20790, -21600],
- marengo: [-14400, -18000, -20723, -21600],
- petersburg: [-14400, -18000, -20947, -21600],
- tell_city: [-14400, -18000, -20823, -21600],
- vevay: [-14400, -18000, -20416, -21600],
- vincennes: [-14400, -18000, -21007, -21600],
- winamac: [-14400, -18000, -20785, -21600]
- },
- inuvik: [0, -21600, -25200, -28800],
- iqaluit: [0, -14400, -18000, -21600],
- jamaica: [-14400, -18000, -18430],
- juneau: [54139, -25200, -28800, -32261, -32400],
- kentucky: {
- louisville: [-14400, -18000, -20582, -21600],
- monticello: [-14400, -18000, -20364, -21600]
- },
- kralendijk: [-10800, -14400, -15865],
- la_paz: [-12756, -14400, -16356],
- lima: [-14400, -18000, -18492, -18516],
- los_angeles: [-25200, -28378, -28800],
- lower_princes: [-10800, -14400, -15865],
- maceio: [-7200, -8572, -10800],
- managua: [-18000, -20708, -20712, -21600],
- manaus: [-10800, -14400, -14404],
- marigot: [-10800, -14400, -15865],
- martinique: [-10800, -14400, -14660],
- matamoros: [-18000, -21600, -23400],
- mazatlan: [-21600, -25200, -25540, -28800],
- menominee: [-18000, -21027, -21600],
- merida: [-18000, -21508, -21600],
- metlakatla: [54822, -25200, -28800, -31578, -32400],
- mexico_city: [-18000, -21600, -23796, -25200],
- miquelon: [-7200, -10800, -13480, -14400],
- moncton: [-10800, -14400, -15548, -18000],
- monterrey: [-18000, -21600, -24076],
- montevideo: [-5400, -7200, -9000, -10800, -12600, -13491, -14400],
- montserrat: [-10800, -14400, -15865],
- nassau: [-14400, -18000, -19052],
- new_york: [-14400, -17762, -18000],
- nome: [46702, -28800, -32400, -36000, -39600, -39698],
- noronha: [-3600, -7200, -7780],
- north_dakota: {
- beulah: [-18000, -21600, -24427, -25200],
- center: [-18000, -21600, -24312, -25200],
- new_salem: [-18000, -21600, -24339, -25200]
- },
- nuuk: [-3600, -7200, -10800, -12416],
- ojinaga: [-18000, -21600, -25060, -25200],
- panama: [-18000, -19088, -19176],
- paramaribo: [-10800, -12600, -13236, -13240, -13252],
- phoenix: [-21600, -25200, -26898],
- 'port-au-prince': [-14400, -17340, -17360, -18000],
- port_of_spain: [-10800, -14400, -15865],
- porto_velho: [-10800, -14400, -15336],
- puerto_rico: [-10800, -14400, -15865],
- punta_arenas: [-10800, -14400, -16965, -17020, -18000],
- rankin_inlet: [0, -18000, -21600],
- recife: [-7200, -8376, -10800],
- regina: [-21600, -25116, -25200],
- resolute: [0, -18000, -21600],
- rio_branco: [-14400, -16272, -18000],
- santarem: [-10800, -13128, -14400],
- santiago: [-10800, -14400, -16965, -18000],
- santo_domingo: [-14400, -16200, -16776, -16800, -18000],
- sao_paulo: [-7200, -10800, -11188],
- scoresbysund: [0, -3600, -5272, -7200],
- sitka: [53927, -25200, -28800, -32400, -32473],
- st_barthelemy: [-10800, -14400, -15865],
- st_johns: [-5400, -9000, -9052, -12600, -12652],
- st_kitts: [-10800, -14400, -15865],
- st_lucia: [-10800, -14400, -15865],
- st_thomas: [-10800, -14400, -15865],
- st_vincent: [-10800, -14400, -15865],
- swift_current: [-21600, -25200, -25880],
- tegucigalpa: [-18000, -20932, -21600],
- thule: [-10800, -14400, -16508],
- tijuana: [-25200, -28084, -28800],
- toronto: [-14400, -18000, -19052],
- tortola: [-10800, -14400, -15865],
- vancouver: [-25200, -28800, -29548],
- whitehorse: [-25200, -28800, -32400, -32412],
- winnipeg: [-18000, -21600, -23316],
- yakutat: [52865, -28800, -32400, -33535]
- },
- antarctica: {
- casey: [39600, 28800, 0],
- davis: [25200, 18000, 0],
- dumontdurville: [36000, 35320, 35312],
- macquarie: [39600, 36000, 0],
- mawson: [21600, 18000, 0],
- mcmurdo: [46800, 45000, 43200, 41944, 41400],
- palmer: [0, -7200, -10800, -14400],
- rothera: [0, -10800],
- syowa: [11212, 10800],
- troll: [7200, 0],
- vostok: [25200, 18000, 0]
- },
- arctic: { longyearbyen: [10800, 7200, 3600, 3208] },
- asia: {
- aden: [11212, 10800],
- almaty: [25200, 21600, 18468, 18000],
- amman: [10800, 8624, 7200],
- anadyr: [50400, 46800, 43200, 42596, 39600],
- aqtau: [21600, 18000, 14400, 12064],
- aqtobe: [21600, 18000, 14400, 13720],
- ashgabat: [21600, 18000, 14400, 14012],
- atyrau: [21600, 18000, 14400, 12464, 10800],
- baghdad: [14400, 10800, 10660, 10656],
- bahrain: [14400, 12368, 10800],
- baku: [18000, 14400, 11964, 10800],
- bangkok: [25200, 24124],
- barnaul: [28800, 25200, 21600, 20100],
- beirut: [10800, 8520, 7200],
- bishkek: [25200, 21600, 18000, 17904],
- brunei: [32400, 30000, 28800, 27000, 26480],
- chita: [36000, 32400, 28800, 27232],
- choibalsan: [36000, 32400, 28800, 27480, 25200],
- colombo: [23400, 21600, 19800, 19172, 19164],
- damascus: [10800, 8712, 7200],
- dhaka: [25200, 23400, 21700, 21600, 21200, 19800],
- dili: [32400, 30140, 28800],
- dubai: [14400, 13272],
- dushanbe: [25200, 21600, 18000, 16512],
- famagusta: [10800, 8148, 7200],
- gaza: [10800, 8272, 7200],
- hebron: [10800, 8423, 7200],
- ho_chi_minh: [32400, 28800, 25590, 25200],
- hong_kong: [32400, 30600, 28800, 27402],
- hovd: [28800, 25200, 21996, 21600],
- irkutsk: [32400, 28800, 25200, 25025],
- jakarta: [32400, 28800, 27000, 26400, 25632, 25200],
- jayapura: [34200, 33768, 32400],
- jerusalem: [14400, 10800, 8454, 8440, 7200],
- kabul: [16608, 16200, 14400],
- kamchatka: [46800, 43200, 39600, 38076],
- karachi: [23400, 21600, 19800, 18000, 16092],
- kathmandu: [20700, 20476, 19800],
- khandyga: [39600, 36000, 32533, 32400, 28800],
- kolkata: [23400, 21208, 21200, 19800, 19270],
- krasnoyarsk: [28800, 25200, 22286, 21600],
- kuala_lumpur: [32400, 28800, 27000, 26400, 25200, 24925],
- kuching: [32400, 30000, 28800, 27000, 26480],
- kuwait: [11212, 10800],
- macau: [36000, 32400, 28800, 27250],
- magadan: [43200, 39600, 36192, 36000],
- makassar: [32400, 28800, 28656],
- manila: [32400, 29040, 28800, -57360],
- muscat: [14400, 13272],
- nicosia: [10800, 8008, 7200],
- novokuznetsk: [28800, 25200, 21600, 20928],
- novosibirsk: [28800, 25200, 21600, 19900],
- omsk: [25200, 21600, 18000, 17610],
- oral: [21600, 18000, 14400, 12324, 10800],
- phnom_penh: [25200, 24124],
- pontianak: [32400, 28800, 27000, 26240, 25200],
- pyongyang: [32400, 30600, 30180],
- qatar: [14400, 12368, 10800],
- qostanay: [21600, 18000, 15268, 14400],
- qyzylorda: [21600, 18000, 15712, 14400],
- riyadh: [11212, 10800],
- sakhalin: [43200, 39600, 36000, 34248, 32400],
- samarkand: [21600, 18000, 16073, 14400],
- seoul: [36000, 34200, 32400, 30600, 30472],
- shanghai: [32400, 29143, 28800],
- singapore: [32400, 28800, 27000, 26400, 25200, 24925],
- srednekolymsk: [43200, 39600, 36892, 36000],
- taipei: [32400, 29160, 28800],
- tashkent: [25200, 21600, 18000, 16631],
- tbilisi: [18000, 14400, 10800, 10751],
- tehran: [18000, 16200, 14400, 12600, 12344],
- thimphu: [21600, 21516, 19800],
- tokyo: [36000, 33539, 32400],
- tomsk: [28800, 25200, 21600, 20391],
- ulaanbaatar: [32400, 28800, 25652, 25200],
- urumqi: [21600, 21020],
- 'ust-nera': [43200, 39600, 36000, 34374, 32400, 28800],
- vientiane: [25200, 24124],
- vladivostok: [39600, 36000, 32400, 31651],
- yakutsk: [36000, 32400, 31138, 28800],
- yangon: [32400, 23400, 23087],
- yekaterinburg: [21600, 18000, 14553, 14400, 13505],
- yerevan: [18000, 14400, 10800, 10680]
- },
- atlantic: {
- azores: [0, -3600, -6160, -6872, -7200],
- bermuda: [-10800, -11958, -14400, -15558],
- canary: [3600, 0, -3600, -3696],
- cape_verde: [-3600, -5644, -7200],
- faroe: [3600, 0, -1624],
- madeira: [3600, 0, -3600, -4056],
- reykjavik: [0, -968],
- south_georgia: [-7200, -8768],
- stanley: [-7200, -10800, -13884, -14400],
- st_helena: [0, -968]
- },
- australia: {
- adelaide: [37800, 34200, 33260, 32400],
- brisbane: [39600, 36728, 36000],
- broken_hill: [37800, 36000, 34200, 33948, 32400],
- darwin: [37800, 34200, 32400, 31400],
- eucla: [35100, 31500, 30928],
- hobart: [39600, 36000, 35356],
- lindeman: [39600, 36000, 35756],
- lord_howe: [41400, 39600, 38180, 37800, 36000],
- melbourne: [39600, 36000, 34792],
- perth: [32400, 28800, 27804],
- sydney: [39600, 36292, 36000]
- },
- europe: {
- amsterdam: [7200, 3600, 1050, 0],
- andorra: [7200, 3600, 364, 0],
- astrakhan: [18000, 14400, 11532, 10800],
- athens: [10800, 7200, 5692, 3600],
- belgrade: [7200, 4920, 3600],
- berlin: [10800, 7200, 3600, 3208],
- bratislava: [7200, 3600, 3464, 0],
- brussels: [7200, 3600, 1050, 0],
- bucharest: [10800, 7200, 6264],
- budapest: [7200, 4580, 3600],
- busingen: [7200, 3600, 2048, 1786],
- chisinau: [14400, 10800, 7200, 6920, 6900, 6264, 3600],
- copenhagen: [10800, 7200, 3600, 3208],
- dublin: [3600, 2079, 0, -1521],
- gibraltar: [7200, 3600, 0, -1284],
- guernsey: [7200, 3600, 0, -75],
- helsinki: [10800, 7200, 5989],
- isle_of_man: [7200, 3600, 0, -75],
- istanbul: [14400, 10800, 7200, 7016, 6952],
- jersey: [7200, 3600, 0, -75],
- kaliningrad: [14400, 10800, 7200, 4920, 3600],
- kirov: [18000, 14400, 11928, 10800],
- kyiv: [14400, 10800, 7324, 7200, 3600],
- lisbon: [7200, 3600, 0, -2205],
- ljubljana: [7200, 4920, 3600],
- london: [7200, 3600, 0, -75],
- luxembourg: [7200, 3600, 1050, 0],
- madrid: [7200, 3600, 0, -884],
- malta: [7200, 3600, 3484],
- mariehamn: [10800, 7200, 5989],
- minsk: [14400, 10800, 7200, 6616, 6600, 3600],
- monaco: [7200, 3600, 561, 0],
- moscow: [18000, 16279, 14400, 12679, 10800, 9079, 9017, 7200],
- oslo: [10800, 7200, 3600, 3208],
- paris: [7200, 3600, 561, 0],
- podgorica: [7200, 4920, 3600],
- prague: [7200, 3600, 3464, 0],
- riga: [14400, 10800, 9394, 7200, 5794, 3600],
- rome: [7200, 3600, 2996],
- samara: [18000, 14400, 12020, 10800],
- san_marino: [7200, 3600, 2996],
- sarajevo: [7200, 4920, 3600],
- saratov: [18000, 14400, 11058, 10800],
- simferopol: [14400, 10800, 8184, 8160, 7200, 3600],
- skopje: [7200, 4920, 3600],
- sofia: [10800, 7200, 7016, 5596, 3600],
- stockholm: [10800, 7200, 3600, 3208],
- tallinn: [14400, 10800, 7200, 5940, 3600],
- tirane: [7200, 4760, 3600],
- ulyanovsk: [18000, 14400, 11616, 10800, 7200],
- vaduz: [7200, 3600, 2048, 1786],
- vatican: [7200, 3600, 2996],
- vienna: [7200, 3921, 3600],
- vilnius: [14400, 10800, 7200, 6076, 5736, 5040, 3600],
- volgograd: [18000, 14400, 10800, 10660],
- warsaw: [10800, 7200, 5040, 3600],
- zagreb: [7200, 4920, 3600],
- zurich: [7200, 3600, 2048, 1786]
- },
- indian: {
- antananarivo: [10800, 9900, 9000, 8836],
- chagos: [21600, 18000, 17380],
- christmas: [25200, 24124],
- cocos: [32400, 23400, 23087],
- comoro: [10800, 9900, 9000, 8836],
- kerguelen: [18000, 17640],
- mahe: [14400, 13272],
- maldives: [18000, 17640],
- mauritius: [18000, 14400, 13800],
- mayotte: [10800, 9900, 9000, 8836],
- reunion: [14400, 13272]
- },
- pacific: {
- apia: [50400, 46800, 45184, -36000, -39600, -41216, -41400],
- auckland: [46800, 45000, 43200, 41944, 41400],
- bougainville: [39600, 37336, 36000, 35312, 32400],
- chatham: [49500, 45900, 44100, 44028],
- chuuk: [36000, 35320, 35312],
- easter: [-18000, -21600, -25200, -26248],
- efate: [43200, 40396, 39600],
- fakaofo: [46800, -39600, -41096],
- fiji: [46800, 43200, 42944],
- funafuti: [43200, 41524],
- galapagos: [-18000, -21504, -21600],
- gambier: [-32388, -32400],
- guadalcanal: [39600, 38388],
- guam: [39600, 36000, 34740, 32400, -51660],
- honolulu: [-34200, -36000, -37800, -37886],
- kanton: [46800, 0, -39600, -43200],
- kiritimati: [50400, -36000, -37760, -38400],
- kosrae: [43200, 39600, 39116, 36000, 32400, -47284],
- kwajalein: [43200, 40160, 39600, 36000, 32400, -43200],
- majuro: [43200, 41524],
- marquesas: [-33480, -34200],
- midway: [45432, -39600, -40968],
- nauru: [43200, 41400, 40060, 32400],
- niue: [-39600, -40780, -40800],
- norfolk: [45000, 43200, 41400, 40320, 40312, 39600],
- noumea: [43200, 39948, 39600],
- pago_pago: [45432, -39600, -40968],
- palau: [32400, 32276, -54124],
- pitcairn: [-28800, -30600, -31220],
- pohnpei: [39600, 38388],
- port_moresby: [36000, 35320, 35312],
- rarotonga: [48056, -34200, -36000, -37800, -38344],
- saipan: [39600, 36000, 34740, 32400, -51660],
- tahiti: [-35896, -36000],
- tarawa: [43200, 41524],
- tongatapu: [50400, 46800, 44400, 44352],
- wake: [43200, 41524],
- wallis: [43200, 41524]
- }
- };
- var timeZoneNames = {
- 'Acre Standard Time': 'ACT', 'Acre Summer Time': 'ACST', 'Afghanistan Time': 'AFT',
- 'Alaska Daylight Time': 'AKDT', 'Alaska Standard Time': 'AKST', 'Almaty Standard Time': 'ALMT',
- 'Almaty Summer Time': 'ALMST', 'Amazon Standard Time': 'AMT', 'Amazon Summer Time': 'AMST',
- 'Anadyr Standard Time': 'ANAT', 'Anadyr Summer Time': 'ANAST', 'Apia Daylight Time': 'WSDT',
- 'Apia Standard Time': 'WSST', 'Aqtau Standard Time': 'AQTT', 'Aqtau Summer Time': 'AQTST',
- 'Aqtobe Standard Time': 'AQTT', 'Aqtobe Summer Time': 'AQST', 'Arabian Daylight Time': 'ADT',
- 'Arabian Standard Time': 'AST', 'Argentina Standard Time': 'ART', 'Argentina Summer Time': 'ARST',
- 'Armenia Standard Time': 'AMT', 'Armenia Summer Time': 'AMST', 'Atlantic Daylight Time': 'ADT',
- 'Atlantic Standard Time': 'AST', 'Australian Central Daylight Time': 'ACDT', 'Australian Central Standard Time': 'ACST',
- 'Australian Central Western Daylight Time': 'ACWDT', 'Australian Central Western Standard Time': 'ACWST', 'Australian Eastern Daylight Time': 'AEDT',
- 'Australian Eastern Standard Time': 'AEST', 'Australian Western Daylight Time': 'AWDT', 'Australian Western Standard Time': 'AWST',
- 'Azerbaijan Standard Time': 'AZT', 'Azerbaijan Summer Time': 'AZST', 'Azores Standard Time': 'AZOT',
- 'Azores Summer Time': 'AZOST', 'Bangladesh Standard Time': 'BST', 'Bangladesh Summer Time': 'BDST',
- 'Bhutan Time': 'BTT', 'Bolivia Time': 'BOT', 'Brasilia Standard Time': 'BRT',
- 'Brasilia Summer Time': 'BRST', 'British Summer Time': 'BST', 'Brunei Darussalam Time': 'BNT',
- 'Cape Verde Standard Time': 'CVT', 'Casey Time': 'CAST', 'Central Africa Time': 'CAT',
- 'Central Daylight Time': 'CDT', 'Central European Standard Time': 'CET', 'Central European Summer Time': 'CEST',
- 'Central Indonesia Time': 'WITA', 'Central Standard Time': 'CST', 'Chamorro Standard Time': 'ChST',
- 'Chatham Daylight Time': 'CHADT', 'Chatham Standard Time': 'CHAST', 'Chile Standard Time': 'CLT',
- 'Chile Summer Time': 'CLST', 'China Daylight Time': 'CDT', 'China Standard Time': 'CST',
- 'Christmas Island Time': 'CXT', 'Chuuk Time': 'CHUT', 'Cocos Islands Time': 'CCT',
- 'Colombia Standard Time': 'COT', 'Colombia Summer Time': 'COST', 'Cook Islands Half Summer Time': 'CKHST',
- 'Cook Islands Standard Time': 'CKT', 'Coordinated Universal Time': 'UTC', 'Cuba Daylight Time': 'CDT',
- 'Cuba Standard Time': 'CST', 'Davis Time': 'DAVT', 'Dumont-d’Urville Time': 'DDUT',
- 'East Africa Time': 'EAT', 'East Greenland Standard Time': 'EGT', 'East Greenland Summer Time': 'EGST',
- 'East Kazakhstan Time': 'ALMT', 'East Timor Time': 'TLT', 'Easter Island Standard Time': 'EAST',
- 'Easter Island Summer Time': 'EASST', 'Eastern Daylight Time': 'EDT', 'Eastern European Standard Time': 'EET',
- 'Eastern European Summer Time': 'EEST', 'Eastern Indonesia Time': 'WIT', 'Eastern Standard Time': 'EST',
- 'Ecuador Time': 'ECT', 'Falkland Islands Standard Time': 'FKST', 'Falkland Islands Summer Time': 'FKDT',
- 'Fernando de Noronha Standard Time': 'FNT', 'Fernando de Noronha Summer Time': 'FNST', 'Fiji Standard Time': 'FJT',
- 'Fiji Summer Time': 'FJST', 'French Guiana Time': 'GFT', 'French Southern & Antarctic Time': 'TFT',
- 'Further-eastern European Time': 'FET', 'Galapagos Time': 'GALT', 'Gambier Time': 'GAMT',
- 'Georgia Standard Time': 'GET', 'Georgia Summer Time': 'GEST', 'Gilbert Islands Time': 'GILT',
- 'Greenwich Mean Time': 'GMT', 'Guam Standard Time': 'ChST', 'Gulf Standard Time': 'GST',
- 'Guyana Time': 'GYT', 'Hawaii-Aleutian Daylight Time': 'HADT', 'Hawaii-Aleutian Standard Time': 'HAST',
- 'Hong Kong Standard Time': 'HKT', 'Hong Kong Summer Time': 'HKST', 'Hovd Standard Time': 'HOVT',
- 'Hovd Summer Time': 'HOVST', 'India Standard Time': 'IST', 'Indian Ocean Time': 'IOT',
- 'Indochina Time': 'ICT', 'Iran Daylight Time': 'IRDT', 'Iran Standard Time': 'IRST',
- 'Irish Standard Time': 'IST', 'Irkutsk Standard Time': 'IRKT', 'Irkutsk Summer Time': 'IRKST',
- 'Israel Daylight Time': 'IDT', 'Israel Standard Time': 'IST', 'Japan Standard Time': 'JST',
- 'Korean Daylight Time': 'KDT', 'Korean Standard Time': 'KST', 'Kosrae Time': 'KOST',
- 'Krasnoyarsk Standard Time': 'KRAT', 'Krasnoyarsk Summer Time': 'KRAST', 'Kyrgyzstan Time': 'KGT',
- 'Lanka Time': 'LKT', 'Line Islands Time': 'LINT', 'Lord Howe Daylight Time': 'LHDT',
- 'Lord Howe Standard Time': 'LHST', 'Macao Standard Time': 'CST', 'Macao Summer Time': 'CDT',
- 'Magadan Standard Time': 'MAGT', 'Magadan Summer Time': 'MAGST', 'Malaysia Time': 'MYT',
- 'Maldives Time': 'MVT', 'Marquesas Time': 'MART', 'Marshall Islands Time': 'MHT',
- 'Mauritius Standard Time': 'MUT', 'Mauritius Summer Time': 'MUST', 'Mawson Time': 'MAWT',
- 'Mexican Pacific Daylight Time': 'PDT', 'Mexican Pacific Standard Time': 'PST', 'Moscow Standard Time': 'MSK',
- 'Moscow Summer Time': 'MSD', 'Mountain Daylight Time': 'MDT', 'Mountain Standard Time': 'MST',
- 'Myanmar Time': 'MMT', 'Nauru Time': 'NRT', 'Nepal Time': 'NPT',
- 'New Caledonia Standard Time': 'NCT', 'New Caledonia Summer Time': 'NCST', 'New Zealand Daylight Time': 'NZDT',
- 'New Zealand Standard Time': 'NZST', 'Newfoundland Daylight Time': 'NDT', 'Newfoundland Standard Time': 'NST',
- 'Niue Time': 'NUT', 'Norfolk Island Daylight Time': 'NFDT', 'Norfolk Island Standard Time': 'NFT',
- 'North Mariana Islands Time': 'ChST', 'Novosibirsk Standard Time': 'NOVT', 'Novosibirsk Summer Time': 'NOVST',
- 'Omsk Standard Time': 'OMST', 'Omsk Summer Time': 'OMSST', 'Pacific Daylight Time': 'PDT',
- 'Pacific Standard Time': 'PST', 'Pakistan Standard Time': 'PKT', 'Pakistan Summer Time': 'PKST',
- 'Palau Time': 'PWT', 'Papua New Guinea Time': 'PGT', 'Paraguay Standard Time': 'PYT',
- 'Paraguay Summer Time': 'PYST', 'Peru Standard Time': 'PET', 'Peru Summer Time': 'PEST',
- 'Petropavlovsk-Kamchatski Standard Time': 'PETT', 'Petropavlovsk-Kamchatski Summer Time': 'PETST', 'Philippine Standard Time': 'PST',
- 'Philippine Summer Time': 'PHST', 'Phoenix Islands Time': 'PHOT', 'Pitcairn Time': 'PIT',
- 'Ponape Time': 'PONT', 'Pyongyang Time': 'KST', 'Qyzylorda Standard Time': 'QYZT',
- 'Qyzylorda Summer Time': 'QYZST', 'Rothera Time': 'ROOTT', 'Réunion Time': 'RET',
- 'Sakhalin Standard Time': 'SAKT', 'Sakhalin Summer Time': 'SAKST', 'Samara Standard Time': 'SAMT',
- 'Samara Summer Time': 'SAMST', 'Samoa Standard Time': 'SST', 'Seychelles Time': 'SCT',
- 'Singapore Standard Time': 'SGT', 'Solomon Islands Time': 'SBT', 'South Africa Standard Time': 'SAST',
- 'South Georgia Time': 'GST', 'St. Pierre & Miquelon Daylight Time': 'PMDT', 'St. Pierre & Miquelon Standard Time': 'PMST',
- 'Suriname Time': 'SRT', 'Syowa Time': 'SYOT', 'Tahiti Time': 'TAHT',
- 'Taipei Daylight Time': 'CDT', 'Taipei Standard Time': 'CST', 'Tajikistan Time': 'TJT',
- 'Tokelau Time': 'TKT', 'Tonga Standard Time': 'TOT', 'Tonga Summer Time': 'TOST',
- 'Turkmenistan Standard Time': 'TMT', 'Tuvalu Time': 'TVT', 'Ulaanbaatar Standard Time': 'ULAT',
- 'Ulaanbaatar Summer Time': 'ULAST', 'Uruguay Standard Time': 'UYT', 'Uruguay Summer Time': 'UYST',
- 'Uzbekistan Standard Time': 'UZT', 'Uzbekistan Summer Time': 'UZST', 'Vanuatu Standard Time': 'VUT',
- 'Vanuatu Summer Time': 'VUST', 'Venezuela Time': 'VET', 'Vladivostok Standard Time': 'VLAT',
- 'Vladivostok Summer Time': 'VLAST', 'Volgograd Standard Time': 'VOLT', 'Volgograd Summer Time': 'VOLST',
- 'Vostok Time': 'VOST', 'Wake Island Time': 'WAKT', 'Wallis & Futuna Time': 'WFT',
- 'West Africa Standard Time': 'WAT', 'West Africa Summer Time': 'WAST', 'West Greenland Standard Time': 'WGST',
- 'West Greenland Summer Time': 'WGST', 'West Kazakhstan Time': 'AQTT', 'Western Argentina Standard Time': 'ART',
- 'Western Argentina Summer Time': 'ARST', 'Western European Standard Time': 'WET', 'Western European Summer Time': 'WEST',
- 'Western Indonesia Time': 'WIB', 'Yakutsk Standard Time': 'YAKT', 'Yakutsk Summer Time': 'YAKST',
- 'Yekaterinburg Standard Time': 'YEKT', 'Yekaterinburg Summer Time': 'YEKST', 'Yukon Time': 'YT'
- };
- var options = {
- hour12: false, weekday: 'short', year: 'numeric', month: 'numeric', day: 'numeric',
- hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3,
- timeZone: 'UTC'
- };
- var cache = {
- utc: new Intl.DateTimeFormat('en-US', options)
- };
- var getDateTimeFormat = function (timeZone) {
- if (timeZone) {
- var tz = timeZone.toLowerCase();
-
- if (!cache[tz]) {
- options.timeZone = timeZone;
- cache[tz] = new Intl.DateTimeFormat('en-US', options);
- }
- return cache[tz];
- }
- options.timeZone = undefined;
- return new Intl.DateTimeFormat('en-US', options);
- };
- var formatToParts = function (dateTimeFormat, dateObjOrTime) {
- var array = dateTimeFormat.formatToParts(dateObjOrTime),
- values = {};
-
- for (var i = 0, len = array.length; i < len; i++) {
- var type = array[i].type,
- value = array[i].value;
-
- switch (type) {
- case 'weekday':
- values[type] = 'SunMonTueWedThuFriSat'.indexOf(value) / 3;
- break;
- case 'hour':
- values[type] = value % 24;
- break;
- case 'year':
- case 'month':
- case 'day':
- case 'minute':
- case 'second':
- case 'fractionalSecond':
- values[type] = value | 0;
- }
- }
- return values;
- };
- var getTimeFromParts = function (parts) {
- return Date.UTC(
- parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day,
- parts.hour, parts.minute, parts.second, parts.fractionalSecond
- );
- };
- var formatTZ = function (dateObj, arg, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- return date.format({
- getFullYear: function () { return parts.year; },
- getMonth: function () { return parts.month - 1; },
- getDate: function () { return parts.day; },
- getHours: function () { return parts.hour; },
- getMinutes: function () { return parts.minute; },
- getSeconds: function () { return parts.second; },
- getMilliseconds: function () { return parts.fractionalSecond; },
- getDay: function () { return parts.weekday; },
- getTime: function () { return dateObj.getTime(); },
- getTimezoneOffset: function () {
- return (dateObj.getTime() - getTimeFromParts(parts)) / 60000 | 0;
- },
- getTimezoneName: function () { return timeZone || undefined; }
- }, arg);
- };
- var parseTZ = function (arg1, arg2, timeZone) {
- var pattern = typeof arg2 === 'string' ? date.compile(arg2) : arg2;
- var time = typeof arg1 === 'string' ? date.parse(arg1, pattern, !!timeZone).getTime() : arg1;
- var hasZ = function (array) {
- for (var i = 1, len = array.length; i < len; i++) {
- if (!array[i].indexOf('Z')) {
- return true;
- }
- }
- return false;
- };
-
- if (!timeZone || hasZ(pattern) || timeZone.toUpperCase() === 'UTC' || isNaN(time)) {
- return new Date(time);
- }
-
- var getOffset = function (timeZoneName) {
- var keys = (timeZoneName || '').toLowerCase().split('/');
- var value = timeZones[keys[0]] || {};
-
- for (var i = 1, len = keys.length; i < len; i++) {
- value = value[keys[i]] || {};
- }
- return Array.isArray(value) ? value : [];
- };
-
- var utc = getDateTimeFormat('UTC');
- var tz = getDateTimeFormat(timeZone);
- var offset = getOffset(timeZone);
-
- for (var i = 0; i < 2; i++) {
- var targetString = utc.format(time - i * 24 * 60 * 60 * 1000);
-
- for (var j = 0, len = offset.length; j < len; j++) {
- if (tz.format(time - (offset[j] + i * 24 * 60 * 60) * 1000) === targetString) {
- return new Date(time - offset[j] * 1000);
- }
- }
- }
- return new Date(NaN);
- };
- var transformTZ = function (dateString, arg1, arg2, timeZone) {
- return formatTZ(date.parse(dateString, arg1), arg2, timeZone);
- };
- var normalizeDateParts = function (parts, adjustEOM) {
- var d = new Date(Date.UTC(
- parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day
- ));
-
- if (adjustEOM && d.getUTCDate() < parts.day) {
- d.setUTCDate(0);
- }
- parts.year = d.getUTCFullYear();
- parts.month = d.getUTCMonth() + 1;
- parts.day = d.getUTCDate();
-
- return parts;
- };
- var addYearsTZ = function (dateObj, years, timeZone) {
- return addMonthsTZ(dateObj, years * 12, timeZone);
- };
- var addMonthsTZ = function (dateObj, months, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- parts.month += months;
- var dateObj2 = parseTZ(getTimeFromParts(normalizeDateParts(parts, true)), [], timeZone);
-
- return isNaN(dateObj2.getTime()) ? date.addMonths(dateObj, months, true) : dateObj2;
- };
- var addDaysTZ = function (dateObj, days, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- parts.day += days;
- var dateObj2 = parseTZ(getTimeFromParts(normalizeDateParts(parts, false)), [], timeZone);
-
- return isNaN(dateObj2.getTime()) ? date.addDays(dateObj, days, true) : dateObj2;
- };
-
- var name = 'timezone';
-
- var getName = function (d) {
- var parts = new Intl.DateTimeFormat('en-US', {
- timeZone: typeof d.getTimezoneName === 'function' ? d.getTimezoneName() : undefined,
- timeZoneName: 'long'
- }).formatToParts(d.getTime());
-
- for (var i = 0, len = parts.length; i < len; i++) {
- if (parts[i].type === 'timeZoneName') {
- return parts[i].value;
- }
- }
- return '';
- };
-
- proto.plugin(name, {
- formatter: {
- z: function (d) {
- var name = getName(d);
- return timeZoneNames[name] || '';
- },
- zz: function (d) {
- var name = getName(d);
- return /^GMT[+-].+$/.test(name) ? '' : name;
- }
- },
- extender: {
- formatTZ: formatTZ,
- parseTZ: parseTZ,
- transformTZ: transformTZ,
- addYearsTZ: addYearsTZ,
- addMonthsTZ: addMonthsTZ,
- addDaysTZ: addDaysTZ
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/timezone.mjs b/esm/plugin/timezone.mjs
deleted file mode 100644
index 22c57e7..0000000
--- a/esm/plugin/timezone.mjs
+++ /dev/null
@@ -1,724 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve timezone
- */
-
-var plugin = function (proto, date) {
- var timeZones = {
- africa: {
- abidjan: [0, -968],
- accra: [0, -968],
- addis_ababa: [10800, 9900, 9000, 8836],
- algiers: [7200, 3600, 732, 561, 0],
- asmara: [10800, 9900, 9000, 8836],
- bamako: [0, -968],
- bangui: [3600, 1800, 815, 0],
- banjul: [0, -968],
- bissau: [0, -3600, -3740],
- blantyre: [7820, 7200],
- brazzaville: [3600, 1800, 815, 0],
- bujumbura: [7820, 7200],
- cairo: [10800, 7509, 7200],
- casablanca: [3600, 0, -1820],
- ceuta: [7200, 3600, 0, -1276],
- conakry: [0, -968],
- dakar: [0, -968],
- dar_es_salaam: [10800, 9900, 9000, 8836],
- djibouti: [10800, 9900, 9000, 8836],
- douala: [3600, 1800, 815, 0],
- el_aaiun: [3600, 0, -3168, -3600],
- freetown: [0, -968],
- gaborone: [7820, 7200],
- harare: [7820, 7200],
- johannesburg: [10800, 7200, 6720, 5400],
- juba: [10800, 7588, 7200],
- kampala: [10800, 9900, 9000, 8836],
- khartoum: [10800, 7808, 7200],
- kigali: [7820, 7200],
- kinshasa: [3600, 1800, 815, 0],
- lagos: [3600, 1800, 815, 0],
- libreville: [3600, 1800, 815, 0],
- lome: [0, -968],
- luanda: [3600, 1800, 815, 0],
- lubumbashi: [7820, 7200],
- lusaka: [7820, 7200],
- malabo: [3600, 1800, 815, 0],
- maputo: [7820, 7200],
- maseru: [10800, 7200, 6720, 5400],
- mbabane: [10800, 7200, 6720, 5400],
- mogadishu: [10800, 9900, 9000, 8836],
- monrovia: [0, -2588, -2670],
- nairobi: [10800, 9900, 9000, 8836],
- ndjamena: [7200, 3612, 3600],
- niamey: [3600, 1800, 815, 0],
- nouakchott: [0, -968],
- ouagadougou: [0, -968],
- 'porto-novo': [3600, 1800, 815, 0],
- sao_tome: [3600, 1616, 0, -2205],
- tripoli: [7200, 3600, 3164],
- tunis: [7200, 3600, 2444, 561],
- windhoek: [10800, 7200, 5400, 4104, 3600]
- },
- america: {
- adak: [44002, -32400, -36000, -39600, -42398],
- anchorage: [50424, -28800, -32400, -35976, -36000],
- anguilla: [-10800, -14400, -15865],
- antigua: [-10800, -14400, -15865],
- araguaina: [-7200, -10800, -11568],
- argentina: {
- buenos_aires: [-7200, -10800, -14028, -14400, -15408],
- catamarca: [-7200, -10800, -14400, -15408, -15788],
- cordoba: [-7200, -10800, -14400, -15408],
- jujuy: [-7200, -10800, -14400, -15408, -15672],
- la_rioja: [-7200, -10800, -14400, -15408, -16044],
- mendoza: [-7200, -10800, -14400, -15408, -16516],
- rio_gallegos: [-7200, -10800, -14400, -15408, -16612],
- salta: [-7200, -10800, -14400, -15408, -15700],
- san_juan: [-7200, -10800, -14400, -15408, -16444],
- san_luis: [-7200, -10800, -14400, -15408, -15924],
- tucuman: [-7200, -10800, -14400, -15408, -15652],
- ushuaia: [-7200, -10800, -14400, -15408, -16392]
- },
- aruba: [-10800, -14400, -15865],
- asuncion: [-10800, -13840, -14400],
- atikokan: [-18000, -19088, -19176],
- bahia_banderas: [-18000, -21600, -25200, -25260, -28800],
- bahia: [-7200, -9244, -10800],
- barbados: [-10800, -12600, -14309, -14400],
- belem: [-7200, -10800, -11636],
- belize: [-18000, -19800, -21168, -21600],
- 'blanc-sablon': [-10800, -14400, -15865],
- boa_vista: [-10800, -14400, -14560],
- bogota: [-14400, -17776, -18000],
- boise: [-21600, -25200, -27889, -28800],
- cambridge_bay: [0, -18000, -21600, -25200],
- campo_grande: [-10800, -13108, -14400],
- cancun: [-14400, -18000, -20824, -21600],
- caracas: [-14400, -16060, -16064, -16200],
- cayenne: [-10800, -12560, -14400],
- cayman: [-18000, -19088, -19176],
- chicago: [-18000, -21036, -21600],
- chihuahua: [-18000, -21600, -25200, -25460],
- ciudad_juarez: [-18000, -21600, -25200, -25556],
- costa_rica: [-18000, -20173, -21600],
- creston: [-21600, -25200, -26898],
- cuiaba: [-10800, -13460, -14400],
- curacao: [-10800, -14400, -15865],
- danmarkshavn: [0, -4480, -7200, -10800],
- dawson: [-25200, -28800, -32400, -33460],
- dawson_creek: [-25200, -28800, -28856],
- denver: [-21600, -25196, -25200],
- detroit: [-14400, -18000, -19931, -21600],
- dominica: [-10800, -14400, -15865],
- edmonton: [-21600, -25200, -27232],
- eirunepe: [-14400, -16768, -18000],
- el_salvador: [-18000, -21408, -21600],
- fortaleza: [-7200, -9240, -10800],
- fort_nelson: [-25200, -28800, -29447],
- glace_bay: [-10800, -14388, -14400],
- goose_bay: [-7200, -9000, -9052, -10800, -12600, -12652, -14400, -14500],
- grand_turk: [-14400, -17072, -18000, -18430],
- grenada: [-10800, -14400, -15865],
- guadeloupe: [-10800, -14400, -15865],
- guatemala: [-18000, -21600, -21724],
- guayaquil: [-14400, -18000, -18840, -19160],
- guyana: [-10800, -13500, -13959, -14400],
- halifax: [-10800, -14400, -15264],
- havana: [-14400, -18000, -19768, -19776],
- hermosillo: [-21600, -25200, -26632, -28800],
- indiana: {
- indianapolis: [-14400, -18000, -20678, -21600],
- knox: [-18000, -20790, -21600],
- marengo: [-14400, -18000, -20723, -21600],
- petersburg: [-14400, -18000, -20947, -21600],
- tell_city: [-14400, -18000, -20823, -21600],
- vevay: [-14400, -18000, -20416, -21600],
- vincennes: [-14400, -18000, -21007, -21600],
- winamac: [-14400, -18000, -20785, -21600]
- },
- inuvik: [0, -21600, -25200, -28800],
- iqaluit: [0, -14400, -18000, -21600],
- jamaica: [-14400, -18000, -18430],
- juneau: [54139, -25200, -28800, -32261, -32400],
- kentucky: {
- louisville: [-14400, -18000, -20582, -21600],
- monticello: [-14400, -18000, -20364, -21600]
- },
- kralendijk: [-10800, -14400, -15865],
- la_paz: [-12756, -14400, -16356],
- lima: [-14400, -18000, -18492, -18516],
- los_angeles: [-25200, -28378, -28800],
- lower_princes: [-10800, -14400, -15865],
- maceio: [-7200, -8572, -10800],
- managua: [-18000, -20708, -20712, -21600],
- manaus: [-10800, -14400, -14404],
- marigot: [-10800, -14400, -15865],
- martinique: [-10800, -14400, -14660],
- matamoros: [-18000, -21600, -23400],
- mazatlan: [-21600, -25200, -25540, -28800],
- menominee: [-18000, -21027, -21600],
- merida: [-18000, -21508, -21600],
- metlakatla: [54822, -25200, -28800, -31578, -32400],
- mexico_city: [-18000, -21600, -23796, -25200],
- miquelon: [-7200, -10800, -13480, -14400],
- moncton: [-10800, -14400, -15548, -18000],
- monterrey: [-18000, -21600, -24076],
- montevideo: [-5400, -7200, -9000, -10800, -12600, -13491, -14400],
- montserrat: [-10800, -14400, -15865],
- nassau: [-14400, -18000, -19052],
- new_york: [-14400, -17762, -18000],
- nome: [46702, -28800, -32400, -36000, -39600, -39698],
- noronha: [-3600, -7200, -7780],
- north_dakota: {
- beulah: [-18000, -21600, -24427, -25200],
- center: [-18000, -21600, -24312, -25200],
- new_salem: [-18000, -21600, -24339, -25200]
- },
- nuuk: [-3600, -7200, -10800, -12416],
- ojinaga: [-18000, -21600, -25060, -25200],
- panama: [-18000, -19088, -19176],
- paramaribo: [-10800, -12600, -13236, -13240, -13252],
- phoenix: [-21600, -25200, -26898],
- 'port-au-prince': [-14400, -17340, -17360, -18000],
- port_of_spain: [-10800, -14400, -15865],
- porto_velho: [-10800, -14400, -15336],
- puerto_rico: [-10800, -14400, -15865],
- punta_arenas: [-10800, -14400, -16965, -17020, -18000],
- rankin_inlet: [0, -18000, -21600],
- recife: [-7200, -8376, -10800],
- regina: [-21600, -25116, -25200],
- resolute: [0, -18000, -21600],
- rio_branco: [-14400, -16272, -18000],
- santarem: [-10800, -13128, -14400],
- santiago: [-10800, -14400, -16965, -18000],
- santo_domingo: [-14400, -16200, -16776, -16800, -18000],
- sao_paulo: [-7200, -10800, -11188],
- scoresbysund: [0, -3600, -5272, -7200],
- sitka: [53927, -25200, -28800, -32400, -32473],
- st_barthelemy: [-10800, -14400, -15865],
- st_johns: [-5400, -9000, -9052, -12600, -12652],
- st_kitts: [-10800, -14400, -15865],
- st_lucia: [-10800, -14400, -15865],
- st_thomas: [-10800, -14400, -15865],
- st_vincent: [-10800, -14400, -15865],
- swift_current: [-21600, -25200, -25880],
- tegucigalpa: [-18000, -20932, -21600],
- thule: [-10800, -14400, -16508],
- tijuana: [-25200, -28084, -28800],
- toronto: [-14400, -18000, -19052],
- tortola: [-10800, -14400, -15865],
- vancouver: [-25200, -28800, -29548],
- whitehorse: [-25200, -28800, -32400, -32412],
- winnipeg: [-18000, -21600, -23316],
- yakutat: [52865, -28800, -32400, -33535]
- },
- antarctica: {
- casey: [39600, 28800, 0],
- davis: [25200, 18000, 0],
- dumontdurville: [36000, 35320, 35312],
- macquarie: [39600, 36000, 0],
- mawson: [21600, 18000, 0],
- mcmurdo: [46800, 45000, 43200, 41944, 41400],
- palmer: [0, -7200, -10800, -14400],
- rothera: [0, -10800],
- syowa: [11212, 10800],
- troll: [7200, 0],
- vostok: [25200, 18000, 0]
- },
- arctic: { longyearbyen: [10800, 7200, 3600, 3208] },
- asia: {
- aden: [11212, 10800],
- almaty: [25200, 21600, 18468, 18000],
- amman: [10800, 8624, 7200],
- anadyr: [50400, 46800, 43200, 42596, 39600],
- aqtau: [21600, 18000, 14400, 12064],
- aqtobe: [21600, 18000, 14400, 13720],
- ashgabat: [21600, 18000, 14400, 14012],
- atyrau: [21600, 18000, 14400, 12464, 10800],
- baghdad: [14400, 10800, 10660, 10656],
- bahrain: [14400, 12368, 10800],
- baku: [18000, 14400, 11964, 10800],
- bangkok: [25200, 24124],
- barnaul: [28800, 25200, 21600, 20100],
- beirut: [10800, 8520, 7200],
- bishkek: [25200, 21600, 18000, 17904],
- brunei: [32400, 30000, 28800, 27000, 26480],
- chita: [36000, 32400, 28800, 27232],
- choibalsan: [36000, 32400, 28800, 27480, 25200],
- colombo: [23400, 21600, 19800, 19172, 19164],
- damascus: [10800, 8712, 7200],
- dhaka: [25200, 23400, 21700, 21600, 21200, 19800],
- dili: [32400, 30140, 28800],
- dubai: [14400, 13272],
- dushanbe: [25200, 21600, 18000, 16512],
- famagusta: [10800, 8148, 7200],
- gaza: [10800, 8272, 7200],
- hebron: [10800, 8423, 7200],
- ho_chi_minh: [32400, 28800, 25590, 25200],
- hong_kong: [32400, 30600, 28800, 27402],
- hovd: [28800, 25200, 21996, 21600],
- irkutsk: [32400, 28800, 25200, 25025],
- jakarta: [32400, 28800, 27000, 26400, 25632, 25200],
- jayapura: [34200, 33768, 32400],
- jerusalem: [14400, 10800, 8454, 8440, 7200],
- kabul: [16608, 16200, 14400],
- kamchatka: [46800, 43200, 39600, 38076],
- karachi: [23400, 21600, 19800, 18000, 16092],
- kathmandu: [20700, 20476, 19800],
- khandyga: [39600, 36000, 32533, 32400, 28800],
- kolkata: [23400, 21208, 21200, 19800, 19270],
- krasnoyarsk: [28800, 25200, 22286, 21600],
- kuala_lumpur: [32400, 28800, 27000, 26400, 25200, 24925],
- kuching: [32400, 30000, 28800, 27000, 26480],
- kuwait: [11212, 10800],
- macau: [36000, 32400, 28800, 27250],
- magadan: [43200, 39600, 36192, 36000],
- makassar: [32400, 28800, 28656],
- manila: [32400, 29040, 28800, -57360],
- muscat: [14400, 13272],
- nicosia: [10800, 8008, 7200],
- novokuznetsk: [28800, 25200, 21600, 20928],
- novosibirsk: [28800, 25200, 21600, 19900],
- omsk: [25200, 21600, 18000, 17610],
- oral: [21600, 18000, 14400, 12324, 10800],
- phnom_penh: [25200, 24124],
- pontianak: [32400, 28800, 27000, 26240, 25200],
- pyongyang: [32400, 30600, 30180],
- qatar: [14400, 12368, 10800],
- qostanay: [21600, 18000, 15268, 14400],
- qyzylorda: [21600, 18000, 15712, 14400],
- riyadh: [11212, 10800],
- sakhalin: [43200, 39600, 36000, 34248, 32400],
- samarkand: [21600, 18000, 16073, 14400],
- seoul: [36000, 34200, 32400, 30600, 30472],
- shanghai: [32400, 29143, 28800],
- singapore: [32400, 28800, 27000, 26400, 25200, 24925],
- srednekolymsk: [43200, 39600, 36892, 36000],
- taipei: [32400, 29160, 28800],
- tashkent: [25200, 21600, 18000, 16631],
- tbilisi: [18000, 14400, 10800, 10751],
- tehran: [18000, 16200, 14400, 12600, 12344],
- thimphu: [21600, 21516, 19800],
- tokyo: [36000, 33539, 32400],
- tomsk: [28800, 25200, 21600, 20391],
- ulaanbaatar: [32400, 28800, 25652, 25200],
- urumqi: [21600, 21020],
- 'ust-nera': [43200, 39600, 36000, 34374, 32400, 28800],
- vientiane: [25200, 24124],
- vladivostok: [39600, 36000, 32400, 31651],
- yakutsk: [36000, 32400, 31138, 28800],
- yangon: [32400, 23400, 23087],
- yekaterinburg: [21600, 18000, 14553, 14400, 13505],
- yerevan: [18000, 14400, 10800, 10680]
- },
- atlantic: {
- azores: [0, -3600, -6160, -6872, -7200],
- bermuda: [-10800, -11958, -14400, -15558],
- canary: [3600, 0, -3600, -3696],
- cape_verde: [-3600, -5644, -7200],
- faroe: [3600, 0, -1624],
- madeira: [3600, 0, -3600, -4056],
- reykjavik: [0, -968],
- south_georgia: [-7200, -8768],
- stanley: [-7200, -10800, -13884, -14400],
- st_helena: [0, -968]
- },
- australia: {
- adelaide: [37800, 34200, 33260, 32400],
- brisbane: [39600, 36728, 36000],
- broken_hill: [37800, 36000, 34200, 33948, 32400],
- darwin: [37800, 34200, 32400, 31400],
- eucla: [35100, 31500, 30928],
- hobart: [39600, 36000, 35356],
- lindeman: [39600, 36000, 35756],
- lord_howe: [41400, 39600, 38180, 37800, 36000],
- melbourne: [39600, 36000, 34792],
- perth: [32400, 28800, 27804],
- sydney: [39600, 36292, 36000]
- },
- europe: {
- amsterdam: [7200, 3600, 1050, 0],
- andorra: [7200, 3600, 364, 0],
- astrakhan: [18000, 14400, 11532, 10800],
- athens: [10800, 7200, 5692, 3600],
- belgrade: [7200, 4920, 3600],
- berlin: [10800, 7200, 3600, 3208],
- bratislava: [7200, 3600, 3464, 0],
- brussels: [7200, 3600, 1050, 0],
- bucharest: [10800, 7200, 6264],
- budapest: [7200, 4580, 3600],
- busingen: [7200, 3600, 2048, 1786],
- chisinau: [14400, 10800, 7200, 6920, 6900, 6264, 3600],
- copenhagen: [10800, 7200, 3600, 3208],
- dublin: [3600, 2079, 0, -1521],
- gibraltar: [7200, 3600, 0, -1284],
- guernsey: [7200, 3600, 0, -75],
- helsinki: [10800, 7200, 5989],
- isle_of_man: [7200, 3600, 0, -75],
- istanbul: [14400, 10800, 7200, 7016, 6952],
- jersey: [7200, 3600, 0, -75],
- kaliningrad: [14400, 10800, 7200, 4920, 3600],
- kirov: [18000, 14400, 11928, 10800],
- kyiv: [14400, 10800, 7324, 7200, 3600],
- lisbon: [7200, 3600, 0, -2205],
- ljubljana: [7200, 4920, 3600],
- london: [7200, 3600, 0, -75],
- luxembourg: [7200, 3600, 1050, 0],
- madrid: [7200, 3600, 0, -884],
- malta: [7200, 3600, 3484],
- mariehamn: [10800, 7200, 5989],
- minsk: [14400, 10800, 7200, 6616, 6600, 3600],
- monaco: [7200, 3600, 561, 0],
- moscow: [18000, 16279, 14400, 12679, 10800, 9079, 9017, 7200],
- oslo: [10800, 7200, 3600, 3208],
- paris: [7200, 3600, 561, 0],
- podgorica: [7200, 4920, 3600],
- prague: [7200, 3600, 3464, 0],
- riga: [14400, 10800, 9394, 7200, 5794, 3600],
- rome: [7200, 3600, 2996],
- samara: [18000, 14400, 12020, 10800],
- san_marino: [7200, 3600, 2996],
- sarajevo: [7200, 4920, 3600],
- saratov: [18000, 14400, 11058, 10800],
- simferopol: [14400, 10800, 8184, 8160, 7200, 3600],
- skopje: [7200, 4920, 3600],
- sofia: [10800, 7200, 7016, 5596, 3600],
- stockholm: [10800, 7200, 3600, 3208],
- tallinn: [14400, 10800, 7200, 5940, 3600],
- tirane: [7200, 4760, 3600],
- ulyanovsk: [18000, 14400, 11616, 10800, 7200],
- vaduz: [7200, 3600, 2048, 1786],
- vatican: [7200, 3600, 2996],
- vienna: [7200, 3921, 3600],
- vilnius: [14400, 10800, 7200, 6076, 5736, 5040, 3600],
- volgograd: [18000, 14400, 10800, 10660],
- warsaw: [10800, 7200, 5040, 3600],
- zagreb: [7200, 4920, 3600],
- zurich: [7200, 3600, 2048, 1786]
- },
- indian: {
- antananarivo: [10800, 9900, 9000, 8836],
- chagos: [21600, 18000, 17380],
- christmas: [25200, 24124],
- cocos: [32400, 23400, 23087],
- comoro: [10800, 9900, 9000, 8836],
- kerguelen: [18000, 17640],
- mahe: [14400, 13272],
- maldives: [18000, 17640],
- mauritius: [18000, 14400, 13800],
- mayotte: [10800, 9900, 9000, 8836],
- reunion: [14400, 13272]
- },
- pacific: {
- apia: [50400, 46800, 45184, -36000, -39600, -41216, -41400],
- auckland: [46800, 45000, 43200, 41944, 41400],
- bougainville: [39600, 37336, 36000, 35312, 32400],
- chatham: [49500, 45900, 44100, 44028],
- chuuk: [36000, 35320, 35312],
- easter: [-18000, -21600, -25200, -26248],
- efate: [43200, 40396, 39600],
- fakaofo: [46800, -39600, -41096],
- fiji: [46800, 43200, 42944],
- funafuti: [43200, 41524],
- galapagos: [-18000, -21504, -21600],
- gambier: [-32388, -32400],
- guadalcanal: [39600, 38388],
- guam: [39600, 36000, 34740, 32400, -51660],
- honolulu: [-34200, -36000, -37800, -37886],
- kanton: [46800, 0, -39600, -43200],
- kiritimati: [50400, -36000, -37760, -38400],
- kosrae: [43200, 39600, 39116, 36000, 32400, -47284],
- kwajalein: [43200, 40160, 39600, 36000, 32400, -43200],
- majuro: [43200, 41524],
- marquesas: [-33480, -34200],
- midway: [45432, -39600, -40968],
- nauru: [43200, 41400, 40060, 32400],
- niue: [-39600, -40780, -40800],
- norfolk: [45000, 43200, 41400, 40320, 40312, 39600],
- noumea: [43200, 39948, 39600],
- pago_pago: [45432, -39600, -40968],
- palau: [32400, 32276, -54124],
- pitcairn: [-28800, -30600, -31220],
- pohnpei: [39600, 38388],
- port_moresby: [36000, 35320, 35312],
- rarotonga: [48056, -34200, -36000, -37800, -38344],
- saipan: [39600, 36000, 34740, 32400, -51660],
- tahiti: [-35896, -36000],
- tarawa: [43200, 41524],
- tongatapu: [50400, 46800, 44400, 44352],
- wake: [43200, 41524],
- wallis: [43200, 41524]
- }
- };
- var timeZoneNames = {
- 'Acre Standard Time': 'ACT', 'Acre Summer Time': 'ACST', 'Afghanistan Time': 'AFT',
- 'Alaska Daylight Time': 'AKDT', 'Alaska Standard Time': 'AKST', 'Almaty Standard Time': 'ALMT',
- 'Almaty Summer Time': 'ALMST', 'Amazon Standard Time': 'AMT', 'Amazon Summer Time': 'AMST',
- 'Anadyr Standard Time': 'ANAT', 'Anadyr Summer Time': 'ANAST', 'Apia Daylight Time': 'WSDT',
- 'Apia Standard Time': 'WSST', 'Aqtau Standard Time': 'AQTT', 'Aqtau Summer Time': 'AQTST',
- 'Aqtobe Standard Time': 'AQTT', 'Aqtobe Summer Time': 'AQST', 'Arabian Daylight Time': 'ADT',
- 'Arabian Standard Time': 'AST', 'Argentina Standard Time': 'ART', 'Argentina Summer Time': 'ARST',
- 'Armenia Standard Time': 'AMT', 'Armenia Summer Time': 'AMST', 'Atlantic Daylight Time': 'ADT',
- 'Atlantic Standard Time': 'AST', 'Australian Central Daylight Time': 'ACDT', 'Australian Central Standard Time': 'ACST',
- 'Australian Central Western Daylight Time': 'ACWDT', 'Australian Central Western Standard Time': 'ACWST', 'Australian Eastern Daylight Time': 'AEDT',
- 'Australian Eastern Standard Time': 'AEST', 'Australian Western Daylight Time': 'AWDT', 'Australian Western Standard Time': 'AWST',
- 'Azerbaijan Standard Time': 'AZT', 'Azerbaijan Summer Time': 'AZST', 'Azores Standard Time': 'AZOT',
- 'Azores Summer Time': 'AZOST', 'Bangladesh Standard Time': 'BST', 'Bangladesh Summer Time': 'BDST',
- 'Bhutan Time': 'BTT', 'Bolivia Time': 'BOT', 'Brasilia Standard Time': 'BRT',
- 'Brasilia Summer Time': 'BRST', 'British Summer Time': 'BST', 'Brunei Darussalam Time': 'BNT',
- 'Cape Verde Standard Time': 'CVT', 'Casey Time': 'CAST', 'Central Africa Time': 'CAT',
- 'Central Daylight Time': 'CDT', 'Central European Standard Time': 'CET', 'Central European Summer Time': 'CEST',
- 'Central Indonesia Time': 'WITA', 'Central Standard Time': 'CST', 'Chamorro Standard Time': 'ChST',
- 'Chatham Daylight Time': 'CHADT', 'Chatham Standard Time': 'CHAST', 'Chile Standard Time': 'CLT',
- 'Chile Summer Time': 'CLST', 'China Daylight Time': 'CDT', 'China Standard Time': 'CST',
- 'Christmas Island Time': 'CXT', 'Chuuk Time': 'CHUT', 'Cocos Islands Time': 'CCT',
- 'Colombia Standard Time': 'COT', 'Colombia Summer Time': 'COST', 'Cook Islands Half Summer Time': 'CKHST',
- 'Cook Islands Standard Time': 'CKT', 'Coordinated Universal Time': 'UTC', 'Cuba Daylight Time': 'CDT',
- 'Cuba Standard Time': 'CST', 'Davis Time': 'DAVT', 'Dumont-d’Urville Time': 'DDUT',
- 'East Africa Time': 'EAT', 'East Greenland Standard Time': 'EGT', 'East Greenland Summer Time': 'EGST',
- 'East Kazakhstan Time': 'ALMT', 'East Timor Time': 'TLT', 'Easter Island Standard Time': 'EAST',
- 'Easter Island Summer Time': 'EASST', 'Eastern Daylight Time': 'EDT', 'Eastern European Standard Time': 'EET',
- 'Eastern European Summer Time': 'EEST', 'Eastern Indonesia Time': 'WIT', 'Eastern Standard Time': 'EST',
- 'Ecuador Time': 'ECT', 'Falkland Islands Standard Time': 'FKST', 'Falkland Islands Summer Time': 'FKDT',
- 'Fernando de Noronha Standard Time': 'FNT', 'Fernando de Noronha Summer Time': 'FNST', 'Fiji Standard Time': 'FJT',
- 'Fiji Summer Time': 'FJST', 'French Guiana Time': 'GFT', 'French Southern & Antarctic Time': 'TFT',
- 'Further-eastern European Time': 'FET', 'Galapagos Time': 'GALT', 'Gambier Time': 'GAMT',
- 'Georgia Standard Time': 'GET', 'Georgia Summer Time': 'GEST', 'Gilbert Islands Time': 'GILT',
- 'Greenwich Mean Time': 'GMT', 'Guam Standard Time': 'ChST', 'Gulf Standard Time': 'GST',
- 'Guyana Time': 'GYT', 'Hawaii-Aleutian Daylight Time': 'HADT', 'Hawaii-Aleutian Standard Time': 'HAST',
- 'Hong Kong Standard Time': 'HKT', 'Hong Kong Summer Time': 'HKST', 'Hovd Standard Time': 'HOVT',
- 'Hovd Summer Time': 'HOVST', 'India Standard Time': 'IST', 'Indian Ocean Time': 'IOT',
- 'Indochina Time': 'ICT', 'Iran Daylight Time': 'IRDT', 'Iran Standard Time': 'IRST',
- 'Irish Standard Time': 'IST', 'Irkutsk Standard Time': 'IRKT', 'Irkutsk Summer Time': 'IRKST',
- 'Israel Daylight Time': 'IDT', 'Israel Standard Time': 'IST', 'Japan Standard Time': 'JST',
- 'Korean Daylight Time': 'KDT', 'Korean Standard Time': 'KST', 'Kosrae Time': 'KOST',
- 'Krasnoyarsk Standard Time': 'KRAT', 'Krasnoyarsk Summer Time': 'KRAST', 'Kyrgyzstan Time': 'KGT',
- 'Lanka Time': 'LKT', 'Line Islands Time': 'LINT', 'Lord Howe Daylight Time': 'LHDT',
- 'Lord Howe Standard Time': 'LHST', 'Macao Standard Time': 'CST', 'Macao Summer Time': 'CDT',
- 'Magadan Standard Time': 'MAGT', 'Magadan Summer Time': 'MAGST', 'Malaysia Time': 'MYT',
- 'Maldives Time': 'MVT', 'Marquesas Time': 'MART', 'Marshall Islands Time': 'MHT',
- 'Mauritius Standard Time': 'MUT', 'Mauritius Summer Time': 'MUST', 'Mawson Time': 'MAWT',
- 'Mexican Pacific Daylight Time': 'PDT', 'Mexican Pacific Standard Time': 'PST', 'Moscow Standard Time': 'MSK',
- 'Moscow Summer Time': 'MSD', 'Mountain Daylight Time': 'MDT', 'Mountain Standard Time': 'MST',
- 'Myanmar Time': 'MMT', 'Nauru Time': 'NRT', 'Nepal Time': 'NPT',
- 'New Caledonia Standard Time': 'NCT', 'New Caledonia Summer Time': 'NCST', 'New Zealand Daylight Time': 'NZDT',
- 'New Zealand Standard Time': 'NZST', 'Newfoundland Daylight Time': 'NDT', 'Newfoundland Standard Time': 'NST',
- 'Niue Time': 'NUT', 'Norfolk Island Daylight Time': 'NFDT', 'Norfolk Island Standard Time': 'NFT',
- 'North Mariana Islands Time': 'ChST', 'Novosibirsk Standard Time': 'NOVT', 'Novosibirsk Summer Time': 'NOVST',
- 'Omsk Standard Time': 'OMST', 'Omsk Summer Time': 'OMSST', 'Pacific Daylight Time': 'PDT',
- 'Pacific Standard Time': 'PST', 'Pakistan Standard Time': 'PKT', 'Pakistan Summer Time': 'PKST',
- 'Palau Time': 'PWT', 'Papua New Guinea Time': 'PGT', 'Paraguay Standard Time': 'PYT',
- 'Paraguay Summer Time': 'PYST', 'Peru Standard Time': 'PET', 'Peru Summer Time': 'PEST',
- 'Petropavlovsk-Kamchatski Standard Time': 'PETT', 'Petropavlovsk-Kamchatski Summer Time': 'PETST', 'Philippine Standard Time': 'PST',
- 'Philippine Summer Time': 'PHST', 'Phoenix Islands Time': 'PHOT', 'Pitcairn Time': 'PIT',
- 'Ponape Time': 'PONT', 'Pyongyang Time': 'KST', 'Qyzylorda Standard Time': 'QYZT',
- 'Qyzylorda Summer Time': 'QYZST', 'Rothera Time': 'ROOTT', 'Réunion Time': 'RET',
- 'Sakhalin Standard Time': 'SAKT', 'Sakhalin Summer Time': 'SAKST', 'Samara Standard Time': 'SAMT',
- 'Samara Summer Time': 'SAMST', 'Samoa Standard Time': 'SST', 'Seychelles Time': 'SCT',
- 'Singapore Standard Time': 'SGT', 'Solomon Islands Time': 'SBT', 'South Africa Standard Time': 'SAST',
- 'South Georgia Time': 'GST', 'St. Pierre & Miquelon Daylight Time': 'PMDT', 'St. Pierre & Miquelon Standard Time': 'PMST',
- 'Suriname Time': 'SRT', 'Syowa Time': 'SYOT', 'Tahiti Time': 'TAHT',
- 'Taipei Daylight Time': 'CDT', 'Taipei Standard Time': 'CST', 'Tajikistan Time': 'TJT',
- 'Tokelau Time': 'TKT', 'Tonga Standard Time': 'TOT', 'Tonga Summer Time': 'TOST',
- 'Turkmenistan Standard Time': 'TMT', 'Tuvalu Time': 'TVT', 'Ulaanbaatar Standard Time': 'ULAT',
- 'Ulaanbaatar Summer Time': 'ULAST', 'Uruguay Standard Time': 'UYT', 'Uruguay Summer Time': 'UYST',
- 'Uzbekistan Standard Time': 'UZT', 'Uzbekistan Summer Time': 'UZST', 'Vanuatu Standard Time': 'VUT',
- 'Vanuatu Summer Time': 'VUST', 'Venezuela Time': 'VET', 'Vladivostok Standard Time': 'VLAT',
- 'Vladivostok Summer Time': 'VLAST', 'Volgograd Standard Time': 'VOLT', 'Volgograd Summer Time': 'VOLST',
- 'Vostok Time': 'VOST', 'Wake Island Time': 'WAKT', 'Wallis & Futuna Time': 'WFT',
- 'West Africa Standard Time': 'WAT', 'West Africa Summer Time': 'WAST', 'West Greenland Standard Time': 'WGST',
- 'West Greenland Summer Time': 'WGST', 'West Kazakhstan Time': 'AQTT', 'Western Argentina Standard Time': 'ART',
- 'Western Argentina Summer Time': 'ARST', 'Western European Standard Time': 'WET', 'Western European Summer Time': 'WEST',
- 'Western Indonesia Time': 'WIB', 'Yakutsk Standard Time': 'YAKT', 'Yakutsk Summer Time': 'YAKST',
- 'Yekaterinburg Standard Time': 'YEKT', 'Yekaterinburg Summer Time': 'YEKST', 'Yukon Time': 'YT'
- };
- var options = {
- hour12: false, weekday: 'short', year: 'numeric', month: 'numeric', day: 'numeric',
- hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3,
- timeZone: 'UTC'
- };
- var cache = {
- utc: new Intl.DateTimeFormat('en-US', options)
- };
- var getDateTimeFormat = function (timeZone) {
- if (timeZone) {
- var tz = timeZone.toLowerCase();
-
- if (!cache[tz]) {
- options.timeZone = timeZone;
- cache[tz] = new Intl.DateTimeFormat('en-US', options);
- }
- return cache[tz];
- }
- options.timeZone = undefined;
- return new Intl.DateTimeFormat('en-US', options);
- };
- var formatToParts = function (dateTimeFormat, dateObjOrTime) {
- var array = dateTimeFormat.formatToParts(dateObjOrTime),
- values = {};
-
- for (var i = 0, len = array.length; i < len; i++) {
- var type = array[i].type,
- value = array[i].value;
-
- switch (type) {
- case 'weekday':
- values[type] = 'SunMonTueWedThuFriSat'.indexOf(value) / 3;
- break;
- case 'hour':
- values[type] = value % 24;
- break;
- case 'year':
- case 'month':
- case 'day':
- case 'minute':
- case 'second':
- case 'fractionalSecond':
- values[type] = value | 0;
- }
- }
- return values;
- };
- var getTimeFromParts = function (parts) {
- return Date.UTC(
- parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day,
- parts.hour, parts.minute, parts.second, parts.fractionalSecond
- );
- };
- var formatTZ = function (dateObj, arg, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- return date.format({
- getFullYear: function () { return parts.year; },
- getMonth: function () { return parts.month - 1; },
- getDate: function () { return parts.day; },
- getHours: function () { return parts.hour; },
- getMinutes: function () { return parts.minute; },
- getSeconds: function () { return parts.second; },
- getMilliseconds: function () { return parts.fractionalSecond; },
- getDay: function () { return parts.weekday; },
- getTime: function () { return dateObj.getTime(); },
- getTimezoneOffset: function () {
- return (dateObj.getTime() - getTimeFromParts(parts)) / 60000 | 0;
- },
- getTimezoneName: function () { return timeZone || undefined; }
- }, arg);
- };
- var parseTZ = function (arg1, arg2, timeZone) {
- var pattern = typeof arg2 === 'string' ? date.compile(arg2) : arg2;
- var time = typeof arg1 === 'string' ? date.parse(arg1, pattern, !!timeZone).getTime() : arg1;
- var hasZ = function (array) {
- for (var i = 1, len = array.length; i < len; i++) {
- if (!array[i].indexOf('Z')) {
- return true;
- }
- }
- return false;
- };
-
- if (!timeZone || hasZ(pattern) || timeZone.toUpperCase() === 'UTC' || isNaN(time)) {
- return new Date(time);
- }
-
- var getOffset = function (timeZoneName) {
- var keys = (timeZoneName || '').toLowerCase().split('/');
- var value = timeZones[keys[0]] || {};
-
- for (var i = 1, len = keys.length; i < len; i++) {
- value = value[keys[i]] || {};
- }
- return Array.isArray(value) ? value : [];
- };
-
- var utc = getDateTimeFormat('UTC');
- var tz = getDateTimeFormat(timeZone);
- var offset = getOffset(timeZone);
-
- for (var i = 0; i < 2; i++) {
- var targetString = utc.format(time - i * 24 * 60 * 60 * 1000);
-
- for (var j = 0, len = offset.length; j < len; j++) {
- if (tz.format(time - (offset[j] + i * 24 * 60 * 60) * 1000) === targetString) {
- return new Date(time - offset[j] * 1000);
- }
- }
- }
- return new Date(NaN);
- };
- var transformTZ = function (dateString, arg1, arg2, timeZone) {
- return formatTZ(date.parse(dateString, arg1), arg2, timeZone);
- };
- var normalizeDateParts = function (parts, adjustEOM) {
- var d = new Date(Date.UTC(
- parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day
- ));
-
- if (adjustEOM && d.getUTCDate() < parts.day) {
- d.setUTCDate(0);
- }
- parts.year = d.getUTCFullYear();
- parts.month = d.getUTCMonth() + 1;
- parts.day = d.getUTCDate();
-
- return parts;
- };
- var addYearsTZ = function (dateObj, years, timeZone) {
- return addMonthsTZ(dateObj, years * 12, timeZone);
- };
- var addMonthsTZ = function (dateObj, months, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- parts.month += months;
- var dateObj2 = parseTZ(getTimeFromParts(normalizeDateParts(parts, true)), [], timeZone);
-
- return isNaN(dateObj2.getTime()) ? date.addMonths(dateObj, months, true) : dateObj2;
- };
- var addDaysTZ = function (dateObj, days, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- parts.day += days;
- var dateObj2 = parseTZ(getTimeFromParts(normalizeDateParts(parts, false)), [], timeZone);
-
- return isNaN(dateObj2.getTime()) ? date.addDays(dateObj, days, true) : dateObj2;
- };
-
- var name = 'timezone';
-
- var getName = function (d) {
- var parts = new Intl.DateTimeFormat('en-US', {
- timeZone: typeof d.getTimezoneName === 'function' ? d.getTimezoneName() : undefined,
- timeZoneName: 'long'
- }).formatToParts(d.getTime());
-
- for (var i = 0, len = parts.length; i < len; i++) {
- if (parts[i].type === 'timeZoneName') {
- return parts[i].value;
- }
- }
- return '';
- };
-
- proto.plugin(name, {
- formatter: {
- z: function (d) {
- var name = getName(d);
- return timeZoneNames[name] || '';
- },
- zz: function (d) {
- var name = getName(d);
- return /^GMT[+-].+$/.test(name) ? '' : name;
- }
- },
- extender: {
- formatTZ: formatTZ,
- parseTZ: parseTZ,
- transformTZ: transformTZ,
- addYearsTZ: addYearsTZ,
- addMonthsTZ: addMonthsTZ,
- addDaysTZ: addDaysTZ
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/two-digit-year.es.js b/esm/plugin/two-digit-year.es.js
deleted file mode 100644
index e76269d..0000000
--- a/esm/plugin/two-digit-year.es.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve two-digit-year
- */
-
-var plugin = function (date) {
- var name = 'two-digit-year';
-
- date.plugin(name, {
- parser: {
- YY: function (str) {
- var result = this.exec(/^\d\d/, str);
- result.value += result.value < 70 ? 2000 : 1900;
- return result;
- }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/esm/plugin/two-digit-year.mjs b/esm/plugin/two-digit-year.mjs
deleted file mode 100644
index e76269d..0000000
--- a/esm/plugin/two-digit-year.mjs
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve two-digit-year
- */
-
-var plugin = function (date) {
- var name = 'two-digit-year';
-
- date.plugin(name, {
- parser: {
- YY: function (str) {
- var result = this.exec(/^\d\d/, str);
- result.value += result.value < 70 ? 2000 : 1900;
- return result;
- }
- }
- });
- return name;
-};
-
-export { plugin as default };
diff --git a/locale/ar.d.ts b/locale/ar.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/ar.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/ar.js b/locale/ar.js
deleted file mode 100644
index 70739ee..0000000
--- a/locale/ar.js
+++ /dev/null
@@ -1,47 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ar = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Arabic (ar)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var ar = function (date) {
- var code = 'ar';
-
- date.locale(code, {
- res: {
- MMMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- MMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- dddd: ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
- ddd: ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
- dd: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
- A: ['ص', 'م']
- },
- formatter: {
- post: function (str) {
- var num = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '٠': 0, '١': 1, '٢': 2, '٣': 3, '٤': 4, '٥': 5, '٦': 6, '٧': 7, '٨': 8, '٩': 9 };
- return str.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
- };
-
- return ar;
-
-}));
diff --git a/locale/az.d.ts b/locale/az.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/az.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/az.js b/locale/az.js
deleted file mode 100644
index d8d815b..0000000
--- a/locale/az.js
+++ /dev/null
@@ -1,52 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.az = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Azerbaijani (az)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var az = function (date) {
- var code = 'az';
-
- date.locale(code, {
- res: {
- MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
- MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
- dddd: ['Bazar', 'Bazar ertəsi', 'Çərşənbə axşamı', 'Çərşənbə', 'Cümə axşamı', 'Cümə', 'Şənbə'],
- ddd: ['Baz', 'BzE', 'ÇAx', 'Çər', 'CAx', 'Cüm', 'Şən'],
- dd: ['Bz', 'BE', 'ÇA', 'Çə', 'CA', 'Cü', 'Şə'],
- A: ['gecə', 'səhər', 'gündüz', 'axşam']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // gecə
- } else if (h < 12) {
- return this.res.A[1]; // səhər
- } else if (h < 17) {
- return this.res.A[2]; // gündüz
- }
- return this.res.A[3]; // axşam
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // gecə, səhər
- }
- return h > 11 ? h : h + 12; // gündüz, axşam
- }
- }
- });
- return code;
- };
-
- return az;
-
-}));
diff --git a/locale/bn.d.ts b/locale/bn.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/bn.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/bn.js b/locale/bn.js
deleted file mode 100644
index cf99231..0000000
--- a/locale/bn.js
+++ /dev/null
@@ -1,58 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.bn = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Bengali (bn)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var bn = function (date) {
- var code = 'bn';
-
- date.locale(code, {
- res: {
- MMMM: ['জানুয়ারী', 'ফেবুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
- MMM: ['জানু', 'ফেব', 'মার্চ', 'এপর', 'মে', 'জুন', 'জুল', 'অগ', 'সেপ্ট', 'অক্টো', 'নভ', 'ডিসেম্'],
- dddd: ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পত্তিবার', 'শুক্রবার', 'শনিবার'],
- ddd: ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পত্তি', 'শুক্র', 'শনি'],
- dd: ['রব', 'সম', 'মঙ্গ', 'বু', 'ব্রিহ', 'শু', 'শনি'],
- A: ['রাত', 'সকাল', 'দুপুর', 'বিকাল']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // রাত
- } else if (h < 10) {
- return this.res.A[1]; // সকাল
- } else if (h < 17) {
- return this.res.A[2]; // দুপুর
- } else if (h < 20) {
- return this.res.A[3]; // বিকাল
- }
- return this.res.A[0]; // রাত
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // রাত
- } else if (a < 2) {
- return h; // সকাল
- } else if (a < 3) {
- return h > 9 ? h : h + 12; // দুপুর
- }
- return h + 12; // বিকাল
- }
- }
- });
- return code;
- };
-
- return bn;
-
-}));
diff --git a/locale/cs.d.ts b/locale/cs.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/cs.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/cs.js b/locale/cs.js
deleted file mode 100644
index 35cd9b8..0000000
--- a/locale/cs.js
+++ /dev/null
@@ -1,30 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.cs = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Czech (cs)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var cs = function (date) {
- var code = 'cs';
-
- date.locale(code, {
- res: {
- MMMM: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
- MMM: ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'],
- dddd: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
- ddd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
- dd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so']
- }
- });
- return code;
- };
-
- return cs;
-
-}));
diff --git a/locale/de.d.ts b/locale/de.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/de.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/de.js b/locale/de.js
deleted file mode 100644
index 66a8150..0000000
--- a/locale/de.js
+++ /dev/null
@@ -1,31 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.de = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve German (de)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var de = function (date) {
- var code = 'de';
-
- date.locale(code, {
- res: {
- MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
- MMM: ['Jan.', 'Febr.', 'Mrz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'],
- dddd: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
- ddd: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
- dd: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
- A: ['Uhr nachmittags', 'Uhr morgens']
- }
- });
- return code;
- };
-
- return de;
-
-}));
diff --git a/locale/dk.d.ts b/locale/dk.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/dk.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/dk.js b/locale/dk.js
deleted file mode 100644
index caa54bf..0000000
--- a/locale/dk.js
+++ /dev/null
@@ -1,30 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.dk = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Danish (DK)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var dk = function (date) {
- var code = 'dk';
-
- date.locale(code, {
- res: {
- MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
- MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
- ddd: ['søn', 'man', 'tir', 'ons', 'tors', 'fre', 'lør'],
- dd: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø']
- }
- });
- return code;
- };
-
- return dk;
-
-}));
diff --git a/locale/el.d.ts b/locale/el.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/el.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/el.js b/locale/el.js
deleted file mode 100644
index 9e63928..0000000
--- a/locale/el.js
+++ /dev/null
@@ -1,52 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.el = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Greek (el)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var el = function (date) {
- var code = 'el';
-
- date.locale(code, {
- res: {
- MMMM: [
- ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
- ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
- ],
- MMM: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
- dddd: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
- ddd: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
- dd: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
- A: ['πμ', 'μμ']
- },
- formatter: {
- MMMM: function (d, formatString) {
- return this.res.MMMM[/D.*MMMM/.test(formatString) | 0][d.getMonth()];
- },
- hh: function (d) {
- return ('0' + d.getHours() % 12).slice(-2);
- },
- h: function (d) {
- return d.getHours() % 12;
- }
- },
- parser: {
- MMMM: function (str, formatString) {
- var result = this.find(this.res.MMMM[/D.*MMMM/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
- };
-
- return el;
-
-}));
diff --git a/locale/en.d.ts b/locale/en.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/en.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/en.js b/locale/en.js
deleted file mode 100644
index 7c7027d..0000000
--- a/locale/en.js
+++ /dev/null
@@ -1,21 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.en = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Englis (en)
- * @preserve This is a dummy module.
- */
-
- var en = function (date) {
- var code = 'en';
-
- return code;
- };
-
- return en;
-
-}));
diff --git a/locale/es.d.ts b/locale/es.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/es.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/es.js b/locale/es.js
deleted file mode 100644
index ff58197..0000000
--- a/locale/es.js
+++ /dev/null
@@ -1,50 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.es = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Spanish (es)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var es = function (date) {
- var code = 'es';
-
- date.locale(code, {
- res: {
- MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
- MMM: ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'],
- dddd: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
- ddd: ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'],
- dd: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
- A: ['de la mañana', 'de la tarde', 'de la noche']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 12) {
- return this.res.A[0]; // de la mañana
- } else if (h < 19) {
- return this.res.A[1]; // de la tarde
- }
- return this.res.A[2]; // de la noche
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // de la mañana
- }
- return h > 11 ? h : h + 12; // de la tarde, de la noche
- }
- }
- });
- return code;
- };
-
- return es;
-
-}));
diff --git a/locale/fa.d.ts b/locale/fa.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/fa.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/fa.js b/locale/fa.js
deleted file mode 100644
index 4e740f6..0000000
--- a/locale/fa.js
+++ /dev/null
@@ -1,47 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.fa = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Persian (fa)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var fa = function (date) {
- var code = 'fa';
-
- date.locale(code, {
- res: {
- MMMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- MMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- dddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- ddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- dd: ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
- A: ['قبل از ظهر', 'بعد از ظهر']
- },
- formatter: {
- post: function (str) {
- var num = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '۰': 0, '۱': 1, '۲': 2, '۳': 3, '۴': 4, '۵': 5, '۶': 6, '۷': 7, '۸': 8, '۹': 9 };
- return str.replace(/[۰۱۲۳۴۵۶۷۸۹]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
- };
-
- return fa;
-
-}));
diff --git a/locale/fr.d.ts b/locale/fr.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/fr.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/fr.js b/locale/fr.js
deleted file mode 100644
index fad7c63..0000000
--- a/locale/fr.js
+++ /dev/null
@@ -1,31 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.fr = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve French (fr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var fr = function (date) {
- var code = 'fr';
-
- date.locale(code, {
- res: {
- MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
- MMM: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
- dddd: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
- ddd: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
- dd: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
- A: ['matin', 'l\'après-midi']
- }
- });
- return code;
- };
-
- return fr;
-
-}));
diff --git a/locale/hi.d.ts b/locale/hi.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/hi.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/hi.js b/locale/hi.js
deleted file mode 100644
index 37a46ab..0000000
--- a/locale/hi.js
+++ /dev/null
@@ -1,58 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.hi = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Hindi (hi)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var hi = function (date) {
- var code = 'hi';
-
- date.locale(code, {
- res: {
- MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'],
- MMM: ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'],
- dddd: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'],
- ddd: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'],
- dd: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
- A: ['रात', 'सुबह', 'दोपहर', 'शाम']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // रात
- } else if (h < 10) {
- return this.res.A[1]; // सुबह
- } else if (h < 17) {
- return this.res.A[2]; // दोपहर
- } else if (h < 20) {
- return this.res.A[3]; // शाम
- }
- return this.res.A[0]; // रात
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // रात
- } else if (a < 2) {
- return h; // सुबह
- } else if (a < 3) {
- return h > 9 ? h : h + 12; // दोपहर
- }
- return h + 12; // शाम
- }
- }
- });
- return code;
- };
-
- return hi;
-
-}));
diff --git a/locale/hu.d.ts b/locale/hu.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/hu.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/hu.js b/locale/hu.js
deleted file mode 100644
index c4d56fc..0000000
--- a/locale/hu.js
+++ /dev/null
@@ -1,31 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.hu = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Hungarian (hu)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var hu = function (date) {
- var code = 'hu';
-
- date.locale(code, {
- res: {
- MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'],
- MMM: ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'],
- dddd: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'],
- ddd: ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'],
- dd: ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'],
- A: ['de', 'du']
- }
- });
- return code;
- };
-
- return hu;
-
-}));
diff --git a/locale/id.d.ts b/locale/id.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/id.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/id.js b/locale/id.js
deleted file mode 100644
index d01a25e..0000000
--- a/locale/id.js
+++ /dev/null
@@ -1,54 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.id = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Indonesian (id)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var id = function (date) {
- var code = 'id';
-
- date.locale(code, {
- res: {
- MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'],
- dddd: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
- ddd: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
- dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'],
- A: ['pagi', 'siang', 'sore', 'malam']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 11) {
- return this.res.A[0]; // pagi
- } else if (h < 15) {
- return this.res.A[1]; // siang
- } else if (h < 19) {
- return this.res.A[2]; // sore
- }
- return this.res.A[3]; // malam
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // pagi
- } else if (a < 2) {
- return h >= 11 ? h : h + 12; // siang
- }
- return h + 12; // sore, malam
- }
- }
- });
- return code;
- };
-
- return id;
-
-}));
diff --git a/locale/it.d.ts b/locale/it.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/it.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/it.js b/locale/it.js
deleted file mode 100644
index 455f5f6..0000000
--- a/locale/it.js
+++ /dev/null
@@ -1,31 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.it = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Italian (it)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var it = function (date) {
- var code = 'it';
-
- date.locale(code, {
- res: {
- MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],
- MMM: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
- dddd: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
- ddd: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
- dd: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
- A: ['di mattina', 'di pomerrigio']
- }
- });
- return code;
- };
-
- return it;
-
-}));
diff --git a/locale/ja.d.ts b/locale/ja.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/ja.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/ja.js b/locale/ja.js
deleted file mode 100644
index c909dd2..0000000
--- a/locale/ja.js
+++ /dev/null
@@ -1,39 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ja = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Japanese (ja)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var ja = function (date) {
- var code = 'ja';
-
- date.locale(code, {
- res: {
- MMMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
- ddd: ['日', '月', '火', '水', '木', '金', '土'],
- dd: ['日', '月', '火', '水', '木', '金', '土'],
- A: ['午前', '午後']
- },
- formatter: {
- hh: function (d) {
- return ('0' + d.getHours() % 12).slice(-2);
- },
- h: function (d) {
- return d.getHours() % 12;
- }
- }
- });
- return code;
- };
-
- return ja;
-
-}));
diff --git a/locale/jv.d.ts b/locale/jv.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/jv.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/jv.js b/locale/jv.js
deleted file mode 100644
index 91ec0ba..0000000
--- a/locale/jv.js
+++ /dev/null
@@ -1,54 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.jv = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Javanese (jv)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var jv = function (date) {
- var code = 'jv';
-
- date.locale(code, {
- res: {
- MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'],
- dddd: ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'],
- ddd: ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'],
- dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'],
- A: ['enjing', 'siyang', 'sonten', 'ndalu']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 11) {
- return this.res.A[0]; // enjing
- } else if (h < 15) {
- return this.res.A[1]; // siyang
- } else if (h < 19) {
- return this.res.A[2]; // sonten
- }
- return this.res.A[3]; // ndalu
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // enjing
- } else if (a < 2) {
- return h >= 11 ? h : h + 12; // siyang
- }
- return h + 12; // sonten, ndalu
- }
- }
- });
- return code;
- };
-
- return jv;
-
-}));
diff --git a/locale/ko.d.ts b/locale/ko.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/ko.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/ko.js b/locale/ko.js
deleted file mode 100644
index 4c82955..0000000
--- a/locale/ko.js
+++ /dev/null
@@ -1,31 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ko = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Korean (ko)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var ko = function (date) {
- var code = 'ko';
-
- date.locale(code, {
- res: {
- MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- MMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- dddd: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
- ddd: ['일', '월', '화', '수', '목', '금', '토'],
- dd: ['일', '월', '화', '수', '목', '금', '토'],
- A: ['오전', '오후']
- }
- });
- return code;
- };
-
- return ko;
-
-}));
diff --git a/locale/my.d.ts b/locale/my.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/my.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/my.js b/locale/my.js
deleted file mode 100644
index a51ecaf..0000000
--- a/locale/my.js
+++ /dev/null
@@ -1,46 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.my = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Burmese (my)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var my = function (date) {
- var code = 'my';
-
- date.locale(code, {
- res: {
- MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'],
- MMM: ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'],
- dddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
- ddd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'],
- dd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ']
- },
- formatter: {
- post: function (str) {
- var num = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '၀': 0, '၁': 1, '၂': 2, '၃': 3, '၄': 4, '၅': 5, '၆': 6, '၇': 7, '၈': 8, '၉': 9 };
- return str.replace(/[၀၁၂၃၄၅၆၇၈၉]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
- };
-
- return my;
-
-}));
diff --git a/locale/nl.d.ts b/locale/nl.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/nl.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/nl.js b/locale/nl.js
deleted file mode 100644
index 577a269..0000000
--- a/locale/nl.js
+++ /dev/null
@@ -1,45 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.nl = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Dutch (nl)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var nl = function (date) {
- var code = 'nl';
-
- date.locale(code, {
- res: {
- MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
- MMM: [
- ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
- ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
- ],
- dddd: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
- ddd: ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'],
- dd: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za']
- },
- formatter: {
- MMM: function (d, formatString) {
- return this.res.MMM[/-MMM-/.test(formatString) | 0][d.getMonth()];
- }
- },
- parser: {
- MMM: function (str, formatString) {
- var result = this.find(this.res.MMM[/-MMM-/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
- };
-
- return nl;
-
-}));
diff --git a/locale/pa-in.d.ts b/locale/pa-in.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/pa-in.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/pa-in.js b/locale/pa-in.js
deleted file mode 100644
index 75acdd7..0000000
--- a/locale/pa-in.js
+++ /dev/null
@@ -1,70 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale["pa-in"] = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Punjabi (pa-in)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var pa_in = function (date) {
- var code = 'pa-in';
-
- date.locale(code, {
- res: {
- MMMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- MMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- dddd: ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'],
- ddd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- dd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- A: ['ਰਾਤ', 'ਸਵੇਰ', 'ਦੁਪਹਿਰ', 'ਸ਼ਾਮ']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ਰਾਤ
- } else if (h < 10) {
- return this.res.A[1]; // ਸਵੇਰ
- } else if (h < 17) {
- return this.res.A[2]; // ਦੁਪਹਿਰ
- } else if (h < 20) {
- return this.res.A[3]; // ਸ਼ਾਮ
- }
- return this.res.A[0]; // ਰਾਤ
- },
- post: function (str) {
- var num = ['੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // ਰਾਤ
- } else if (a < 2) {
- return h; // ਸਵੇਰ
- } else if (a < 3) {
- return h >= 10 ? h : h + 12; // ਦੁਪਹਿਰ
- }
- return h + 12; // ਸ਼ਾਮ
- },
- pre: function (str) {
- var map = { '੦': 0, '੧': 1, '੨': 2, '੩': 3, '੪': 4, '੫': 5, '੬': 6, '੭': 7, '੮': 8, '੯': 9 };
- return str.replace(/[੦੧੨੩੪੫੬੭੮੯]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
- };
-
- return pa_in;
-
-}));
diff --git a/locale/pl.d.ts b/locale/pl.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/pl.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/pl.js b/locale/pl.js
deleted file mode 100644
index 22500d5..0000000
--- a/locale/pl.js
+++ /dev/null
@@ -1,45 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.pl = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Polish (pl)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var pl = function (date) {
- var code = 'pl';
-
- date.locale(code, {
- res: {
- MMMM: [
- ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'],
- ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia']
- ],
- MMM: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
- dddd: ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'],
- ddd: ['nie', 'pon', 'wt', 'śr', 'czw', 'pt', 'sb'],
- dd: ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So']
- },
- formatter: {
- MMMM: function (d, formatString) {
- return this.res.MMMM[/D MMMM/.test(formatString) | 0][d.getMonth()];
- }
- },
- parser: {
- MMMM: function (str, formatString) {
- var result = this.find(this.res.MMMM[/D MMMM/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
- };
-
- return pl;
-
-}));
diff --git a/locale/pt.d.ts b/locale/pt.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/pt.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/pt.js b/locale/pt.js
deleted file mode 100644
index d859696..0000000
--- a/locale/pt.js
+++ /dev/null
@@ -1,52 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.pt = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Portuguese (pt)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var pt = function (date) {
- var code = 'pt';
-
- date.locale(code, {
- res: {
- MMMM: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
- MMM: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
- dddd: ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado'],
- ddd: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
- dd: ['Dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sáb'],
- A: ['da madrugada', 'da manhã', 'da tarde', 'da noite']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 5) {
- return this.res.A[0]; // da madrugada
- } else if (h < 12) {
- return this.res.A[1]; // da manhã
- } else if (h < 19) {
- return this.res.A[2]; // da tarde
- }
- return this.res.A[3]; // da noite
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // da madrugada, da manhã
- }
- return h > 11 ? h : h + 12; // da tarde, da noite
- }
- }
- });
- return code;
- };
-
- return pt;
-
-}));
diff --git a/locale/ro.d.ts b/locale/ro.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/ro.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/ro.js b/locale/ro.js
deleted file mode 100644
index cf41bb2..0000000
--- a/locale/ro.js
+++ /dev/null
@@ -1,30 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ro = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Romanian (ro)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var ro = function (date) {
- var code = 'ro';
-
- date.locale(code, {
- res: {
- MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'],
- MMM: ['ian.', 'febr.', 'mart.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'],
- dddd: ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'],
- ddd: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'],
- dd: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ']
- }
- });
- return code;
- };
-
- return ro;
-
-}));
diff --git a/locale/ru.d.ts b/locale/ru.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/ru.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/ru.js b/locale/ru.js
deleted file mode 100644
index 4502e29..0000000
--- a/locale/ru.js
+++ /dev/null
@@ -1,52 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ru = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Russian (ru)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var ru = function (date) {
- var code = 'ru';
-
- date.locale(code, {
- res: {
- MMMM: ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'],
- MMM: ['янв', 'фев', 'мар', 'апр', 'мая', 'июня', 'июля', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
- ddd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- dd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- A: ['ночи', 'утра', 'дня', 'вечера']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ночи
- } else if (h < 12) {
- return this.res.A[1]; // утра
- } else if (h < 17) {
- return this.res.A[2]; // дня
- }
- return this.res.A[3]; // вечера
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // ночи, утра
- }
- return h > 11 ? h : h + 12; // дня, вечера
- }
- }
- });
- return code;
- };
-
- return ru;
-
-}));
diff --git a/locale/rw.d.ts b/locale/rw.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/rw.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/rw.js b/locale/rw.js
deleted file mode 100644
index 2aec890..0000000
--- a/locale/rw.js
+++ /dev/null
@@ -1,30 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.rw = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Kinyarwanda (rw)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var rw = function (date) {
- var code = 'rw';
-
- date.locale(code, {
- res: {
- MMMM: ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'],
- MMM: ['Mtr', 'Gas', 'Wer', 'Mta', 'Gic', 'Kmn', 'Nyk', 'Knm', 'Nze', 'Ukw', 'Ugu', 'Uku'],
- dddd: ['Ku cyumweru', 'Ku wambere', 'Ku wakabiri', 'Ku wagatatu', 'Ku wakane', 'Ku wagatanu', 'Ku wagatandatu'],
- ddd: ['Cyu', 'Mbe', 'Kbr', 'Gtt', 'Kne', 'Gtn', 'Gtd'],
- dd: ['Cy', 'Mb', 'Kb', 'Gt', 'Kn', 'Gn', 'Gd']
- }
- });
- return code;
- };
-
- return rw;
-
-}));
diff --git a/locale/sr.d.ts b/locale/sr.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/sr.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/sr.js b/locale/sr.js
deleted file mode 100644
index 5097f2f..0000000
--- a/locale/sr.js
+++ /dev/null
@@ -1,30 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.sr = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Serbian (sr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var sr = function (date) {
- var code = 'sr';
-
- date.locale(code, {
- res: {
- MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
- MMM: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
- dddd: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
- ddd: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
- dd: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su']
- }
- });
- return code;
- };
-
- return sr;
-
-}));
diff --git a/locale/sv.d.ts b/locale/sv.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/sv.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/sv.js b/locale/sv.js
deleted file mode 100644
index e7e3ac8..0000000
--- a/locale/sv.js
+++ /dev/null
@@ -1,30 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.sv = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Swedish (SV)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var sv = function (date) {
- var code = 'sv';
-
- date.locale(code, {
- res: {
- MMMM: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
- MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
- ddd: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
- dd: ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö']
- }
- });
- return code;
- };
-
- return sv;
-
-}));
diff --git a/locale/th.d.ts b/locale/th.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/th.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/th.js b/locale/th.js
deleted file mode 100644
index 7a15892..0000000
--- a/locale/th.js
+++ /dev/null
@@ -1,31 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.th = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Thai (th)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var th = function (date) {
- var code = 'th';
-
- date.locale(code, {
- res: {
- MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'],
- MMM: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'],
- dddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'],
- ddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'],
- dd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
- A: ['ก่อนเที่ยง', 'หลังเที่ยง']
- }
- });
- return code;
- };
-
- return th;
-
-}));
diff --git a/locale/tr.d.ts b/locale/tr.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/tr.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/tr.js b/locale/tr.js
deleted file mode 100644
index bb4a747..0000000
--- a/locale/tr.js
+++ /dev/null
@@ -1,30 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.tr = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Turkish (tr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var tr = function (date) {
- var code = 'tr';
-
- date.locale(code, {
- res: {
- MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
- MMM: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
- dddd: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
- ddd: ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'],
- dd: ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct']
- }
- });
- return code;
- };
-
- return tr;
-
-}));
diff --git a/locale/uk.d.ts b/locale/uk.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/uk.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/uk.js b/locale/uk.js
deleted file mode 100644
index a914a97..0000000
--- a/locale/uk.js
+++ /dev/null
@@ -1,65 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.uk = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Ukrainian (uk)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var uk = function (date) {
- var code = 'uk';
-
- date.locale(code, {
- res: {
- MMMM: ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'],
- MMM: ['січ', 'лют', 'бер', 'квіт', 'трав', 'черв', 'лип', 'серп', 'вер', 'жовт', 'лист', 'груд'],
- dddd: [
- ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'],
- ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'],
- ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи']
- ],
- ddd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- dd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- A: ['ночі', 'ранку', 'дня', 'вечора']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ночі
- } else if (h < 12) {
- return this.res.A[1]; // ранку
- } else if (h < 17) {
- return this.res.A[2]; // дня
- }
- return this.res.A[3]; // вечора
- },
- dddd: function (d, formatString) {
- var type = 0;
- if (/(\[[ВвУу]\]) ?dddd/.test(formatString)) {
- type = 1;
- } else if (/\[?(?:минулої|наступної)? ?\] ?dddd/.test(formatString)) {
- type = 2;
- }
- return this.res.dddd[type][d.getDay()];
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // ночі, ранку
- }
- return h > 11 ? h : h + 12; // дня, вечора
- }
- }
- });
- return code;
- };
-
- return uk;
-
-}));
diff --git a/locale/uz.d.ts b/locale/uz.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/uz.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/uz.js b/locale/uz.js
deleted file mode 100644
index a3851cc..0000000
--- a/locale/uz.js
+++ /dev/null
@@ -1,30 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.uz = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Uzbek (uz)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var uz = function (date) {
- var code = 'uz';
-
- date.locale(code, {
- res: {
- MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'],
- MMM: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd: ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'],
- ddd: ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'],
- dd: ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша']
- }
- });
- return code;
- };
-
- return uz;
-
-}));
diff --git a/locale/vi.d.ts b/locale/vi.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/vi.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/vi.js b/locale/vi.js
deleted file mode 100644
index 1eb2237..0000000
--- a/locale/vi.js
+++ /dev/null
@@ -1,31 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.vi = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Vietnamese (vi)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var vi = function (date) {
- var code = 'vi';
-
- date.locale(code, {
- res: {
- MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'],
- MMM: ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'],
- dddd: ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'],
- ddd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- dd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- A: ['sa', 'ch']
- }
- });
- return code;
- };
-
- return vi;
-
-}));
diff --git a/locale/zh-cn.d.ts b/locale/zh-cn.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/zh-cn.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/zh-cn.js b/locale/zh-cn.js
deleted file mode 100644
index ef92cca..0000000
--- a/locale/zh-cn.js
+++ /dev/null
@@ -1,56 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale["zh-cn"] = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Chinese (zh-cn)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var zh_cn = function (date) {
- var code = 'zh-cn';
-
- date.locale(code, {
- res: {
- MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd: ['日', '一', '二', '三', '四', '五', '六'],
- A: ['凌晨', '早上', '上午', '中午', '下午', '晚上']
- },
- formatter: {
- A: function (d) {
- var hm = d.getHours() * 100 + d.getMinutes();
- if (hm < 600) {
- return this.res.A[0]; // 凌晨
- } else if (hm < 900) {
- return this.res.A[1]; // 早上
- } else if (hm < 1130) {
- return this.res.A[2]; // 上午
- } else if (hm < 1230) {
- return this.res.A[3]; // 中午
- } else if (hm < 1800) {
- return this.res.A[4]; // 下午
- }
- return this.res.A[5]; // 晚上
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 4) {
- return h; // 凌晨, 早上, 上午, 中午
- }
- return h > 11 ? h : h + 12; // 下午, 晚上
- }
- }
- });
- return code;
- };
-
- return zh_cn;
-
-}));
diff --git a/locale/zh-tw.d.ts b/locale/zh-tw.d.ts
deleted file mode 100644
index 6047f09..0000000
--- a/locale/zh-tw.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (date: unknown): string;
diff --git a/locale/zh-tw.js b/locale/zh-tw.js
deleted file mode 100644
index 78f9308..0000000
--- a/locale/zh-tw.js
+++ /dev/null
@@ -1,54 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale["zh-tw"] = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js locale configuration
- * @preserve Chinese (zh-tw)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
- var zh_tw = function (date) {
- var code = 'zh-tw';
-
- date.locale(code, {
- res: {
- MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd: ['日', '一', '二', '三', '四', '五', '六'],
- A: ['早上', '上午', '中午', '下午', '晚上']
- },
- formatter: {
- A: function (d) {
- var hm = d.getHours() * 100 + d.getMinutes();
- if (hm < 900) {
- return this.res.A[0]; // 早上
- } else if (hm < 1130) {
- return this.res.A[1]; // 上午
- } else if (hm < 1230) {
- return this.res.A[2]; // 中午
- } else if (hm < 1800) {
- return this.res.A[3]; // 下午
- }
- return this.res.A[4]; // 晚上
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 3) {
- return h; // 早上, 上午, 中午
- }
- return h > 11 ? h : h + 12; // 下午, 晚上
- }
- }
- });
- return code;
- };
-
- return zh_tw;
-
-}));
diff --git a/package-lock.json b/package-lock.json
index 1e2a2f0..a01c453 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,208 +1,227 @@
{
"name": "date-and-time",
- "version": "3.6.0",
- "lockfileVersion": 2,
+ "version": "4.0.0",
+ "lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "date-and-time",
- "version": "3.6.0",
+ "version": "4.0.0",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
- "expect.js": "^0.3.1",
- "mocha": "^10.7.3",
- "rollup": "^4.22.5",
- "tsd": "^0.31.2"
+ "@rollup/plugin-typescript": "^12.1.4",
+ "@types/node": "^24.1.0",
+ "@vitest/coverage-v8": "^3.2.4",
+ "eslint": "^9.32.0",
+ "glob": "^11.0.3",
+ "globals": "^16.3.0",
+ "jiti": "^2.5.1",
+ "prettier": "^3.6.2",
+ "rollup": "^4.46.1",
+ "rollup-plugin-dts": "^6.2.1",
+ "rollup-plugin-esbuild": "^6.2.1",
+ "tsx": "^4.20.3",
+ "typescript-eslint": "^8.38.0",
+ "vitest": "^3.2.4"
+ }
+ },
+ "node_modules/@ampproject/remapping": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
+ "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ },
+ "engines": {
+ "node": ">=6.0.0"
}
},
"node_modules/@babel/code-frame": {
- "version": "7.16.7",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz",
- "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==",
+ "version": "7.26.2",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz",
+ "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==",
"dev": true,
+ "license": "MIT",
+ "optional": true,
"dependencies": {
- "@babel/highlight": "^7.16.7"
+ "@babel/helper-validator-identifier": "^7.25.9",
+ "js-tokens": "^4.0.0",
+ "picocolors": "^1.0.0"
},
"engines": {
"node": ">=6.9.0"
}
},
- "node_modules/@babel/helper-validator-identifier": {
- "version": "7.16.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz",
- "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==",
+ "node_modules/@babel/helper-string-parser": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
+ "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
- "node_modules/@babel/highlight": {
- "version": "7.16.10",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz",
- "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==",
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
+ "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
"dev": true,
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.16.7",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- },
+ "license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
- "node_modules/@jest/schemas": {
- "version": "29.4.3",
- "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.3.tgz",
- "integrity": "sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==",
+ "node_modules/@babel/parser": {
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.0.tgz",
+ "integrity": "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "@sinclair/typebox": "^0.25.16"
+ "@babel/types": "^7.28.0"
+ },
+ "bin": {
+ "parser": "bin/babel-parser.js"
},
"engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ "node": ">=6.0.0"
}
},
- "node_modules/@jridgewell/gen-mapping": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
- "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
+ "node_modules/@babel/types": {
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.0.tgz",
+ "integrity": "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "@jridgewell/set-array": "^1.0.1",
- "@jridgewell/sourcemap-codec": "^1.4.10",
- "@jridgewell/trace-mapping": "^0.3.9"
+ "@babel/helper-string-parser": "^7.27.1",
+ "@babel/helper-validator-identifier": "^7.27.1"
},
"engines": {
- "node": ">=6.0.0"
+ "node": ">=6.9.0"
}
},
- "node_modules/@jridgewell/resolve-uri": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
- "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
+ "node_modules/@bcoe/v8-coverage": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz",
+ "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=6.0.0"
+ "node": ">=18"
}
},
- "node_modules/@jridgewell/set-array": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
- "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.2.tgz",
+ "integrity": "sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag==",
+ "cpu": [
+ "ppc64"
+ ],
"dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
"engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/@jridgewell/source-map": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz",
- "integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==",
- "dev": true,
- "dependencies": {
- "@jridgewell/gen-mapping": "^0.3.0",
- "@jridgewell/trace-mapping": "^0.3.9"
- }
- },
- "node_modules/@jridgewell/sourcemap-codec": {
- "version": "1.4.15",
- "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
- "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
- "dev": true
- },
- "node_modules/@jridgewell/trace-mapping": {
- "version": "0.3.18",
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz",
- "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==",
- "dev": true,
- "dependencies": {
- "@jridgewell/resolve-uri": "3.1.0",
- "@jridgewell/sourcemap-codec": "1.4.14"
+ "node": ">=18"
}
},
- "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": {
- "version": "1.4.14",
- "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
- "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
- "dev": true
- },
- "node_modules/@nodelib/fs.scandir": {
- "version": "2.1.5",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
- "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.2.tgz",
+ "integrity": "sha512-NQhH7jFstVY5x8CKbcfa166GoV0EFkaPkCKBQkdPJFvo5u+nGXLEH/ooniLb3QI8Fk58YAx7nsPLozUWfCBOJA==",
+ "cpu": [
+ "arm"
+ ],
"dev": true,
- "dependencies": {
- "@nodelib/fs.stat": "2.0.5",
- "run-parallel": "^1.1.9"
- },
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
"engines": {
- "node": ">= 8"
+ "node": ">=18"
}
},
- "node_modules/@nodelib/fs.stat": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
- "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.2.tgz",
+ "integrity": "sha512-5ZAX5xOmTligeBaeNEPnPaeEuah53Id2tX4c2CVP3JaROTH+j4fnfHCkr1PjXMd78hMst+TlkfKcW/DlTq0i4w==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
"engines": {
- "node": ">= 8"
+ "node": ">=18"
}
},
- "node_modules/@nodelib/fs.walk": {
- "version": "1.2.8",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
- "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.2.tgz",
+ "integrity": "sha512-Ffcx+nnma8Sge4jzddPHCZVRvIfQ0kMsUsCMcJRHkGJ1cDmhe4SsrYIjLUKn1xpHZybmOqCWwB0zQvsjdEHtkg==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
- "dependencies": {
- "@nodelib/fs.scandir": "2.1.5",
- "fastq": "^1.6.0"
- },
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
"engines": {
- "node": ">= 8"
+ "node": ">=18"
}
},
- "node_modules/@rollup/plugin-terser": {
- "version": "0.4.4",
- "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz",
- "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==",
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.2.tgz",
+ "integrity": "sha512-MpM6LUVTXAzOvN4KbjzU/q5smzryuoNjlriAIx+06RpecwCkL9JpenNzpKd2YMzLJFOdPqBpuub6eVRP5IgiSA==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
"license": "MIT",
- "dependencies": {
- "serialize-javascript": "^6.0.1",
- "smob": "^1.0.0",
- "terser": "^5.17.4"
- },
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
"engines": {
- "node": ">=14.0.0"
- },
- "peerDependencies": {
- "rollup": "^2.0.0||^3.0.0||^4.0.0"
- },
- "peerDependenciesMeta": {
- "rollup": {
- "optional": true
- }
+ "node": ">=18"
}
},
- "node_modules/@rollup/rollup-android-arm-eabi": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.5.tgz",
- "integrity": "sha512-SU5cvamg0Eyu/F+kLeMXS7GoahL+OoizlclVFX3l5Ql6yNlywJJ0OuqTzUx0v+aHhPHEB/56CT06GQrRrGNYww==",
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.2.tgz",
+ "integrity": "sha512-5eRPrTX7wFyuWe8FqEFPG2cU0+butQQVNcT4sVipqjLYQjjh8a8+vUTfgBKM88ObB85ahsnTwF7PSIt6PG+QkA==",
"cpu": [
- "arm"
+ "x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
- "android"
- ]
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-android-arm64": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.5.tgz",
- "integrity": "sha512-S4pit5BP6E5R5C8S6tgU/drvgjtYW76FBuG6+ibG3tMvlD1h9LHVF9KmlmaUBQ8Obou7hEyS+0w+IR/VtxwNMQ==",
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.2.tgz",
+ "integrity": "sha512-mLwm4vXKiQ2UTSX4+ImyiPdiHjiZhIaE9QvC7sw0tZ6HoNMjYAqQpGyui5VRIi5sGd+uWq940gdCbY3VLvsO1w==",
"cpu": [
"arm64"
],
@@ -210,97 +229,118 @@
"license": "MIT",
"optional": true,
"os": [
- "android"
- ]
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-darwin-arm64": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.5.tgz",
- "integrity": "sha512-250ZGg4ipTL0TGvLlfACkIxS9+KLtIbn7BCZjsZj88zSg2Lvu3Xdw6dhAhfe/FjjXPVNCtcSp+WZjVsD3a/Zlw==",
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.2.tgz",
+ "integrity": "sha512-6qyyn6TjayJSwGpm8J9QYYGQcRgc90nmfdUb0O7pp1s4lTY+9D0H9O02v5JqGApUyiHOtkz6+1hZNvNtEhbwRQ==",
"cpu": [
- "arm64"
+ "x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
- "darwin"
- ]
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-darwin-x64": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.5.tgz",
- "integrity": "sha512-D8brJEFg5D+QxFcW6jYANu+Rr9SlKtTenmsX5hOSzNYVrK5oLAEMTUgKWYJP+wdKyCdeSwnapLsn+OVRFycuQg==",
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.2.tgz",
+ "integrity": "sha512-UHBRgJcmjJv5oeQF8EpTRZs/1knq6loLxTsjc3nxO9eXAPDLcWW55flrMVc97qFPbmZP31ta1AZVUKQzKTzb0g==",
"cpu": [
- "x64"
+ "arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
- "darwin"
- ]
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.5.tgz",
- "integrity": "sha512-PNqXYmdNFyWNg0ma5LdY8wP+eQfdvyaBAojAXgO7/gs0Q/6TQJVXAXe8gwW9URjbS0YAammur0fynYGiWsKlXw==",
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.2.tgz",
+ "integrity": "sha512-gq/sjLsOyMT19I8obBISvhoYiZIAaGF8JpeXu1u8yPv8BE5HlWYobmlsfijFIZ9hIVGYkbdFhEqC0NvM4kNO0g==",
"cpu": [
- "arm"
+ "arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
- ]
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-arm-musleabihf": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.5.tgz",
- "integrity": "sha512-kSSCZOKz3HqlrEuwKd9TYv7vxPYD77vHSUvM2y0YaTGnFc8AdI5TTQRrM1yIp3tXCKrSL9A7JLoILjtad5t8pQ==",
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.2.tgz",
+ "integrity": "sha512-bBYCv9obgW2cBP+2ZWfjYTU+f5cxRoGGQ5SeDbYdFCAZpYWrfjjfYwvUpP8MlKbP0nwZ5gyOU/0aUzZ5HWPuvQ==",
"cpu": [
- "arm"
+ "ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
- ]
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-arm64-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.5.tgz",
- "integrity": "sha512-oTXQeJHRbOnwRnRffb6bmqmUugz0glXaPyspp4gbQOPVApdpRrY/j7KP3lr7M8kTfQTyrBUzFjj5EuHAhqH4/w==",
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.2.tgz",
+ "integrity": "sha512-SHNGiKtvnU2dBlM5D8CXRFdd+6etgZ9dXfaPCeJtz+37PIUlixvlIhI23L5khKXs3DIzAn9V8v+qb1TRKrgT5w==",
"cpu": [
- "arm64"
+ "loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
- ]
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-arm64-musl": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.5.tgz",
- "integrity": "sha512-qnOTIIs6tIGFKCHdhYitgC2XQ2X25InIbZFor5wh+mALH84qnFHvc+vmWUpyX97B0hNvwNUL4B+MB8vJvH65Fw==",
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.2.tgz",
+ "integrity": "sha512-hDDRlzE6rPeoj+5fsADqdUZl1OzqDYow4TB4Y/3PlKBD0ph1e6uPHzIQcv2Z65u2K0kpeByIyAjCmjn1hJgG0Q==",
"cpu": [
- "arm64"
+ "mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
- ]
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.5.tgz",
- "integrity": "sha512-TMYu+DUdNlgBXING13rHSfUc3Ky5nLPbWs4bFnT+R6Vu3OvXkTkixvvBKk8uO4MT5Ab6lC3U7x8S8El2q5o56w==",
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.2.tgz",
+ "integrity": "sha512-tsHu2RRSWzipmUi9UBDEzc0nLc4HtpZEI5Ba+Omms5456x5WaNuiG3u7xh5AO6sipnJ9r4cRWQB2tUjPyIkc6g==",
"cpu": [
"ppc64"
],
@@ -309,12 +349,15 @@
"optional": true,
"os": [
"linux"
- ]
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-riscv64-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.5.tgz",
- "integrity": "sha512-PTQq1Kz22ZRvuhr3uURH+U/Q/a0pbxJoICGSprNLAoBEkyD3Sh9qP5I0Asn0y0wejXQBbsVMRZRxlbGFD9OK4A==",
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.2.tgz",
+ "integrity": "sha512-k4LtpgV7NJQOml/10uPU0s4SAXGnowi5qBSjaLWMojNCUICNu7TshqHLAEbkBdAszL5TabfvQ48kK84hyFzjnw==",
"cpu": [
"riscv64"
],
@@ -323,12 +366,15 @@
"optional": true,
"os": [
"linux"
- ]
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-s390x-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.5.tgz",
- "integrity": "sha512-bR5nCojtpuMss6TDEmf/jnBnzlo+6n1UhgwqUvRoe4VIotC7FG1IKkyJbwsT7JDsF2jxR+NTnuOwiGv0hLyDoQ==",
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.2.tgz",
+ "integrity": "sha512-GRa4IshOdvKY7M/rDpRR3gkiTNp34M0eLTaC1a08gNrh4u488aPhuZOCpkF6+2wl3zAN7L7XIpOFBhnaE3/Q8Q==",
"cpu": [
"s390x"
],
@@ -337,12 +383,15 @@
"optional": true,
"os": [
"linux"
- ]
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-x64-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.5.tgz",
- "integrity": "sha512-N0jPPhHjGShcB9/XXZQWuWBKZQnC1F36Ce3sDqWpujsGjDz/CQtOL9LgTrJ+rJC8MJeesMWrMWVLKKNR/tMOCA==",
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.2.tgz",
+ "integrity": "sha512-QInHERlqpTTZ4FRB0fROQWXcYRD64lAoiegezDunLpalZMjcUcld3YzZmVJ2H/Cp0wJRZ8Xtjtj0cEHhYc/uUg==",
"cpu": [
"x64"
],
@@ -351,54 +400,66 @@
"optional": true,
"os": [
"linux"
- ]
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-linux-x64-musl": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.5.tgz",
- "integrity": "sha512-uBa2e28ohzNNwjr6Uxm4XyaA1M/8aTgfF2T7UIlElLaeXkgpmIJ2EitVNQxjO9xLLLy60YqAgKn/AqSpCUkE9g==",
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.2.tgz",
+ "integrity": "sha512-talAIBoY5M8vHc6EeI2WW9d/CkiO9MQJ0IOWX8hrLhxGbro/vBXJvaQXefW2cP0z0nQVTdQ/eNyGFV1GSKrxfw==",
"cpu": [
- "x64"
+ "arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
- "linux"
- ]
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-win32-arm64-msvc": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.5.tgz",
- "integrity": "sha512-RXT8S1HP8AFN/Kr3tg4fuYrNxZ/pZf1HemC5Tsddc6HzgGnJm0+Lh5rAHJkDuW3StI0ynNXukidROMXYl6ew8w==",
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.2.tgz",
+ "integrity": "sha512-voZT9Z+tpOxrvfKFyfDYPc4DO4rk06qamv1a/fkuzHpiVBMOhpjK+vBmWM8J1eiB3OLSMFYNaOaBNLXGChf5tg==",
"cpu": [
- "arm64"
+ "x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
- "win32"
- ]
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-win32-ia32-msvc": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.5.tgz",
- "integrity": "sha512-ElTYOh50InL8kzyUD6XsnPit7jYCKrphmddKAe1/Ytt74apOxDq5YEcbsiKs0fR3vff3jEneMM+3I7jbqaMyBg==",
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.2.tgz",
+ "integrity": "sha512-dcXYOC6NXOqcykeDlwId9kB6OkPUxOEqU+rkrYVqJbK2hagWOMrsTGsMr8+rW02M+d5Op5NNlgMmjzecaRf7Tg==",
"cpu": [
- "ia32"
+ "arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
- "win32"
- ]
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@rollup/rollup-win32-x64-msvc": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.5.tgz",
- "integrity": "sha512-+lvL/4mQxSV8MukpkKyyvfwhH266COcWlXE/1qxwN08ajovta3459zrjLghYMgDerlzNwLAcFpvU+WWE5y6nAQ==",
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.2.tgz",
+ "integrity": "sha512-t/TkWwahkH0Tsgoq1Ju7QfgGhArkGLkF1uYz8nQS/PPFlXbP5YgRpqQR3ARRiC2iXoLTWFxc6DJMSK10dVXluw==",
"cpu": [
"x64"
],
@@ -406,1387 +467,1702 @@
"license": "MIT",
"optional": true,
"os": [
- "win32"
- ]
- },
- "node_modules/@sinclair/typebox": {
- "version": "0.25.24",
- "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz",
- "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==",
- "dev": true
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
},
- "node_modules/@tsd/typescript": {
- "version": "5.4.5",
- "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.4.5.tgz",
- "integrity": "sha512-saiCxzHRhUrRxQV2JhH580aQUZiKQUXI38FcAcikcfOomAil4G4lxT0RfrrKywoAYP/rqAdYXYmNRLppcd+hQQ==",
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.2.tgz",
+ "integrity": "sha512-cfZH1co2+imVdWCjd+D1gf9NjkchVhhdpgb1q5y6Hcv9TP6Zi9ZG/beI3ig8TvwT9lH9dlxLq5MQBBgwuj4xvA==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
"engines": {
- "node": ">=14.17"
+ "node": ">=18"
}
},
- "node_modules/@types/eslint": {
- "version": "7.29.0",
- "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz",
- "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==",
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.2.tgz",
+ "integrity": "sha512-7Loyjh+D/Nx/sOTzV8vfbB3GJuHdOQyrOryFdZvPHLf42Tk9ivBU5Aedi7iyX+x6rbn2Mh68T4qq1SDqJBQO5Q==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
- "dependencies": {
- "@types/estree": "*",
- "@types/json-schema": "*"
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
}
},
- "node_modules/@types/estree": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
- "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/@types/json-schema": {
- "version": "7.0.9",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz",
- "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==",
- "dev": true
- },
- "node_modules/@types/minimist": {
- "version": "1.2.2",
- "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz",
- "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==",
- "dev": true
- },
- "node_modules/@types/normalize-package-data": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz",
- "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
- "dev": true
- },
- "node_modules/acorn": {
- "version": "8.8.2",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
- "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.2.tgz",
+ "integrity": "sha512-WRJgsz9un0nqZJ4MfhabxaD9Ft8KioqU3JMinOTvobbX6MOSUigSBlogP8QB3uxpJDsFS6yN+3FDBdqE5lg9kg==",
+ "cpu": [
+ "ia32"
+ ],
"dev": true,
- "bin": {
- "acorn": "bin/acorn"
- },
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
"engines": {
- "node": ">=0.4.0"
+ "node": ">=18"
}
},
- "node_modules/ansi-colors": {
- "version": "4.1.3",
- "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
- "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.2.tgz",
+ "integrity": "sha512-kM3HKb16VIXZyIeVrM1ygYmZBKybX8N4p754bw390wGO3Tf2j4L2/WYL+4suWujpgf6GBYs3jv7TyUivdd05JA==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
"license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
"engines": {
- "node": ">=6"
+ "node": ">=18"
}
},
- "node_modules/ansi-escapes": {
- "version": "4.3.2",
- "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
- "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
+ "node_modules/@eslint-community/eslint-utils": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
+ "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "type-fest": "^0.21.3"
+ "eslint-visitor-keys": "^3.4.3"
},
"engines": {
- "node": ">=8"
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "url": "https://opencollective.com/eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
}
},
- "node_modules/ansi-regex": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
"dev": true,
"engines": {
- "node": ">=8"
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
}
},
- "node_modules/ansi-styles": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
- "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "node_modules/@eslint-community/regexpp": {
+ "version": "4.12.1",
+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz",
+ "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==",
"dev": true,
- "dependencies": {
- "color-convert": "^1.9.0"
- },
+ "license": "MIT",
"engines": {
- "node": ">=4"
+ "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
}
},
- "node_modules/anymatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
- "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
+ "node_modules/@eslint/config-array": {
+ "version": "0.21.0",
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz",
+ "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
- "normalize-path": "^3.0.0",
- "picomatch": "^2.0.4"
+ "@eslint/object-schema": "^2.1.6",
+ "debug": "^4.3.1",
+ "minimatch": "^3.1.2"
},
"engines": {
- "node": ">= 8"
- }
- },
- "node_modules/argparse": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
- "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
- "dev": true
- },
- "node_modules/array-union": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
- "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
- "dev": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/arrify": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
- "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
- "node_modules/balanced-match": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
- "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
- "dev": true
- },
- "node_modules/binary-extensions": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
- "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "node_modules/@eslint/config-helpers": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.0.tgz",
+ "integrity": "sha512-ViuymvFmcJi04qdZeDc2whTHryouGcDlaxPqarTD0ZE10ISpxGUVZGZDx4w01upyIynL3iu6IXH2bS1NhclQMw==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
- "node": ">=8"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
- "node_modules/brace-expansion": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
- "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+ "node_modules/@eslint/core": {
+ "version": "0.15.1",
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.1.tgz",
+ "integrity": "sha512-bkOp+iumZCCbt1K1CmWf0R9pM5yKpDv+ZXtvSyQpudrI9kuFLp+bM2WOPXImuD/ceQuaa8f5pj93Y7zyECIGNA==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
- "balanced-match": "^1.0.0"
+ "@types/json-schema": "^7.0.15"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
- "node_modules/braces": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
- "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "node_modules/@eslint/eslintrc": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz",
+ "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "fill-range": "^7.1.1"
+ "ajv": "^6.12.4",
+ "debug": "^4.3.2",
+ "espree": "^10.0.1",
+ "globals": "^14.0.0",
+ "ignore": "^5.2.0",
+ "import-fresh": "^3.2.1",
+ "js-yaml": "^4.1.0",
+ "minimatch": "^3.1.2",
+ "strip-json-comments": "^3.1.1"
},
"engines": {
- "node": ">=8"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
}
},
- "node_modules/browser-stdout": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
- "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
- "dev": true
- },
- "node_modules/buffer-from": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
- "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
- "dev": true
- },
- "node_modules/camelcase": {
- "version": "6.2.0",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
- "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==",
+ "node_modules/@eslint/eslintrc/node_modules/globals": {
+ "version": "14.0.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
+ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=10"
+ "node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/camelcase-keys": {
- "version": "6.2.2",
- "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz",
- "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==",
+ "node_modules/@eslint/js": {
+ "version": "9.32.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.32.0.tgz",
+ "integrity": "sha512-BBpRFZK3eX6uMLKz8WxFOBIFFcGFJ/g8XuwjTHCqHROSIsopI+ddn/d5Cfh36+7+e5edVS8dbSHnBNhrLEX0zg==",
"dev": true,
- "dependencies": {
- "camelcase": "^5.3.1",
- "map-obj": "^4.0.0",
- "quick-lru": "^4.0.1"
- },
+ "license": "MIT",
"engines": {
- "node": ">=8"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "url": "https://eslint.org/donate"
}
},
- "node_modules/camelcase-keys/node_modules/camelcase": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
- "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "node_modules/@eslint/object-schema": {
+ "version": "2.1.6",
+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz",
+ "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
- "node": ">=6"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
- "node_modules/chalk": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
- "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "node_modules/@eslint/plugin-kit": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.4.tgz",
+ "integrity": "sha512-Ul5l+lHEcw3L5+k8POx6r74mxEYKG5kOb6Xpy2gCRW6zweT6TEhAf8vhxGgjhqrd/VO/Dirhsb+1hNpD1ue9hw==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
- "ansi-styles": "^3.2.1",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^5.3.0"
+ "@eslint/core": "^0.15.1",
+ "levn": "^0.4.1"
},
"engines": {
- "node": ">=4"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
- "node_modules/chokidar": {
- "version": "3.5.3",
- "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
- "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
+ "node_modules/@humanfs/core": {
+ "version": "0.19.1",
+ "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
+ "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==",
"dev": true,
- "funding": [
- {
- "type": "individual",
- "url": "https://paulmillr.com/funding/"
- }
- ],
- "dependencies": {
- "anymatch": "~3.1.2",
- "braces": "~3.0.2",
- "glob-parent": "~5.1.2",
- "is-binary-path": "~2.1.0",
- "is-glob": "~4.0.1",
- "normalize-path": "~3.0.0",
- "readdirp": "~3.6.0"
- },
+ "license": "Apache-2.0",
"engines": {
- "node": ">= 8.10.0"
- },
- "optionalDependencies": {
- "fsevents": "~2.3.2"
- }
- },
- "node_modules/cliui": {
- "version": "7.0.4",
- "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
- "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
- "dev": true,
- "dependencies": {
- "string-width": "^4.2.0",
- "strip-ansi": "^6.0.0",
- "wrap-ansi": "^7.0.0"
- }
- },
- "node_modules/color-convert": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
- "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
- "dev": true,
- "dependencies": {
- "color-name": "1.1.3"
+ "node": ">=18.18.0"
}
},
- "node_modules/color-name": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
- "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
- "dev": true
- },
- "node_modules/commander": {
- "version": "2.20.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
- "dev": true
- },
- "node_modules/debug": {
- "version": "4.3.5",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz",
- "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==",
+ "node_modules/@humanfs/node": {
+ "version": "0.16.6",
+ "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz",
+ "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==",
"dev": true,
- "license": "MIT",
+ "license": "Apache-2.0",
"dependencies": {
- "ms": "2.1.2"
+ "@humanfs/core": "^0.19.1",
+ "@humanwhocodes/retry": "^0.3.0"
},
"engines": {
- "node": ">=6.0"
- },
- "peerDependenciesMeta": {
- "supports-color": {
- "optional": true
- }
+ "node": ">=18.18.0"
}
},
- "node_modules/debug/node_modules/ms": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/decamelize": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
- "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
+ "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz",
+ "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
- "node": ">=10"
+ "node": ">=18.18"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/decamelize-keys": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz",
- "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=",
- "dev": true,
- "dependencies": {
- "decamelize": "^1.1.0",
- "map-obj": "^1.0.0"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/decamelize-keys/node_modules/decamelize": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
- "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
}
},
- "node_modules/decamelize-keys/node_modules/map-obj": {
+ "node_modules/@humanwhocodes/module-importer": {
"version": "1.0.1",
- "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
- "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
"dev": true,
"engines": {
- "node": ">=0.10.0"
+ "node": ">=12.22"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
}
},
- "node_modules/diff": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
- "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
+ "node_modules/@humanwhocodes/retry": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.2.tgz",
+ "integrity": "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==",
"dev": true,
- "license": "BSD-3-Clause",
+ "license": "Apache-2.0",
"engines": {
- "node": ">=0.3.1"
+ "node": ">=18.18"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
}
},
- "node_modules/diff-sequences": {
- "version": "29.4.3",
- "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz",
- "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==",
+ "node_modules/@isaacs/balanced-match": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz",
+ "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ "node": "20 || >=22"
}
},
- "node_modules/dir-glob": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
- "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
+ "node_modules/@isaacs/brace-expansion": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz",
+ "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "path-type": "^4.0.0"
+ "@isaacs/balanced-match": "^4.0.1"
},
"engines": {
- "node": ">=8"
+ "node": "20 || >=22"
}
},
- "node_modules/emoji-regex": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
- "dev": true
- },
- "node_modules/error-ex": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
- "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "node_modules/@isaacs/cliui": {
+ "version": "8.0.2",
+ "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
+ "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
"dev": true,
+ "license": "ISC",
"dependencies": {
- "is-arrayish": "^0.2.1"
+ "string-width": "^5.1.2",
+ "string-width-cjs": "npm:string-width@^4.2.0",
+ "strip-ansi": "^7.0.1",
+ "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
+ "wrap-ansi": "^8.1.0",
+ "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
}
},
- "node_modules/escalade": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
- "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "node_modules/@isaacs/cliui/node_modules/ansi-regex": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
+ "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=6"
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
}
},
- "node_modules/escape-string-regexp": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "node_modules/@isaacs/cliui/node_modules/ansi-styles": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
+ "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=0.8.0"
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
- "node_modules/eslint-formatter-pretty": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-4.1.0.tgz",
- "integrity": "sha512-IsUTtGxF1hrH6lMWiSl1WbGaiP01eT6kzywdY1U+zLc0MP+nwEnUiS9UI8IaOTUhTeQJLlCEWIbXINBH4YJbBQ==",
+ "node_modules/@isaacs/cliui/node_modules/emoji-regex": {
+ "version": "9.2.2",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
+ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@isaacs/cliui/node_modules/string-width": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
+ "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "@types/eslint": "^7.2.13",
- "ansi-escapes": "^4.2.1",
- "chalk": "^4.1.0",
- "eslint-rule-docs": "^1.1.5",
- "log-symbols": "^4.0.0",
- "plur": "^4.0.0",
- "string-width": "^4.2.0",
- "supports-hyperlinks": "^2.0.0"
+ "eastasianwidth": "^0.2.0",
+ "emoji-regex": "^9.2.2",
+ "strip-ansi": "^7.0.1"
},
"engines": {
- "node": ">=10"
+ "node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/eslint-formatter-pretty/node_modules/ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "node_modules/@isaacs/cliui/node_modules/strip-ansi": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
+ "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "color-convert": "^2.0.1"
+ "ansi-regex": "^6.0.1"
},
"engines": {
- "node": ">=8"
+ "node": ">=12"
},
"funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
- "node_modules/eslint-formatter-pretty/node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "node_modules/@isaacs/cliui/node_modules/wrap-ansi": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
+ "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
+ "ansi-styles": "^6.1.0",
+ "string-width": "^5.0.1",
+ "strip-ansi": "^7.0.1"
},
"engines": {
- "node": ">=10"
+ "node": ">=12"
},
"funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
- "node_modules/eslint-formatter-pretty/node_modules/color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "node_modules/@istanbuljs/schema": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
+ "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==",
"dev": true,
- "dependencies": {
- "color-name": "~1.1.4"
- },
+ "license": "MIT",
"engines": {
- "node": ">=7.0.0"
+ "node": ">=8"
}
},
- "node_modules/eslint-formatter-pretty/node_modules/color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.12",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz",
+ "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
},
- "node_modules/eslint-formatter-pretty/node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=8"
+ "node": ">=6.0.0"
}
},
- "node_modules/eslint-formatter-pretty/node_modules/supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "node_modules/@jridgewell/source-map": {
+ "version": "0.3.10",
+ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.10.tgz",
+ "integrity": "sha512-0pPkgz9dY+bijgistcTTJ5mR+ocqRXLuhXHYdzoMmmoJ2C9S46RCm2GMUbatPEUK9Yjy26IrAy8D/M00lLkv+Q==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "has-flag": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.25"
}
},
- "node_modules/eslint-rule-docs": {
- "version": "1.1.231",
- "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.231.tgz",
- "integrity": "sha512-egHz9A1WG7b8CS0x1P6P/Rj5FqZOjray/VjpJa14tMZalfRKvpE2ONJ3plCM7+PcinmU4tcmbPLv0VtwzSdLVA==",
- "dev": true
- },
- "node_modules/expect.js": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.3.1.tgz",
- "integrity": "sha512-okDF/FAPEul1ZFLae4hrgpIqAeapoo5TRdcg/lD0iN9S3GWrBFIJwNezGH1DMtIz+RxU4RrFmMq7WUUvDg3J6A==",
- "dev": true
- },
- "node_modules/fast-glob": {
- "version": "3.2.11",
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
- "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
+ "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
"dev": true,
- "dependencies": {
- "@nodelib/fs.stat": "^2.0.2",
- "@nodelib/fs.walk": "^1.2.3",
- "glob-parent": "^5.1.2",
- "merge2": "^1.3.0",
- "micromatch": "^4.0.4"
- },
- "engines": {
- "node": ">=8.6.0"
- }
+ "license": "MIT"
},
- "node_modules/fastq": {
- "version": "1.13.0",
- "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz",
- "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==",
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.29",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz",
+ "integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "reusify": "^1.0.4"
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
}
},
- "node_modules/fill-range": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
- "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "node_modules/@nodelib/fs.scandir": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "to-regex-range": "^5.0.1"
+ "@nodelib/fs.stat": "2.0.5",
+ "run-parallel": "^1.1.9"
},
"engines": {
- "node": ">=8"
+ "node": ">= 8"
}
},
- "node_modules/find-up": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
- "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "node_modules/@nodelib/fs.stat": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
"dev": true,
- "dependencies": {
- "locate-path": "^6.0.0",
- "path-exists": "^4.0.0"
- },
+ "license": "MIT",
"engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/flat": {
- "version": "5.0.2",
- "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
- "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
- "dev": true,
- "bin": {
- "flat": "cli.js"
+ "node": ">= 8"
}
},
- "node_modules/fs.realpath": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
- "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
- "dev": true
- },
- "node_modules/fsevents": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
- "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "node_modules/@nodelib/fs.walk": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
"dev": true,
- "hasInstallScript": true,
- "optional": true,
- "os": [
- "darwin"
- ],
+ "license": "MIT",
+ "dependencies": {
+ "@nodelib/fs.scandir": "2.1.5",
+ "fastq": "^1.6.0"
+ },
"engines": {
- "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ "node": ">= 8"
}
},
- "node_modules/function-bind": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
- "dev": true
- },
- "node_modules/get-caller-file": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
- "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "node_modules/@pkgjs/parseargs": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
+ "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
"dev": true,
+ "license": "MIT",
+ "optional": true,
"engines": {
- "node": "6.* || 8.* || >= 10.*"
+ "node": ">=14"
}
},
- "node_modules/glob": {
- "version": "8.1.0",
- "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
- "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
+ "node_modules/@rollup/plugin-terser": {
+ "version": "0.4.4",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz",
+ "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^5.0.1",
- "once": "^1.3.0"
+ "serialize-javascript": "^6.0.1",
+ "smob": "^1.0.0",
+ "terser": "^5.17.4"
},
"engines": {
- "node": ">=12"
+ "node": ">=14.0.0"
},
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
+ "peerDependencies": {
+ "rollup": "^2.0.0||^3.0.0||^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "rollup": {
+ "optional": true
+ }
}
},
- "node_modules/glob-parent": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
- "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "node_modules/@rollup/plugin-typescript": {
+ "version": "12.1.4",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.4.tgz",
+ "integrity": "sha512-s5Hx+EtN60LMlDBvl5f04bEiFZmAepk27Q+mr85L/00zPDn1jtzlTV6FWn81MaIwqfWzKxmOJrBWHU6vtQyedQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "is-glob": "^4.0.1"
+ "@rollup/pluginutils": "^5.1.0",
+ "resolve": "^1.22.1"
},
"engines": {
- "node": ">= 6"
+ "node": ">=14.0.0"
+ },
+ "peerDependencies": {
+ "rollup": "^2.14.0||^3.0.0||^4.0.0",
+ "tslib": "*",
+ "typescript": ">=3.7.0"
+ },
+ "peerDependenciesMeta": {
+ "rollup": {
+ "optional": true
+ },
+ "tslib": {
+ "optional": true
+ }
}
},
- "node_modules/globby": {
- "version": "11.1.0",
- "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
- "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
+ "node_modules/@rollup/pluginutils": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.2.0.tgz",
+ "integrity": "sha512-qWJ2ZTbmumwiLFomfzTyt5Kng4hwPi9rwCYN4SHb6eaRU1KNO4ccxINHr/VhH4GgPlt1XfSTLX2LBTme8ne4Zw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "array-union": "^2.1.0",
- "dir-glob": "^3.0.1",
- "fast-glob": "^3.2.9",
- "ignore": "^5.2.0",
- "merge2": "^1.4.1",
- "slash": "^3.0.0"
+ "@types/estree": "^1.0.0",
+ "estree-walker": "^2.0.2",
+ "picomatch": "^4.0.2"
},
"engines": {
- "node": ">=10"
+ "node": ">=14.0.0"
},
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "peerDependencies": {
+ "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "rollup": {
+ "optional": true
+ }
}
},
- "node_modules/hard-rejection": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz",
- "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==",
+ "node_modules/@rollup/pluginutils/node_modules/estree-walker": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
+ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true,
- "engines": {
- "node": ">=6"
- }
+ "license": "MIT"
},
- "node_modules/has": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "node_modules/@rollup/pluginutils/node_modules/picomatch": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
+ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
- "dependencies": {
- "function-bind": "^1.1.1"
- },
+ "license": "MIT",
"engines": {
- "node": ">= 0.4.0"
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
}
},
- "node_modules/has-flag": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "node_modules/@rollup/rollup-android-arm-eabi": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.46.1.tgz",
+ "integrity": "sha512-oENme6QxtLCqjChRUUo3S6X8hjCXnWmJWnedD7VbGML5GUtaOtAyx+fEEXnBXVf0CBZApMQU0Idwi0FmyxzQhw==",
+ "cpu": [
+ "arm"
+ ],
"dev": true,
- "engines": {
- "node": ">=4"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
},
- "node_modules/he": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
- "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "node_modules/@rollup/rollup-android-arm64": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.46.1.tgz",
+ "integrity": "sha512-OikvNT3qYTl9+4qQ9Bpn6+XHM+ogtFadRLuT2EXiFQMiNkXFLQfNVppi5o28wvYdHL2s3fM0D/MZJ8UkNFZWsw==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
- "bin": {
- "he": "bin/he"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
},
- "node_modules/hosted-git-info": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz",
- "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==",
+ "node_modules/@rollup/rollup-darwin-arm64": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.46.1.tgz",
+ "integrity": "sha512-EFYNNGij2WllnzljQDQnlFTXzSJw87cpAs4TVBAWLdkvic5Uh5tISrIL6NRcxoh/b2EFBG/TK8hgRrGx94zD4A==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
- "dependencies": {
- "lru-cache": "^6.0.0"
- },
- "engines": {
- "node": ">=10"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
},
- "node_modules/ignore": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
- "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==",
+ "node_modules/@rollup/rollup-darwin-x64": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.46.1.tgz",
+ "integrity": "sha512-ZaNH06O1KeTug9WI2+GRBE5Ujt9kZw4a1+OIwnBHal92I8PxSsl5KpsrPvthRynkhMck4XPdvY0z26Cym/b7oA==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
- "engines": {
- "node": ">= 4"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
},
- "node_modules/indent-string": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
- "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
+ "node_modules/@rollup/rollup-freebsd-arm64": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.46.1.tgz",
+ "integrity": "sha512-n4SLVebZP8uUlJ2r04+g2U/xFeiQlw09Me5UFqny8HGbARl503LNH5CqFTb5U5jNxTouhRjai6qPT0CR5c/Iig==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
- "engines": {
- "node": ">=8"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
},
- "node_modules/inflight": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
- "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
+ "node_modules/@rollup/rollup-freebsd-x64": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.46.1.tgz",
+ "integrity": "sha512-8vu9c02F16heTqpvo3yeiu7Vi1REDEC/yES/dIfq3tSXe6mLndiwvYr3AAvd1tMNUqE9yeGYa5w7PRbI5QUV+w==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
- "dependencies": {
- "once": "^1.3.0",
- "wrappy": "1"
- }
- },
- "node_modules/inherits": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
- "dev": true
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
},
- "node_modules/irregular-plurals": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.3.0.tgz",
- "integrity": "sha512-MVBLKUTangM3EfRPFROhmWQQKRDsrgI83J8GS3jXy+OwYqiR2/aoWndYQ5416jLE3uaGgLH7ncme3X9y09gZ3g==",
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.46.1.tgz",
+ "integrity": "sha512-K4ncpWl7sQuyp6rWiGUvb6Q18ba8mzM0rjWJ5JgYKlIXAau1db7hZnR0ldJvqKWWJDxqzSLwGUhA4jp+KqgDtQ==",
+ "cpu": [
+ "arm"
+ ],
"dev": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/is-arrayish": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
- "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
- "dev": true
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
},
- "node_modules/is-binary-path": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
- "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.46.1.tgz",
+ "integrity": "sha512-YykPnXsjUjmXE6j6k2QBBGAn1YsJUix7pYaPLK3RVE0bQL2jfdbfykPxfF8AgBlqtYbfEnYHmLXNa6QETjdOjQ==",
+ "cpu": [
+ "arm"
+ ],
"dev": true,
- "dependencies": {
- "binary-extensions": "^2.0.0"
- },
- "engines": {
- "node": ">=8"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
},
- "node_modules/is-core-module": {
- "version": "2.8.1",
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz",
- "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==",
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.46.1.tgz",
+ "integrity": "sha512-kKvqBGbZ8i9pCGW3a1FH3HNIVg49dXXTsChGFsHGXQaVJPLA4f/O+XmTxfklhccxdF5FefUn2hvkoGJH0ScWOA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.46.1.tgz",
+ "integrity": "sha512-zzX5nTw1N1plmqC9RGC9vZHFuiM7ZP7oSWQGqpbmfjK7p947D518cVK1/MQudsBdcD84t6k70WNczJOct6+hdg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loongarch64-gnu": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.46.1.tgz",
+ "integrity": "sha512-O8CwgSBo6ewPpktFfSDgB6SJN9XDcPSvuwxfejiddbIC/hn9Tg6Ai0f0eYDf3XvB/+PIWzOQL+7+TZoB8p9Yuw==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.46.1.tgz",
+ "integrity": "sha512-JnCfFVEKeq6G3h3z8e60kAp8Rd7QVnWCtPm7cxx+5OtP80g/3nmPtfdCXbVl063e3KsRnGSKDHUQMydmzc/wBA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.46.1.tgz",
+ "integrity": "sha512-dVxuDqS237eQXkbYzQQfdf/njgeNw6LZuVyEdUaWwRpKHhsLI+y4H/NJV8xJGU19vnOJCVwaBFgr936FHOnJsQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.46.1.tgz",
+ "integrity": "sha512-CvvgNl2hrZrTR9jXK1ye0Go0HQRT6ohQdDfWR47/KFKiLd5oN5T14jRdUVGF4tnsN8y9oSfMOqH6RuHh+ck8+w==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.46.1.tgz",
+ "integrity": "sha512-x7ANt2VOg2565oGHJ6rIuuAon+A8sfe1IeUx25IKqi49OjSr/K3awoNqr9gCwGEJo9OuXlOn+H2p1VJKx1psxA==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.46.1.tgz",
+ "integrity": "sha512-9OADZYryz/7E8/qt0vnaHQgmia2Y0wrjSSn1V/uL+zw/i7NUhxbX4cHXdEQ7dnJgzYDS81d8+tf6nbIdRFZQoQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-musl": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.46.1.tgz",
+ "integrity": "sha512-NuvSCbXEKY+NGWHyivzbjSVJi68Xfq1VnIvGmsuXs6TCtveeoDRKutI5vf2ntmNnVq64Q4zInet0UDQ+yMB6tA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.46.1.tgz",
+ "integrity": "sha512-mWz+6FSRb82xuUMMV1X3NGiaPFqbLN9aIueHleTZCc46cJvwTlvIh7reQLk4p97dv0nddyewBhwzryBHH7wtPw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.46.1.tgz",
+ "integrity": "sha512-7Thzy9TMXDw9AU4f4vsLNBxh7/VOKuXi73VH3d/kHGr0tZ3x/ewgL9uC7ojUKmH1/zvmZe2tLapYcZllk3SO8Q==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.46.1.tgz",
+ "integrity": "sha512-7GVB4luhFmGUNXXJhH2jJwZCFB3pIOixv2E3s17GQHBFUOQaISlt7aGcQgqvCaDSxTZJUzlK/QJ1FN8S94MrzQ==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@types/chai": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.2.tgz",
+ "integrity": "sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==",
+ "dev": true,
+ "license": "MIT",
"dependencies": {
- "has": "^1.0.3"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
+ "@types/deep-eql": "*"
}
},
- "node_modules/is-extglob": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
- "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "node_modules/@types/deep-eql": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
"dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
+ "license": "MIT"
},
- "node_modules/is-fullwidth-code-point": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
- "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "node_modules/@types/estree": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
"dev": true,
- "engines": {
- "node": ">=8"
- }
+ "license": "MIT"
},
- "node_modules/is-glob": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
- "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "node_modules/@types/json-schema": {
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "24.1.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
+ "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
+ "dev": true,
+ "license": "MIT",
"dependencies": {
- "is-extglob": "^2.1.1"
- },
- "engines": {
- "node": ">=0.10.0"
+ "undici-types": "~7.8.0"
}
},
- "node_modules/is-number": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
- "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "node_modules/@typescript-eslint/eslint-plugin": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.38.0.tgz",
+ "integrity": "sha512-CPoznzpuAnIOl4nhj4tRr4gIPj5AfKgkiJmGQDaq+fQnRJTYlcBjbX3wbciGmpoPf8DREufuPRe1tNMZnGdanA==",
"dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/regexpp": "^4.10.0",
+ "@typescript-eslint/scope-manager": "8.38.0",
+ "@typescript-eslint/type-utils": "8.38.0",
+ "@typescript-eslint/utils": "8.38.0",
+ "@typescript-eslint/visitor-keys": "8.38.0",
+ "graphemer": "^1.4.0",
+ "ignore": "^7.0.0",
+ "natural-compare": "^1.4.0",
+ "ts-api-utils": "^2.1.0"
+ },
"engines": {
- "node": ">=0.12.0"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "@typescript-eslint/parser": "^8.38.0",
+ "eslint": "^8.57.0 || ^9.0.0",
+ "typescript": ">=4.8.4 <5.9.0"
}
},
- "node_modules/is-plain-obj": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
- "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
+ "version": "7.0.5",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
+ "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=8"
+ "node": ">= 4"
}
},
- "node_modules/is-unicode-supported": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
- "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
+ "node_modules/@typescript-eslint/parser": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.38.0.tgz",
+ "integrity": "sha512-Zhy8HCvBUEfBECzIl1PKqF4p11+d0aUJS1GeUiuqK9WmOug8YCmC4h4bjyBvMyAMI9sbRczmrYL5lKg/YMbrcQ==",
"dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/scope-manager": "8.38.0",
+ "@typescript-eslint/types": "8.38.0",
+ "@typescript-eslint/typescript-estree": "8.38.0",
+ "@typescript-eslint/visitor-keys": "8.38.0",
+ "debug": "^4.3.4"
+ },
"engines": {
- "node": ">=10"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0",
+ "typescript": ">=4.8.4 <5.9.0"
}
},
- "node_modules/jest-diff": {
- "version": "29.5.0",
- "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.5.0.tgz",
- "integrity": "sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==",
+ "node_modules/@typescript-eslint/project-service": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.38.0.tgz",
+ "integrity": "sha512-dbK7Jvqcb8c9QfH01YB6pORpqX1mn5gDZc9n63Ak/+jD67oWXn3Gs0M6vddAN+eDXBCS5EmNWzbSxsn9SzFWWg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "chalk": "^4.0.0",
- "diff-sequences": "^29.4.3",
- "jest-get-type": "^29.4.3",
- "pretty-format": "^29.5.0"
+ "@typescript-eslint/tsconfig-utils": "^8.38.0",
+ "@typescript-eslint/types": "^8.38.0",
+ "debug": "^4.3.4"
},
"engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4 <5.9.0"
}
},
- "node_modules/jest-diff/node_modules/ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "node_modules/@typescript-eslint/scope-manager": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.38.0.tgz",
+ "integrity": "sha512-WJw3AVlFFcdT9Ri1xs/lg8LwDqgekWXWhH3iAF+1ZM+QPd7oxQ6jvtW/JPwzAScxitILUIFs0/AnQ/UWHzbATQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "color-convert": "^2.0.1"
+ "@typescript-eslint/types": "8.38.0",
+ "@typescript-eslint/visitor-keys": "8.38.0"
},
"engines": {
- "node": ">=8"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
}
},
- "node_modules/jest-diff/node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "node_modules/@typescript-eslint/tsconfig-utils": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.38.0.tgz",
+ "integrity": "sha512-Lum9RtSE3EroKk/bYns+sPOodqb2Fv50XOl/gMviMKNvanETUuUcC9ObRbzrJ4VSd2JalPqgSAavwrPiPvnAiQ==",
"dev": true,
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
+ "license": "MIT",
"engines": {
- "node": ">=10"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4 <5.9.0"
}
},
- "node_modules/jest-diff/node_modules/color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "node_modules/@typescript-eslint/type-utils": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.38.0.tgz",
+ "integrity": "sha512-c7jAvGEZVf0ao2z+nnz8BUaHZD09Agbh+DY7qvBQqLiz8uJzRgVPj5YvOh8I8uEiH8oIUGIfHzMwUcGVco/SJg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "color-name": "~1.1.4"
+ "@typescript-eslint/types": "8.38.0",
+ "@typescript-eslint/typescript-estree": "8.38.0",
+ "@typescript-eslint/utils": "8.38.0",
+ "debug": "^4.3.4",
+ "ts-api-utils": "^2.1.0"
},
"engines": {
- "node": ">=7.0.0"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0",
+ "typescript": ">=4.8.4 <5.9.0"
}
},
- "node_modules/jest-diff/node_modules/color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
- },
- "node_modules/jest-diff/node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "node_modules/@typescript-eslint/types": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.38.0.tgz",
+ "integrity": "sha512-wzkUfX3plUqij4YwWaJyqhiPE5UCRVlFpKn1oCRn2O1bJ592XxWJj8ROQ3JD5MYXLORW84063z3tZTb/cs4Tyw==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=8"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
}
},
- "node_modules/jest-diff/node_modules/supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "node_modules/@typescript-eslint/typescript-estree": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.38.0.tgz",
+ "integrity": "sha512-fooELKcAKzxux6fA6pxOflpNS0jc+nOQEEOipXFNjSlBS6fqrJOVY/whSn70SScHrcJ2LDsxWrneFoWYSVfqhQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "has-flag": "^4.0.0"
+ "@typescript-eslint/project-service": "8.38.0",
+ "@typescript-eslint/tsconfig-utils": "8.38.0",
+ "@typescript-eslint/types": "8.38.0",
+ "@typescript-eslint/visitor-keys": "8.38.0",
+ "debug": "^4.3.4",
+ "fast-glob": "^3.3.2",
+ "is-glob": "^4.0.3",
+ "minimatch": "^9.0.4",
+ "semver": "^7.6.0",
+ "ts-api-utils": "^2.1.0"
},
"engines": {
- "node": ">=8"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4 <5.9.0"
}
},
- "node_modules/jest-get-type": {
- "version": "29.4.3",
- "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz",
- "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==",
+ "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
+ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"dev": true,
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
}
},
- "node_modules/js-tokens": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
- "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
- "dev": true
- },
- "node_modules/js-yaml": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
- "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
+ "license": "ISC",
"dependencies": {
- "argparse": "^2.0.1"
+ "brace-expansion": "^2.0.1"
},
- "bin": {
- "js-yaml": "bin/js-yaml.js"
- }
- },
- "node_modules/json-parse-even-better-errors": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
- "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
- "dev": true
- },
- "node_modules/kind-of": {
- "version": "6.0.3",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
- "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
- "dev": true,
"engines": {
- "node": ">=0.10.0"
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "node_modules/lines-and-columns": {
- "version": "1.2.4",
- "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
- "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
- "dev": true
- },
- "node_modules/locate-path": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
- "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "node_modules/@typescript-eslint/utils": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.38.0.tgz",
+ "integrity": "sha512-hHcMA86Hgt+ijJlrD8fX0j1j8w4C92zue/8LOPAFioIno+W0+L7KqE8QZKCcPGc/92Vs9x36w/4MPTJhqXdyvg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "p-locate": "^5.0.0"
+ "@eslint-community/eslint-utils": "^4.7.0",
+ "@typescript-eslint/scope-manager": "8.38.0",
+ "@typescript-eslint/types": "8.38.0",
+ "@typescript-eslint/typescript-estree": "8.38.0"
},
"engines": {
- "node": ">=10"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0",
+ "typescript": ">=4.8.4 <5.9.0"
}
},
- "node_modules/log-symbols": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
- "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
+ "node_modules/@typescript-eslint/visitor-keys": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.38.0.tgz",
+ "integrity": "sha512-pWrTcoFNWuwHlA9CvlfSsGWs14JxfN1TH25zM5L7o0pRLhsoZkDnTsXfQRJBEWJoV5DL0jf+Z+sxiud+K0mq1g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "chalk": "^4.1.0",
- "is-unicode-supported": "^0.1.0"
+ "@typescript-eslint/types": "8.38.0",
+ "eslint-visitor-keys": "^4.2.1"
},
"engines": {
- "node": ">=10"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
}
},
- "node_modules/log-symbols/node_modules/ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "node_modules/@vitest/coverage-v8": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-3.2.4.tgz",
+ "integrity": "sha512-EyF9SXU6kS5Ku/U82E259WSnvg6c8KTjppUncuNdm5QHpe17mwREHnjDzozC8x9MZ0xfBUFSaLkRv4TMA75ALQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "color-convert": "^2.0.1"
- },
- "engines": {
- "node": ">=8"
+ "@ampproject/remapping": "^2.3.0",
+ "@bcoe/v8-coverage": "^1.0.2",
+ "ast-v8-to-istanbul": "^0.3.3",
+ "debug": "^4.4.1",
+ "istanbul-lib-coverage": "^3.2.2",
+ "istanbul-lib-report": "^3.0.1",
+ "istanbul-lib-source-maps": "^5.0.6",
+ "istanbul-reports": "^3.1.7",
+ "magic-string": "^0.30.17",
+ "magicast": "^0.3.5",
+ "std-env": "^3.9.0",
+ "test-exclude": "^7.0.1",
+ "tinyrainbow": "^2.0.0"
},
"funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@vitest/browser": "3.2.4",
+ "vitest": "3.2.4"
+ },
+ "peerDependenciesMeta": {
+ "@vitest/browser": {
+ "optional": true
+ }
}
},
- "node_modules/log-symbols/node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "node_modules/@vitest/expect": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz",
+ "integrity": "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
+ "@types/chai": "^5.2.2",
+ "@vitest/spy": "3.2.4",
+ "@vitest/utils": "3.2.4",
+ "chai": "^5.2.0",
+ "tinyrainbow": "^2.0.0"
},
"funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
+ "url": "https://opencollective.com/vitest"
}
},
- "node_modules/log-symbols/node_modules/color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "node_modules/@vitest/mocker": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.4.tgz",
+ "integrity": "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "color-name": "~1.1.4"
+ "@vitest/spy": "3.2.4",
+ "estree-walker": "^3.0.3",
+ "magic-string": "^0.30.17"
},
- "engines": {
- "node": ">=7.0.0"
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "msw": "^2.4.9",
+ "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0"
+ },
+ "peerDependenciesMeta": {
+ "msw": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
}
},
- "node_modules/log-symbols/node_modules/color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
- },
- "node_modules/log-symbols/node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "node_modules/@vitest/pretty-format": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.4.tgz",
+ "integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==",
"dev": true,
- "engines": {
- "node": ">=8"
+ "license": "MIT",
+ "dependencies": {
+ "tinyrainbow": "^2.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
}
},
- "node_modules/log-symbols/node_modules/supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "node_modules/@vitest/runner": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.4.tgz",
+ "integrity": "sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "has-flag": "^4.0.0"
+ "@vitest/utils": "3.2.4",
+ "pathe": "^2.0.3",
+ "strip-literal": "^3.0.0"
},
- "engines": {
- "node": ">=8"
+ "funding": {
+ "url": "https://opencollective.com/vitest"
}
},
- "node_modules/lru-cache": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
- "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "node_modules/@vitest/snapshot": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.4.tgz",
+ "integrity": "sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "yallist": "^4.0.0"
+ "@vitest/pretty-format": "3.2.4",
+ "magic-string": "^0.30.17",
+ "pathe": "^2.0.3"
},
- "engines": {
- "node": ">=10"
+ "funding": {
+ "url": "https://opencollective.com/vitest"
}
},
- "node_modules/map-obj": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",
- "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==",
+ "node_modules/@vitest/spy": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.4.tgz",
+ "integrity": "sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==",
"dev": true,
- "engines": {
- "node": ">=8"
+ "license": "MIT",
+ "dependencies": {
+ "tinyspy": "^4.0.3"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "url": "https://opencollective.com/vitest"
}
},
- "node_modules/meow": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz",
- "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==",
+ "node_modules/@vitest/utils": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.4.tgz",
+ "integrity": "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "@types/minimist": "^1.2.0",
- "camelcase-keys": "^6.2.2",
- "decamelize": "^1.2.0",
- "decamelize-keys": "^1.1.0",
- "hard-rejection": "^2.1.0",
- "minimist-options": "4.1.0",
- "normalize-package-data": "^3.0.0",
- "read-pkg-up": "^7.0.1",
- "redent": "^3.0.0",
- "trim-newlines": "^3.0.0",
- "type-fest": "^0.18.0",
- "yargs-parser": "^20.2.3"
+ "@vitest/pretty-format": "3.2.4",
+ "loupe": "^3.1.4",
+ "tinyrainbow": "^2.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/acorn": {
+ "version": "8.15.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
},
"engines": {
- "node": ">=10"
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
}
},
- "node_modules/meow/node_modules/decamelize": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
- "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
- "node": ">=0.10.0"
+ "node": ">=8"
}
},
- "node_modules/meow/node_modules/type-fest": {
- "version": "0.18.1",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz",
- "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==",
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
"engines": {
- "node": ">=10"
+ "node": ">=8"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
- "node_modules/merge2": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
- "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+ "node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true,
+ "license": "Python-2.0"
+ },
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">= 8"
+ "node": ">=12"
}
},
- "node_modules/micromatch": {
- "version": "4.0.8",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
- "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
+ "node_modules/ast-v8-to-istanbul": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-0.3.3.tgz",
+ "integrity": "sha512-MuXMrSLVVoA6sYN/6Hke18vMzrT4TZNbZIj/hvh0fnYFpO+/kFXcLIaiPwXXWaQUPg4yJD8fj+lfJ7/1EBconw==",
"dev": true,
"license": "MIT",
"dependencies": {
- "braces": "^3.0.3",
- "picomatch": "^2.3.1"
- },
- "engines": {
- "node": ">=8.6"
+ "@jridgewell/trace-mapping": "^0.3.25",
+ "estree-walker": "^3.0.3",
+ "js-tokens": "^9.0.1"
}
},
- "node_modules/min-indent": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
- "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
+ "node_modules/ast-v8-to-istanbul/node_modules/js-tokens": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz",
+ "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==",
"dev": true,
- "engines": {
- "node": ">=4"
+ "license": "MIT"
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.12",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
+ "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
}
},
- "node_modules/minimatch": {
- "version": "5.1.6",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
- "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "brace-expansion": "^2.0.1"
+ "fill-range": "^7.1.1"
},
"engines": {
- "node": ">=10"
+ "node": ">=8"
}
},
- "node_modules/minimist-options": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz",
- "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==",
+ "node_modules/buffer-from": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
+ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"dev": true,
- "dependencies": {
- "arrify": "^1.0.1",
- "is-plain-obj": "^1.1.0",
- "kind-of": "^6.0.3"
- },
+ "license": "MIT"
+ },
+ "node_modules/cac": {
+ "version": "6.7.14",
+ "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
+ "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
+ "dev": true,
+ "license": "MIT",
"engines": {
- "node": ">= 6"
+ "node": ">=8"
}
},
- "node_modules/minimist-options/node_modules/is-plain-obj": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
- "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
+ "node_modules/callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=0.10.0"
+ "node": ">=6"
}
},
- "node_modules/mocha": {
- "version": "10.7.3",
- "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.3.tgz",
- "integrity": "sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==",
+ "node_modules/chai": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.1.tgz",
+ "integrity": "sha512-5nFxhUrX0PqtyogoYOA8IPswy5sZFTOsBFl/9bNsmDLgsxYTzSZQJDPppDnZPTQbzSEm0hqGjWPzRemQCYbD6A==",
"dev": true,
"license": "MIT",
"dependencies": {
- "ansi-colors": "^4.1.3",
- "browser-stdout": "^1.3.1",
- "chokidar": "^3.5.3",
- "debug": "^4.3.5",
- "diff": "^5.2.0",
- "escape-string-regexp": "^4.0.0",
- "find-up": "^5.0.0",
- "glob": "^8.1.0",
- "he": "^1.2.0",
- "js-yaml": "^4.1.0",
- "log-symbols": "^4.1.0",
- "minimatch": "^5.1.6",
- "ms": "^2.1.3",
- "serialize-javascript": "^6.0.2",
- "strip-json-comments": "^3.1.1",
- "supports-color": "^8.1.1",
- "workerpool": "^6.5.1",
- "yargs": "^16.2.0",
- "yargs-parser": "^20.2.9",
- "yargs-unparser": "^2.0.0"
- },
- "bin": {
- "_mocha": "bin/_mocha",
- "mocha": "bin/mocha.js"
+ "assertion-error": "^2.0.1",
+ "check-error": "^2.1.1",
+ "deep-eql": "^5.0.1",
+ "loupe": "^3.1.0",
+ "pathval": "^2.0.0"
},
"engines": {
- "node": ">= 14.0.0"
+ "node": ">=18"
}
},
- "node_modules/mocha/node_modules/escape-string-regexp": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
- "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
"engines": {
"node": ">=10"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "url": "https://github.com/chalk/chalk?sponsor=1"
}
},
- "node_modules/mocha/node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "node_modules/check-error": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz",
+ "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=8"
+ "node": ">= 16"
}
},
- "node_modules/mocha/node_modules/supports-color": {
- "version": "8.1.1",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
- "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": {
- "has-flag": "^4.0.0"
+ "color-name": "~1.1.4"
},
"engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/supports-color?sponsor=1"
+ "node": ">=7.0.0"
}
},
- "node_modules/ms": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
- "node_modules/normalize-package-data": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz",
- "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==",
+ "node_modules/commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "hosted-git-info": "^4.0.1",
- "is-core-module": "^2.5.0",
- "semver": "^7.3.4",
- "validate-npm-package-license": "^3.0.1"
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
},
"engines": {
- "node": ">=10"
+ "node": ">= 8"
}
},
- "node_modules/normalize-path": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
- "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "node_modules/debug": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
+ "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
"dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
"engines": {
- "node": ">=0.10.0"
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
}
},
- "node_modules/once": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
- "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+ "node_modules/deep-eql": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz",
+ "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==",
"dev": true,
- "dependencies": {
- "wrappy": "1"
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
}
},
- "node_modules/p-limit": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
- "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "node_modules/deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true
+ },
+ "node_modules/eastasianwidth": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
+ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
"dev": true,
- "dependencies": {
- "yocto-queue": "^0.1.0"
+ "license": "MIT"
+ },
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "node_modules/es-module-lexer": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz",
+ "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/esbuild": {
+ "version": "0.25.2",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.2.tgz",
+ "integrity": "sha512-16854zccKPnC+toMywC+uKNeYSv+/eXkevRAfwRD/G9Cleq66m8XFIrigkbvauLLlCfDL45Q2cWegSg53gGBnQ==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
},
"engines": {
- "node": ">=10"
+ "node": ">=18"
},
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.25.2",
+ "@esbuild/android-arm": "0.25.2",
+ "@esbuild/android-arm64": "0.25.2",
+ "@esbuild/android-x64": "0.25.2",
+ "@esbuild/darwin-arm64": "0.25.2",
+ "@esbuild/darwin-x64": "0.25.2",
+ "@esbuild/freebsd-arm64": "0.25.2",
+ "@esbuild/freebsd-x64": "0.25.2",
+ "@esbuild/linux-arm": "0.25.2",
+ "@esbuild/linux-arm64": "0.25.2",
+ "@esbuild/linux-ia32": "0.25.2",
+ "@esbuild/linux-loong64": "0.25.2",
+ "@esbuild/linux-mips64el": "0.25.2",
+ "@esbuild/linux-ppc64": "0.25.2",
+ "@esbuild/linux-riscv64": "0.25.2",
+ "@esbuild/linux-s390x": "0.25.2",
+ "@esbuild/linux-x64": "0.25.2",
+ "@esbuild/netbsd-arm64": "0.25.2",
+ "@esbuild/netbsd-x64": "0.25.2",
+ "@esbuild/openbsd-arm64": "0.25.2",
+ "@esbuild/openbsd-x64": "0.25.2",
+ "@esbuild/sunos-x64": "0.25.2",
+ "@esbuild/win32-arm64": "0.25.2",
+ "@esbuild/win32-ia32": "0.25.2",
+ "@esbuild/win32-x64": "0.25.2"
}
},
- "node_modules/p-locate": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
- "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true,
- "dependencies": {
- "p-limit": "^3.0.2"
- },
"engines": {
"node": ">=10"
},
@@ -1794,688 +2170,762 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/p-try": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
- "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
+ "node_modules/eslint": {
+ "version": "9.32.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.32.0.tgz",
+ "integrity": "sha512-LSehfdpgMeWcTZkWZVIJl+tkZ2nuSkyyB9C27MZqFWXuph7DvaowgcTvKqxvpLW1JZIk8PN7hFY3Rj9LQ7m7lg==",
"dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.2.0",
+ "@eslint-community/regexpp": "^4.12.1",
+ "@eslint/config-array": "^0.21.0",
+ "@eslint/config-helpers": "^0.3.0",
+ "@eslint/core": "^0.15.0",
+ "@eslint/eslintrc": "^3.3.1",
+ "@eslint/js": "9.32.0",
+ "@eslint/plugin-kit": "^0.3.4",
+ "@humanfs/node": "^0.16.6",
+ "@humanwhocodes/module-importer": "^1.0.1",
+ "@humanwhocodes/retry": "^0.4.2",
+ "@types/estree": "^1.0.6",
+ "@types/json-schema": "^7.0.15",
+ "ajv": "^6.12.4",
+ "chalk": "^4.0.0",
+ "cross-spawn": "^7.0.6",
+ "debug": "^4.3.2",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^8.4.0",
+ "eslint-visitor-keys": "^4.2.1",
+ "espree": "^10.4.0",
+ "esquery": "^1.5.0",
+ "esutils": "^2.0.2",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "^8.0.0",
+ "find-up": "^5.0.0",
+ "glob-parent": "^6.0.2",
+ "ignore": "^5.2.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "lodash.merge": "^4.6.2",
+ "minimatch": "^3.1.2",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.3"
+ },
+ "bin": {
+ "eslint": "bin/eslint.js"
+ },
"engines": {
- "node": ">=6"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ },
+ "peerDependencies": {
+ "jiti": "*"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ }
}
},
- "node_modules/parse-json": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
- "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
+ "node_modules/eslint-scope": {
+ "version": "8.4.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
+ "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
"dev": true,
+ "license": "BSD-2-Clause",
"dependencies": {
- "@babel/code-frame": "^7.0.0",
- "error-ex": "^1.3.1",
- "json-parse-even-better-errors": "^2.3.0",
- "lines-and-columns": "^1.1.6"
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
},
"engines": {
- "node": ">=8"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "url": "https://opencollective.com/eslint"
}
},
- "node_modules/path-exists": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
- "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "node_modules/eslint-visitor-keys": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
+ "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
- "node": ">=8"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
}
},
- "node_modules/path-parse": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
- "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
- "dev": true
- },
- "node_modules/path-type": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
- "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
+ "node_modules/eslint/node_modules/glob-parent": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
"dev": true,
+ "dependencies": {
+ "is-glob": "^4.0.3"
+ },
"engines": {
- "node": ">=8"
+ "node": ">=10.13.0"
}
},
- "node_modules/picomatch": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
- "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "node_modules/espree": {
+ "version": "10.4.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
+ "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
"dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "acorn": "^8.15.0",
+ "acorn-jsx": "^5.3.2",
+ "eslint-visitor-keys": "^4.2.1"
+ },
"engines": {
- "node": ">=8.6"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "url": "https://github.com/sponsors/jonschlinkert"
+ "url": "https://opencollective.com/eslint"
}
},
- "node_modules/plur": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz",
- "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==",
+ "node_modules/esquery": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
+ "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
"dev": true,
"dependencies": {
- "irregular-plurals": "^3.2.0"
+ "estraverse": "^5.1.0"
},
"engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "node": ">=0.10"
}
},
- "node_modules/pretty-format": {
- "version": "29.5.0",
- "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.5.0.tgz",
- "integrity": "sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==",
+ "node_modules/esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
"dev": true,
+ "license": "BSD-2-Clause",
"dependencies": {
- "@jest/schemas": "^29.4.3",
- "ansi-styles": "^5.0.0",
- "react-is": "^18.0.0"
+ "estraverse": "^5.2.0"
},
"engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ "node": ">=4.0"
}
},
- "node_modules/pretty-format/node_modules/ansi-styles": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
- "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
+ "node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"dev": true,
"engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ "node": ">=4.0"
}
},
- "node_modules/queue-microtask": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
- "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+ "node_modules/estree-walker": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
"dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ]
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "^1.0.0"
+ }
},
- "node_modules/quick-lru": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz",
- "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==",
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true,
"engines": {
- "node": ">=8"
+ "node": ">=0.10.0"
}
},
- "node_modules/randombytes": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
- "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "node_modules/expect-type": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.2.tgz",
+ "integrity": "sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==",
"dev": true,
- "dependencies": {
- "safe-buffer": "^5.1.0"
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.0.0"
}
},
- "node_modules/react-is": {
- "version": "18.2.0",
- "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
- "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==",
- "dev": true
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true,
+ "license": "MIT"
},
- "node_modules/read-pkg": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz",
- "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==",
+ "node_modules/fast-glob": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
+ "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "@types/normalize-package-data": "^2.4.0",
- "normalize-package-data": "^2.5.0",
- "parse-json": "^5.0.0",
- "type-fest": "^0.6.0"
+ "@nodelib/fs.stat": "^2.0.2",
+ "@nodelib/fs.walk": "^1.2.3",
+ "glob-parent": "^5.1.2",
+ "merge2": "^1.3.0",
+ "micromatch": "^4.0.8"
},
"engines": {
- "node": ">=8"
+ "node": ">=8.6.0"
}
},
- "node_modules/read-pkg-up": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz",
- "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==",
+ "node_modules/fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
"dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+ "dev": true
+ },
+ "node_modules/fastq": {
+ "version": "1.19.1",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz",
+ "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==",
+ "dev": true,
+ "license": "ISC",
"dependencies": {
- "find-up": "^4.1.0",
- "read-pkg": "^5.2.0",
- "type-fest": "^0.8.1"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "reusify": "^1.0.4"
}
},
- "node_modules/read-pkg-up/node_modules/find-up": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
- "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "node_modules/file-entry-cache": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
+ "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
"dev": true,
"dependencies": {
- "locate-path": "^5.0.0",
- "path-exists": "^4.0.0"
+ "flat-cache": "^4.0.0"
},
"engines": {
- "node": ">=8"
+ "node": ">=16.0.0"
}
},
- "node_modules/read-pkg-up/node_modules/locate-path": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
- "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "p-locate": "^4.1.0"
+ "to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
- "node_modules/read-pkg-up/node_modules/p-limit": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
- "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dev": true,
"dependencies": {
- "p-try": "^2.0.0"
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
},
"engines": {
- "node": ">=6"
+ "node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/read-pkg-up/node_modules/p-locate": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
- "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "node_modules/flat-cache": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
+ "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
"dev": true,
"dependencies": {
- "p-limit": "^2.2.0"
+ "flatted": "^3.2.9",
+ "keyv": "^4.5.4"
},
"engines": {
- "node": ">=8"
- }
- },
- "node_modules/read-pkg-up/node_modules/type-fest": {
- "version": "0.8.1",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
- "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
- "dev": true,
- "engines": {
- "node": ">=8"
+ "node": ">=16"
}
},
- "node_modules/read-pkg/node_modules/hosted-git-info": {
- "version": "2.8.9",
- "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
- "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
+ "node_modules/flatted": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
+ "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
"dev": true
},
- "node_modules/read-pkg/node_modules/normalize-package-data": {
- "version": "2.5.0",
- "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
- "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
+ "node_modules/foreground-child": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
+ "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
"dev": true,
+ "license": "ISC",
"dependencies": {
- "hosted-git-info": "^2.1.4",
- "resolve": "^1.10.0",
- "semver": "2 || 3 || 4 || 5",
- "validate-npm-package-license": "^3.0.1"
+ "cross-spawn": "^7.0.6",
+ "signal-exit": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "node_modules/read-pkg/node_modules/semver": {
- "version": "5.7.2",
- "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
- "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
- "bin": {
- "semver": "bin/semver"
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
- "node_modules/read-pkg/node_modules/type-fest": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",
- "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==",
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
- "engines": {
- "node": ">=8"
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/readdirp": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
- "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "node_modules/get-tsconfig": {
+ "version": "4.10.0",
+ "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz",
+ "integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "picomatch": "^2.2.1"
+ "resolve-pkg-maps": "^1.0.0"
},
- "engines": {
- "node": ">=8.10.0"
+ "funding": {
+ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
- "node_modules/redent": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz",
- "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==",
+ "node_modules/glob": {
+ "version": "11.0.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz",
+ "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==",
"dev": true,
+ "license": "ISC",
"dependencies": {
- "indent-string": "^4.0.0",
- "strip-indent": "^3.0.0"
+ "foreground-child": "^3.3.1",
+ "jackspeak": "^4.1.1",
+ "minimatch": "^10.0.3",
+ "minipass": "^7.1.2",
+ "package-json-from-dist": "^1.0.0",
+ "path-scurry": "^2.0.0"
+ },
+ "bin": {
+ "glob": "dist/esm/bin.mjs"
},
"engines": {
- "node": ">=8"
+ "node": "20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "node_modules/require-directory": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
- "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
"engines": {
- "node": ">=0.10.0"
+ "node": ">= 6"
}
},
- "node_modules/resolve": {
- "version": "1.22.0",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz",
- "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
+ "node_modules/glob/node_modules/minimatch": {
+ "version": "10.0.3",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz",
+ "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==",
"dev": true,
+ "license": "ISC",
"dependencies": {
- "is-core-module": "^2.8.1",
- "path-parse": "^1.0.7",
- "supports-preserve-symlinks-flag": "^1.0.0"
+ "@isaacs/brace-expansion": "^5.0.0"
},
- "bin": {
- "resolve": "bin/resolve"
+ "engines": {
+ "node": "20 || >=22"
},
"funding": {
- "url": "https://github.com/sponsors/ljharb"
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "node_modules/reusify": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
- "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
+ "node_modules/globals": {
+ "version": "16.3.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-16.3.0.tgz",
+ "integrity": "sha512-bqWEnJ1Nt3neqx2q5SFfGS8r/ahumIakg3HcwtNlrVlwXIeNumWn/c7Pn/wKzGhf6SaW6H6uWXLqC30STCMchQ==",
"dev": true,
+ "license": "MIT",
"engines": {
- "iojs": ">=1.0.0",
- "node": ">=0.10.0"
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/rollup": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.5.tgz",
- "integrity": "sha512-WoinX7GeQOFMGznEcWA1WrTQCd/tpEbMkc3nuMs9BT0CPjMdSjPMTVClwWd4pgSQwJdP65SK9mTCNvItlr5o7w==",
+ "node_modules/graphemer": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz",
+ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@types/estree": "1.0.6"
- },
- "bin": {
- "rollup": "dist/bin/rollup"
+ "function-bind": "^1.1.2"
},
"engines": {
- "node": ">=18.0.0",
- "npm": ">=8.0.0"
- },
- "optionalDependencies": {
- "@rollup/rollup-android-arm-eabi": "4.22.5",
- "@rollup/rollup-android-arm64": "4.22.5",
- "@rollup/rollup-darwin-arm64": "4.22.5",
- "@rollup/rollup-darwin-x64": "4.22.5",
- "@rollup/rollup-linux-arm-gnueabihf": "4.22.5",
- "@rollup/rollup-linux-arm-musleabihf": "4.22.5",
- "@rollup/rollup-linux-arm64-gnu": "4.22.5",
- "@rollup/rollup-linux-arm64-musl": "4.22.5",
- "@rollup/rollup-linux-powerpc64le-gnu": "4.22.5",
- "@rollup/rollup-linux-riscv64-gnu": "4.22.5",
- "@rollup/rollup-linux-s390x-gnu": "4.22.5",
- "@rollup/rollup-linux-x64-gnu": "4.22.5",
- "@rollup/rollup-linux-x64-musl": "4.22.5",
- "@rollup/rollup-win32-arm64-msvc": "4.22.5",
- "@rollup/rollup-win32-ia32-msvc": "4.22.5",
- "@rollup/rollup-win32-x64-msvc": "4.22.5",
- "fsevents": "~2.3.2"
+ "node": ">= 0.4"
}
},
- "node_modules/run-parallel": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
- "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+ "node_modules/html-escaper": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
+ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "dependencies": {
- "queue-microtask": "^1.2.2"
- }
+ "license": "MIT"
},
- "node_modules/safe-buffer": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "node_modules/ignore": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
+ "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==",
"dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ]
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
},
- "node_modules/semver": {
- "version": "7.5.4",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
- "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
+ "node_modules/import-fresh": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
+ "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "lru-cache": "^6.0.0"
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
},
- "bin": {
- "semver": "bin/semver.js"
+ "engines": {
+ "node": ">=6"
},
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
+ "dev": true,
"engines": {
- "node": ">=10"
+ "node": ">=0.8.19"
}
},
- "node_modules/serialize-javascript": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
- "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
+ "node_modules/is-core-module": {
+ "version": "2.16.1",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz",
+ "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==",
"dev": true,
- "license": "BSD-3-Clause",
+ "license": "MIT",
"dependencies": {
- "randombytes": "^2.1.0"
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/slash": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
- "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dev": true,
"engines": {
- "node": ">=8"
+ "node": ">=0.10.0"
}
},
- "node_modules/smob": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/smob/-/smob-1.4.0.tgz",
- "integrity": "sha512-MqR3fVulhjWuRNSMydnTlweu38UhQ0HXM4buStD/S3mc/BzX3CuM9OmhyQpmtYCvoYdl5ris6TI0ZqH355Ymqg==",
- "dev": true
- },
- "node_modules/source-map": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
- "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
- "node": ">=0.10.0"
+ "node": ">=8"
}
},
- "node_modules/source-map-support": {
- "version": "0.5.21",
- "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
- "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"dependencies": {
- "buffer-from": "^1.0.0",
- "source-map": "^0.6.0"
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
}
},
- "node_modules/spdx-correct": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
- "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
- "dependencies": {
- "spdx-expression-parse": "^3.0.0",
- "spdx-license-ids": "^3.0.0"
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.12.0"
}
},
- "node_modules/spdx-exceptions": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
- "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
},
- "node_modules/spdx-expression-parse": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
- "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
+ "node_modules/istanbul-lib-coverage": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz",
+ "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==",
"dev": true,
- "dependencies": {
- "spdx-exceptions": "^2.1.0",
- "spdx-license-ids": "^3.0.0"
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=8"
}
},
- "node_modules/spdx-license-ids": {
- "version": "3.0.11",
- "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz",
- "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==",
- "dev": true
- },
- "node_modules/string-width": {
- "version": "4.2.3",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
- "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "node_modules/istanbul-lib-report": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz",
+ "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==",
"dev": true,
+ "license": "BSD-3-Clause",
"dependencies": {
- "emoji-regex": "^8.0.0",
- "is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.1"
+ "istanbul-lib-coverage": "^3.0.0",
+ "make-dir": "^4.0.0",
+ "supports-color": "^7.1.0"
},
"engines": {
- "node": ">=8"
+ "node": ">=10"
}
},
- "node_modules/strip-ansi": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
- "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "node_modules/istanbul-lib-source-maps": {
+ "version": "5.0.6",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz",
+ "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==",
"dev": true,
+ "license": "BSD-3-Clause",
"dependencies": {
- "ansi-regex": "^5.0.1"
+ "@jridgewell/trace-mapping": "^0.3.23",
+ "debug": "^4.1.1",
+ "istanbul-lib-coverage": "^3.0.0"
},
"engines": {
- "node": ">=8"
+ "node": ">=10"
}
},
- "node_modules/strip-indent": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
- "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
+ "node_modules/istanbul-reports": {
+ "version": "3.1.7",
+ "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz",
+ "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==",
"dev": true,
+ "license": "BSD-3-Clause",
"dependencies": {
- "min-indent": "^1.0.0"
+ "html-escaper": "^2.0.0",
+ "istanbul-lib-report": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
- "node_modules/strip-json-comments": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
- "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "node_modules/jackspeak": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz",
+ "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==",
"dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "@isaacs/cliui": "^8.0.2"
+ },
"engines": {
- "node": ">=8"
+ "node": "20 || >=22"
},
"funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "node_modules/supports-color": {
- "version": "5.5.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
- "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "node_modules/jiti": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.5.1.tgz",
+ "integrity": "sha512-twQoecYPiVA5K/h6SxtORw/Bs3ar+mLUtoPSc7iMXzQzK8d7eJ/R09wmTwAjiamETn1cXYPGfNnu7DMoHgu12w==",
"dev": true,
- "dependencies": {
- "has-flag": "^3.0.0"
- },
- "engines": {
- "node": ">=4"
+ "license": "MIT",
+ "bin": {
+ "jiti": "lib/jiti-cli.mjs"
}
},
- "node_modules/supports-hyperlinks": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz",
- "integrity": "sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ==",
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "has-flag": "^4.0.0",
- "supports-color": "^7.0.0"
+ "argparse": "^2.0.1"
},
- "engines": {
- "node": ">=8"
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
}
},
- "node_modules/supports-hyperlinks/node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "node_modules/json-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+ "dev": true
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true,
- "engines": {
- "node": ">=8"
+ "license": "MIT"
+ },
+ "node_modules/json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
+ "dev": true
+ },
+ "node_modules/keyv": {
+ "version": "4.5.4",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "dev": true,
+ "dependencies": {
+ "json-buffer": "3.0.1"
}
},
- "node_modules/supports-hyperlinks/node_modules/supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "node_modules/levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
"dev": true,
"dependencies": {
- "has-flag": "^4.0.0"
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
},
"engines": {
- "node": ">=8"
+ "node": ">= 0.8.0"
}
},
- "node_modules/supports-preserve-symlinks-flag": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
- "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
+ "node_modules/locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dev": true,
+ "dependencies": {
+ "p-locate": "^5.0.0"
+ },
"engines": {
- "node": ">= 0.4"
+ "node": ">=10"
},
"funding": {
- "url": "https://github.com/sponsors/ljharb"
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/terser": {
- "version": "5.17.7",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.7.tgz",
- "integrity": "sha512-/bi0Zm2C6VAexlGgLlVxA0P2lru/sdLyfCVaRMfKVo9nWxbmz7f/sD8VPybPeSUJaJcwmCJis9pBIhcVcG1QcQ==",
+ "node_modules/lodash.merge": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true
+ },
+ "node_modules/loupe": {
+ "version": "3.1.4",
+ "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.4.tgz",
+ "integrity": "sha512-wJzkKwJrheKtknCOKNEtDK4iqg/MxmZheEMtSTYvnzRdEYaZzmgH976nenp8WdJRdx5Vc1X/9MO0Oszl6ezeXg==",
"dev": true,
- "dependencies": {
- "@jridgewell/source-map": "^0.3.3",
- "acorn": "^8.8.2",
- "commander": "^2.20.0",
- "source-map-support": "~0.5.20"
- },
- "bin": {
- "terser": "bin/terser"
- },
- "engines": {
- "node": ">=10"
- }
+ "license": "MIT"
},
- "node_modules/to-regex-range": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
- "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "node_modules/lru-cache": {
+ "version": "11.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.0.tgz",
+ "integrity": "sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==",
"dev": true,
- "dependencies": {
- "is-number": "^7.0.0"
- },
+ "license": "ISC",
"engines": {
- "node": ">=8.0"
+ "node": "20 || >=22"
}
},
- "node_modules/trim-newlines": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz",
- "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==",
+ "node_modules/magic-string": {
+ "version": "0.30.17",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz",
+ "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==",
"dev": true,
- "engines": {
- "node": ">=8"
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0"
}
},
- "node_modules/tsd": {
- "version": "0.31.2",
- "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.31.2.tgz",
- "integrity": "sha512-VplBAQwvYrHzVihtzXiUVXu5bGcr7uH1juQZ1lmKgkuGNGT+FechUCqmx9/zk7wibcqR2xaNEwCkDyKh+VVZnQ==",
+ "node_modules/magicast": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz",
+ "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@tsd/typescript": "~5.4.3",
- "eslint-formatter-pretty": "^4.1.0",
- "globby": "^11.0.1",
- "jest-diff": "^29.0.3",
- "meow": "^9.0.0",
- "path-exists": "^4.0.0",
- "read-pkg-up": "^7.0.0"
- },
- "bin": {
- "tsd": "dist/cli.js"
- },
- "engines": {
- "node": ">=14.16"
+ "@babel/parser": "^7.25.4",
+ "@babel/types": "^7.25.4",
+ "source-map-js": "^1.2.0"
}
},
- "node_modules/type-fest": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
- "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
+ "node_modules/make-dir": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
+ "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==",
"dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
"engines": {
"node": ">=10"
},
@@ -2483,2008 +2933,1373 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/validate-npm-package-license": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
- "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "node_modules/merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
"dev": true,
- "dependencies": {
- "spdx-correct": "^3.0.0",
- "spdx-expression-parse": "^3.0.0"
+ "license": "MIT",
+ "engines": {
+ "node": ">= 8"
}
},
- "node_modules/workerpool": {
- "version": "6.5.1",
- "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
- "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
- "dev": true,
- "license": "Apache-2.0"
- },
- "node_modules/wrap-ansi": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
- "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "node_modules/micromatch": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
+ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "ansi-styles": "^4.0.0",
- "string-width": "^4.1.0",
- "strip-ansi": "^6.0.0"
+ "braces": "^3.0.3",
+ "picomatch": "^2.3.1"
},
"engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ "node": ">=8.6"
}
},
- "node_modules/wrap-ansi/node_modules/ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
+ "license": "ISC",
"dependencies": {
- "color-convert": "^2.0.1"
+ "brace-expansion": "^1.1.7"
},
"engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ "node": "*"
}
},
- "node_modules/wrap-ansi/node_modules/color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "node_modules/minipass": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true,
- "dependencies": {
- "color-name": "~1.1.4"
- },
+ "license": "ISC",
"engines": {
- "node": ">=7.0.0"
+ "node": ">=16 || 14 >=14.17"
}
},
- "node_modules/wrap-ansi/node_modules/color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
- },
- "node_modules/wrappy": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
- "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
- "dev": true
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
},
- "node_modules/y18n": {
- "version": "5.0.8",
- "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
- "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "node_modules/nanoid": {
+ "version": "3.3.11",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
"dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
"engines": {
- "node": ">=10"
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
- "node_modules/yallist": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "node_modules/natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
"dev": true
},
- "node_modules/yargs": {
- "version": "16.2.0",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
- "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "node_modules/optionator": {
+ "version": "0.9.4",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
+ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
"dev": true,
"dependencies": {
- "cliui": "^7.0.2",
- "escalade": "^3.1.1",
- "get-caller-file": "^2.0.5",
- "require-directory": "^2.1.1",
- "string-width": "^4.2.0",
- "y18n": "^5.0.5",
- "yargs-parser": "^20.2.2"
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.5"
},
"engines": {
- "node": ">=10"
- }
- },
- "node_modules/yargs-parser": {
- "version": "20.2.9",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
- "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
- "dev": true,
- "license": "ISC",
- "engines": {
- "node": ">=10"
+ "node": ">= 0.8.0"
}
},
- "node_modules/yargs-unparser": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
- "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
+ "node_modules/p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"dev": true,
"dependencies": {
- "camelcase": "^6.0.0",
- "decamelize": "^4.0.0",
- "flat": "^5.0.2",
- "is-plain-obj": "^2.1.0"
+ "yocto-queue": "^0.1.0"
},
"engines": {
"node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/yocto-queue": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
- "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "node_modules/p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dev": true,
+ "dependencies": {
+ "p-limit": "^3.0.2"
+ },
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
- }
- },
- "dependencies": {
- "@babel/code-frame": {
- "version": "7.16.7",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz",
- "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==",
- "dev": true,
- "requires": {
- "@babel/highlight": "^7.16.7"
- }
},
- "@babel/helper-validator-identifier": {
- "version": "7.16.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz",
- "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==",
- "dev": true
- },
- "@babel/highlight": {
- "version": "7.16.10",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz",
- "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==",
+ "node_modules/package-json-from-dist": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz",
+ "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==",
"dev": true,
- "requires": {
- "@babel/helper-validator-identifier": "^7.16.7",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
+ "license": "BlueOak-1.0.0"
},
- "@jest/schemas": {
- "version": "29.4.3",
- "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.3.tgz",
- "integrity": "sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==",
+ "node_modules/parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
"dev": true,
- "requires": {
- "@sinclair/typebox": "^0.25.16"
+ "license": "MIT",
+ "dependencies": {
+ "callsites": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=6"
}
},
- "@jridgewell/gen-mapping": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
- "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true,
- "requires": {
- "@jridgewell/set-array": "^1.0.1",
- "@jridgewell/sourcemap-codec": "^1.4.10",
- "@jridgewell/trace-mapping": "^0.3.9"
+ "engines": {
+ "node": ">=8"
}
},
- "@jridgewell/resolve-uri": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
- "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
- "dev": true
- },
- "@jridgewell/set-array": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
- "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
- "dev": true
- },
- "@jridgewell/source-map": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz",
- "integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==",
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
- "requires": {
- "@jridgewell/gen-mapping": "^0.3.0",
- "@jridgewell/trace-mapping": "^0.3.9"
+ "engines": {
+ "node": ">=8"
}
},
- "@jridgewell/sourcemap-codec": {
- "version": "1.4.15",
- "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
- "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
- "dev": true
- },
- "@jridgewell/trace-mapping": {
- "version": "0.3.18",
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz",
- "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==",
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true,
- "requires": {
- "@jridgewell/resolve-uri": "3.1.0",
- "@jridgewell/sourcemap-codec": "1.4.14"
- },
- "dependencies": {
- "@jridgewell/sourcemap-codec": {
- "version": "1.4.14",
- "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
- "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
- "dev": true
- }
- }
+ "license": "MIT"
},
- "@nodelib/fs.scandir": {
- "version": "2.1.5",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
- "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "node_modules/path-scurry": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz",
+ "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==",
"dev": true,
- "requires": {
- "@nodelib/fs.stat": "2.0.5",
- "run-parallel": "^1.1.9"
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "lru-cache": "^11.0.0",
+ "minipass": "^7.1.2"
+ },
+ "engines": {
+ "node": "20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "@nodelib/fs.stat": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
- "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
- "dev": true
- },
- "@nodelib/fs.walk": {
- "version": "1.2.8",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
- "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
"dev": true,
- "requires": {
- "@nodelib/fs.scandir": "2.1.5",
- "fastq": "^1.6.0"
- }
+ "license": "MIT"
},
- "@rollup/plugin-terser": {
- "version": "0.4.4",
- "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz",
- "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==",
+ "node_modules/pathval": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz",
+ "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==",
"dev": true,
- "requires": {
- "serialize-javascript": "^6.0.1",
- "smob": "^1.0.0",
- "terser": "^5.17.4"
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14.16"
}
},
- "@rollup/rollup-android-arm-eabi": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.5.tgz",
- "integrity": "sha512-SU5cvamg0Eyu/F+kLeMXS7GoahL+OoizlclVFX3l5Ql6yNlywJJ0OuqTzUx0v+aHhPHEB/56CT06GQrRrGNYww==",
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"dev": true,
- "optional": true
+ "license": "ISC"
},
- "@rollup/rollup-android-arm64": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.5.tgz",
- "integrity": "sha512-S4pit5BP6E5R5C8S6tgU/drvgjtYW76FBuG6+ibG3tMvlD1h9LHVF9KmlmaUBQ8Obou7hEyS+0w+IR/VtxwNMQ==",
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
- "optional": true
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
},
- "@rollup/rollup-darwin-arm64": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.5.tgz",
- "integrity": "sha512-250ZGg4ipTL0TGvLlfACkIxS9+KLtIbn7BCZjsZj88zSg2Lvu3Xdw6dhAhfe/FjjXPVNCtcSp+WZjVsD3a/Zlw==",
+ "node_modules/postcss": {
+ "version": "8.5.6",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
+ "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
"dev": true,
- "optional": true
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.11",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.1"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
},
- "@rollup/rollup-darwin-x64": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.5.tgz",
- "integrity": "sha512-D8brJEFg5D+QxFcW6jYANu+Rr9SlKtTenmsX5hOSzNYVrK5oLAEMTUgKWYJP+wdKyCdeSwnapLsn+OVRFycuQg==",
+ "node_modules/prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"dev": true,
- "optional": true
+ "engines": {
+ "node": ">= 0.8.0"
+ }
},
- "@rollup/rollup-linux-arm-gnueabihf": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.5.tgz",
- "integrity": "sha512-PNqXYmdNFyWNg0ma5LdY8wP+eQfdvyaBAojAXgO7/gs0Q/6TQJVXAXe8gwW9URjbS0YAammur0fynYGiWsKlXw==",
+ "node_modules/prettier": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz",
+ "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
- "optional": true
- },
- "@rollup/rollup-linux-arm-musleabihf": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.5.tgz",
- "integrity": "sha512-kSSCZOKz3HqlrEuwKd9TYv7vxPYD77vHSUvM2y0YaTGnFc8AdI5TTQRrM1yIp3tXCKrSL9A7JLoILjtad5t8pQ==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-linux-arm64-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.5.tgz",
- "integrity": "sha512-oTXQeJHRbOnwRnRffb6bmqmUugz0glXaPyspp4gbQOPVApdpRrY/j7KP3lr7M8kTfQTyrBUzFjj5EuHAhqH4/w==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-linux-arm64-musl": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.5.tgz",
- "integrity": "sha512-qnOTIIs6tIGFKCHdhYitgC2XQ2X25InIbZFor5wh+mALH84qnFHvc+vmWUpyX97B0hNvwNUL4B+MB8vJvH65Fw==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-linux-powerpc64le-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.5.tgz",
- "integrity": "sha512-TMYu+DUdNlgBXING13rHSfUc3Ky5nLPbWs4bFnT+R6Vu3OvXkTkixvvBKk8uO4MT5Ab6lC3U7x8S8El2q5o56w==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-linux-riscv64-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.5.tgz",
- "integrity": "sha512-PTQq1Kz22ZRvuhr3uURH+U/Q/a0pbxJoICGSprNLAoBEkyD3Sh9qP5I0Asn0y0wejXQBbsVMRZRxlbGFD9OK4A==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-linux-s390x-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.5.tgz",
- "integrity": "sha512-bR5nCojtpuMss6TDEmf/jnBnzlo+6n1UhgwqUvRoe4VIotC7FG1IKkyJbwsT7JDsF2jxR+NTnuOwiGv0hLyDoQ==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-linux-x64-gnu": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.5.tgz",
- "integrity": "sha512-N0jPPhHjGShcB9/XXZQWuWBKZQnC1F36Ce3sDqWpujsGjDz/CQtOL9LgTrJ+rJC8MJeesMWrMWVLKKNR/tMOCA==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-linux-x64-musl": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.5.tgz",
- "integrity": "sha512-uBa2e28ohzNNwjr6Uxm4XyaA1M/8aTgfF2T7UIlElLaeXkgpmIJ2EitVNQxjO9xLLLy60YqAgKn/AqSpCUkE9g==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-win32-arm64-msvc": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.5.tgz",
- "integrity": "sha512-RXT8S1HP8AFN/Kr3tg4fuYrNxZ/pZf1HemC5Tsddc6HzgGnJm0+Lh5rAHJkDuW3StI0ynNXukidROMXYl6ew8w==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-win32-ia32-msvc": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.5.tgz",
- "integrity": "sha512-ElTYOh50InL8kzyUD6XsnPit7jYCKrphmddKAe1/Ytt74apOxDq5YEcbsiKs0fR3vff3jEneMM+3I7jbqaMyBg==",
- "dev": true,
- "optional": true
- },
- "@rollup/rollup-win32-x64-msvc": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.5.tgz",
- "integrity": "sha512-+lvL/4mQxSV8MukpkKyyvfwhH266COcWlXE/1qxwN08ajovta3459zrjLghYMgDerlzNwLAcFpvU+WWE5y6nAQ==",
- "dev": true,
- "optional": true
- },
- "@sinclair/typebox": {
- "version": "0.25.24",
- "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz",
- "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==",
- "dev": true
- },
- "@tsd/typescript": {
- "version": "5.4.5",
- "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.4.5.tgz",
- "integrity": "sha512-saiCxzHRhUrRxQV2JhH580aQUZiKQUXI38FcAcikcfOomAil4G4lxT0RfrrKywoAYP/rqAdYXYmNRLppcd+hQQ==",
- "dev": true
- },
- "@types/eslint": {
- "version": "7.29.0",
- "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz",
- "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==",
- "dev": true,
- "requires": {
- "@types/estree": "*",
- "@types/json-schema": "*"
- }
- },
- "@types/estree": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
- "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
- "dev": true
- },
- "@types/json-schema": {
- "version": "7.0.9",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz",
- "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==",
- "dev": true
- },
- "@types/minimist": {
- "version": "1.2.2",
- "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz",
- "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==",
- "dev": true
- },
- "@types/normalize-package-data": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz",
- "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
- "dev": true
- },
- "acorn": {
- "version": "8.8.2",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
- "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
- "dev": true
- },
- "ansi-colors": {
- "version": "4.1.3",
- "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
- "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
- "dev": true
- },
- "ansi-escapes": {
- "version": "4.3.2",
- "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
- "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
- "dev": true,
- "requires": {
- "type-fest": "^0.21.3"
+ "license": "MIT",
+ "bin": {
+ "prettier": "bin/prettier.cjs"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
}
},
- "ansi-regex": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
- "dev": true
- },
- "ansi-styles": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
- "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "node_modules/punycode": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"dev": true,
- "requires": {
- "color-convert": "^1.9.0"
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
}
},
- "anymatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
- "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
+ "node_modules/queue-microtask": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
"dev": true,
- "requires": {
- "normalize-path": "^3.0.0",
- "picomatch": "^2.0.4"
- }
- },
- "argparse": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
- "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
- "dev": true
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
},
- "array-union": {
+ "node_modules/randombytes": {
"version": "2.1.0",
- "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
- "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
- "dev": true
- },
- "arrify": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
- "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
- "dev": true
- },
- "balanced-match": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
- "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
- "dev": true
- },
- "binary-extensions": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
- "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
- "dev": true
- },
- "brace-expansion": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
- "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
- "dev": true,
- "requires": {
- "balanced-match": "^1.0.0"
- }
- },
- "braces": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
- "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
- "dev": true,
- "requires": {
- "fill-range": "^7.1.1"
- }
- },
- "browser-stdout": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
- "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
- "dev": true
- },
- "buffer-from": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
- "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
- "dev": true
- },
- "camelcase": {
- "version": "6.2.0",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
- "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==",
- "dev": true
- },
- "camelcase-keys": {
- "version": "6.2.2",
- "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz",
- "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"dev": true,
- "requires": {
- "camelcase": "^5.3.1",
- "map-obj": "^4.0.0",
- "quick-lru": "^4.0.1"
- },
+ "license": "MIT",
"dependencies": {
- "camelcase": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
- "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
- "dev": true
- }
+ "safe-buffer": "^5.1.0"
}
},
- "chalk": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
- "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "node_modules/resolve": {
+ "version": "1.22.10",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
+ "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==",
"dev": true,
- "requires": {
- "ansi-styles": "^3.2.1",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^5.3.0"
+ "license": "MIT",
+ "dependencies": {
+ "is-core-module": "^2.16.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
- "chokidar": {
- "version": "3.5.3",
- "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
- "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
+ "node_modules/resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
"dev": true,
- "requires": {
- "anymatch": "~3.1.2",
- "braces": "~3.0.2",
- "fsevents": "~2.3.2",
- "glob-parent": "~5.1.2",
- "is-binary-path": "~2.1.0",
- "is-glob": "~4.0.1",
- "normalize-path": "~3.0.0",
- "readdirp": "~3.6.0"
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
}
},
- "cliui": {
- "version": "7.0.4",
- "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
- "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+ "node_modules/resolve-pkg-maps": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
+ "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
"dev": true,
- "requires": {
- "string-width": "^4.2.0",
- "strip-ansi": "^6.0.0",
- "wrap-ansi": "^7.0.0"
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
}
},
- "color-convert": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
- "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "node_modules/reusify": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
+ "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
"dev": true,
- "requires": {
- "color-name": "1.1.3"
+ "license": "MIT",
+ "engines": {
+ "iojs": ">=1.0.0",
+ "node": ">=0.10.0"
}
},
- "color-name": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
- "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
- "dev": true
- },
- "commander": {
- "version": "2.20.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
- "dev": true
- },
- "debug": {
- "version": "4.3.5",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz",
- "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==",
+ "node_modules/rollup": {
+ "version": "4.46.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.46.1.tgz",
+ "integrity": "sha512-33xGNBsDJAkzt0PvninskHlWnTIPgDtTwhg0U38CUoNP/7H6wI2Cz6dUeoNPbjdTdsYTGuiFFASuUOWovH0SyQ==",
"dev": true,
- "requires": {
- "ms": "2.1.2"
- },
+ "license": "MIT",
"dependencies": {
- "ms": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "dev": true
- }
+ "@types/estree": "1.0.8"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.46.1",
+ "@rollup/rollup-android-arm64": "4.46.1",
+ "@rollup/rollup-darwin-arm64": "4.46.1",
+ "@rollup/rollup-darwin-x64": "4.46.1",
+ "@rollup/rollup-freebsd-arm64": "4.46.1",
+ "@rollup/rollup-freebsd-x64": "4.46.1",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.46.1",
+ "@rollup/rollup-linux-arm-musleabihf": "4.46.1",
+ "@rollup/rollup-linux-arm64-gnu": "4.46.1",
+ "@rollup/rollup-linux-arm64-musl": "4.46.1",
+ "@rollup/rollup-linux-loongarch64-gnu": "4.46.1",
+ "@rollup/rollup-linux-ppc64-gnu": "4.46.1",
+ "@rollup/rollup-linux-riscv64-gnu": "4.46.1",
+ "@rollup/rollup-linux-riscv64-musl": "4.46.1",
+ "@rollup/rollup-linux-s390x-gnu": "4.46.1",
+ "@rollup/rollup-linux-x64-gnu": "4.46.1",
+ "@rollup/rollup-linux-x64-musl": "4.46.1",
+ "@rollup/rollup-win32-arm64-msvc": "4.46.1",
+ "@rollup/rollup-win32-ia32-msvc": "4.46.1",
+ "@rollup/rollup-win32-x64-msvc": "4.46.1",
+ "fsevents": "~2.3.2"
}
},
- "decamelize": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
- "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
- "dev": true
- },
- "decamelize-keys": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz",
- "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=",
+ "node_modules/rollup-plugin-dts": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-6.2.1.tgz",
+ "integrity": "sha512-sR3CxYUl7i2CHa0O7bA45mCrgADyAQ0tVtGSqi3yvH28M+eg1+g5d7kQ9hLvEz5dorK3XVsH5L2jwHLQf72DzA==",
"dev": true,
- "requires": {
- "decamelize": "^1.1.0",
- "map-obj": "^1.0.0"
- },
+ "license": "LGPL-3.0-only",
"dependencies": {
- "decamelize": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
- "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
- "dev": true
- },
- "map-obj": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
- "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
- "dev": true
- }
+ "magic-string": "^0.30.17"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/Swatinem"
+ },
+ "optionalDependencies": {
+ "@babel/code-frame": "^7.26.2"
+ },
+ "peerDependencies": {
+ "rollup": "^3.29.4 || ^4",
+ "typescript": "^4.5 || ^5.0"
}
},
- "diff": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
- "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
- "dev": true
- },
- "diff-sequences": {
- "version": "29.4.3",
- "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz",
- "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==",
- "dev": true
- },
- "dir-glob": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
- "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
+ "node_modules/rollup-plugin-esbuild": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-esbuild/-/rollup-plugin-esbuild-6.2.1.tgz",
+ "integrity": "sha512-jTNOMGoMRhs0JuueJrJqbW8tOwxumaWYq+V5i+PD+8ecSCVkuX27tGW7BXqDgoULQ55rO7IdNxPcnsWtshz3AA==",
"dev": true,
- "requires": {
- "path-type": "^4.0.0"
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "es-module-lexer": "^1.6.0",
+ "get-tsconfig": "^4.10.0",
+ "unplugin-utils": "^0.2.4"
+ },
+ "engines": {
+ "node": ">=14.18.0"
+ },
+ "peerDependencies": {
+ "esbuild": ">=0.18.0",
+ "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0"
}
},
- "emoji-regex": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
- "dev": true
- },
- "error-ex": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
- "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "node_modules/run-parallel": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
"dev": true,
- "requires": {
- "is-arrayish": "^0.2.1"
- }
- },
- "escalade": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
- "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
- "dev": true
- },
- "escape-string-regexp": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
- "dev": true
- },
- "eslint-formatter-pretty": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-4.1.0.tgz",
- "integrity": "sha512-IsUTtGxF1hrH6lMWiSl1WbGaiP01eT6kzywdY1U+zLc0MP+nwEnUiS9UI8IaOTUhTeQJLlCEWIbXINBH4YJbBQ==",
- "dev": true,
- "requires": {
- "@types/eslint": "^7.2.13",
- "ansi-escapes": "^4.2.1",
- "chalk": "^4.1.0",
- "eslint-rule-docs": "^1.1.5",
- "log-symbols": "^4.0.0",
- "plur": "^4.0.0",
- "string-width": "^4.2.0",
- "supports-hyperlinks": "^2.0.0"
- },
- "dependencies": {
- "ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "dev": true,
- "requires": {
- "color-convert": "^2.0.1"
- }
- },
- "chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "dev": true,
- "requires": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- }
- },
- "color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "dev": true,
- "requires": {
- "color-name": "~1.1.4"
- }
- },
- "color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
},
- "has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
- "dev": true
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
},
- "supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
- "dev": true,
- "requires": {
- "has-flag": "^4.0.0"
- }
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
}
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "queue-microtask": "^1.2.2"
}
},
- "eslint-rule-docs": {
- "version": "1.1.231",
- "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.231.tgz",
- "integrity": "sha512-egHz9A1WG7b8CS0x1P6P/Rj5FqZOjray/VjpJa14tMZalfRKvpE2ONJ3plCM7+PcinmU4tcmbPLv0VtwzSdLVA==",
- "dev": true
- },
- "expect.js": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.3.1.tgz",
- "integrity": "sha512-okDF/FAPEul1ZFLae4hrgpIqAeapoo5TRdcg/lD0iN9S3GWrBFIJwNezGH1DMtIz+RxU4RrFmMq7WUUvDg3J6A==",
- "dev": true
- },
- "fast-glob": {
- "version": "3.2.11",
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
- "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
- "dev": true,
- "requires": {
- "@nodelib/fs.stat": "^2.0.2",
- "@nodelib/fs.walk": "^1.2.3",
- "glob-parent": "^5.1.2",
- "merge2": "^1.3.0",
- "micromatch": "^4.0.4"
- }
- },
- "fastq": {
- "version": "1.13.0",
- "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz",
- "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==",
- "dev": true,
- "requires": {
- "reusify": "^1.0.4"
- }
- },
- "fill-range": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
- "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true,
- "requires": {
- "to-regex-range": "^5.0.1"
- }
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
},
- "find-up": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
- "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "node_modules/semver": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
+ "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
"dev": true,
- "requires": {
- "locate-path": "^6.0.0",
- "path-exists": "^4.0.0"
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
}
},
- "flat": {
- "version": "5.0.2",
- "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
- "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
- "dev": true
- },
- "fs.realpath": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
- "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
- "dev": true
- },
- "fsevents": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
- "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
- "dev": true,
- "optional": true
- },
- "function-bind": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
- "dev": true
- },
- "get-caller-file": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
- "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
- "dev": true
- },
- "glob": {
- "version": "8.1.0",
- "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
- "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
+ "node_modules/serialize-javascript": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
+ "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"dev": true,
- "requires": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^5.0.1",
- "once": "^1.3.0"
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "randombytes": "^2.1.0"
}
},
- "glob-parent": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
- "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
- "requires": {
- "is-glob": "^4.0.1"
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
}
},
- "globby": {
- "version": "11.1.0",
- "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
- "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
- "requires": {
- "array-union": "^2.1.0",
- "dir-glob": "^3.0.1",
- "fast-glob": "^3.2.9",
- "ignore": "^5.2.0",
- "merge2": "^1.4.1",
- "slash": "^3.0.0"
+ "engines": {
+ "node": ">=8"
}
},
- "hard-rejection": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz",
- "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==",
- "dev": true
- },
- "has": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "node_modules/siginfo": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",
"dev": true,
- "requires": {
- "function-bind": "^1.1.1"
- }
- },
- "has-flag": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
- "dev": true
- },
- "he": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
- "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
- "dev": true
+ "license": "ISC"
},
- "hosted-git-info": {
+ "node_modules/signal-exit": {
"version": "4.1.0",
- "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz",
- "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
+ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true,
- "requires": {
- "lru-cache": "^6.0.0"
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "ignore": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
- "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==",
- "dev": true
- },
- "indent-string": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
- "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
- "dev": true
- },
- "inflight": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
- "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
+ "node_modules/smob": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz",
+ "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==",
"dev": true,
- "requires": {
- "once": "^1.3.0",
- "wrappy": "1"
- }
- },
- "inherits": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
- "dev": true
- },
- "irregular-plurals": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.3.0.tgz",
- "integrity": "sha512-MVBLKUTangM3EfRPFROhmWQQKRDsrgI83J8GS3jXy+OwYqiR2/aoWndYQ5416jLE3uaGgLH7ncme3X9y09gZ3g==",
- "dev": true
- },
- "is-arrayish": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
- "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
- "dev": true
+ "license": "MIT"
},
- "is-binary-path": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
- "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
- "requires": {
- "binary-extensions": "^2.0.0"
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
}
},
- "is-core-module": {
- "version": "2.8.1",
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz",
- "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==",
+ "node_modules/source-map-js": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"dev": true,
- "requires": {
- "has": "^1.0.3"
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
}
},
- "is-extglob": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
- "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
- "dev": true
- },
- "is-fullwidth-code-point": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
- "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
- "dev": true
- },
- "is-glob": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
- "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "node_modules/source-map-support": {
+ "version": "0.5.21",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
+ "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"dev": true,
- "requires": {
- "is-extglob": "^2.1.1"
+ "license": "MIT",
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
}
},
- "is-number": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
- "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
- "dev": true
- },
- "is-plain-obj": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
- "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
- "dev": true
- },
- "is-unicode-supported": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
- "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
- "dev": true
- },
- "jest-diff": {
- "version": "29.5.0",
- "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.5.0.tgz",
- "integrity": "sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==",
+ "node_modules/stackback": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",
"dev": true,
- "requires": {
- "chalk": "^4.0.0",
- "diff-sequences": "^29.4.3",
- "jest-get-type": "^29.4.3",
- "pretty-format": "^29.5.0"
- },
- "dependencies": {
- "ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "dev": true,
- "requires": {
- "color-convert": "^2.0.1"
- }
- },
- "chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "dev": true,
- "requires": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- }
- },
- "color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "dev": true,
- "requires": {
- "color-name": "~1.1.4"
- }
- },
- "color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
- },
- "has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
- "dev": true
- },
- "supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
- "dev": true,
- "requires": {
- "has-flag": "^4.0.0"
- }
- }
- }
- },
- "jest-get-type": {
- "version": "29.4.3",
- "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz",
- "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==",
- "dev": true
+ "license": "MIT"
},
- "js-tokens": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
- "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
- "dev": true
+ "node_modules/std-env": {
+ "version": "3.9.0",
+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz",
+ "integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==",
+ "dev": true,
+ "license": "MIT"
},
- "js-yaml": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
- "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
- "requires": {
- "argparse": "^2.0.1"
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
}
},
- "json-parse-even-better-errors": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
- "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
- "dev": true
- },
- "kind-of": {
- "version": "6.0.3",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
- "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
- "dev": true
- },
- "lines-and-columns": {
- "version": "1.2.4",
- "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
- "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
- "dev": true
- },
- "locate-path": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
- "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "node_modules/string-width-cjs": {
+ "name": "string-width",
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
- "requires": {
- "p-locate": "^5.0.0"
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
}
},
- "log-symbols": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
- "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
- "dev": true,
- "requires": {
- "chalk": "^4.1.0",
- "is-unicode-supported": "^0.1.0"
- },
- "dependencies": {
- "ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "dev": true,
- "requires": {
- "color-convert": "^2.0.1"
- }
- },
- "chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "dev": true,
- "requires": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- }
- },
- "color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "dev": true,
- "requires": {
- "color-name": "~1.1.4"
- }
- },
- "color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
- },
- "has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
- "dev": true
- },
- "supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
- "dev": true,
- "requires": {
- "has-flag": "^4.0.0"
- }
- }
+ "node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
}
},
- "lru-cache": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
- "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "node_modules/strip-ansi-cjs": {
+ "name": "strip-ansi",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
- "requires": {
- "yallist": "^4.0.0"
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
}
},
- "map-obj": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",
- "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==",
- "dev": true
- },
- "meow": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz",
- "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==",
- "dev": true,
- "requires": {
- "@types/minimist": "^1.2.0",
- "camelcase-keys": "^6.2.2",
- "decamelize": "^1.2.0",
- "decamelize-keys": "^1.1.0",
- "hard-rejection": "^2.1.0",
- "minimist-options": "4.1.0",
- "normalize-package-data": "^3.0.0",
- "read-pkg-up": "^7.0.1",
- "redent": "^3.0.0",
- "trim-newlines": "^3.0.0",
- "type-fest": "^0.18.0",
- "yargs-parser": "^20.2.3"
- },
- "dependencies": {
- "decamelize": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
- "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
- "dev": true
- },
- "type-fest": {
- "version": "0.18.1",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz",
- "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==",
- "dev": true
- }
+ "node_modules/strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
- "merge2": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
- "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
- "dev": true
- },
- "micromatch": {
- "version": "4.0.8",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
- "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
+ "node_modules/strip-literal": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.0.0.tgz",
+ "integrity": "sha512-TcccoMhJOM3OebGhSBEmp3UZ2SfDMZUEBdRA/9ynfLi8yYajyWX3JiXArcJt4Umh4vISpspkQIY8ZZoCqjbviA==",
"dev": true,
- "requires": {
- "braces": "^3.0.3",
- "picomatch": "^2.3.1"
+ "license": "MIT",
+ "dependencies": {
+ "js-tokens": "^9.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/antfu"
}
},
- "min-indent": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
- "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
- "dev": true
- },
- "minimatch": {
- "version": "5.1.6",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
- "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
+ "node_modules/strip-literal/node_modules/js-tokens": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz",
+ "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==",
"dev": true,
- "requires": {
- "brace-expansion": "^2.0.1"
- }
+ "license": "MIT"
},
- "minimist-options": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz",
- "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==",
+ "node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
- "requires": {
- "arrify": "^1.0.1",
- "is-plain-obj": "^1.1.0",
- "kind-of": "^6.0.3"
- },
+ "license": "MIT",
"dependencies": {
- "is-plain-obj": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
- "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
- "dev": true
- }
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
}
},
- "mocha": {
- "version": "10.7.3",
- "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.3.tgz",
- "integrity": "sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==",
+ "node_modules/supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true,
- "requires": {
- "ansi-colors": "^4.1.3",
- "browser-stdout": "^1.3.1",
- "chokidar": "^3.5.3",
- "debug": "^4.3.5",
- "diff": "^5.2.0",
- "escape-string-regexp": "^4.0.0",
- "find-up": "^5.0.0",
- "glob": "^8.1.0",
- "he": "^1.2.0",
- "js-yaml": "^4.1.0",
- "log-symbols": "^4.1.0",
- "minimatch": "^5.1.6",
- "ms": "^2.1.3",
- "serialize-javascript": "^6.0.2",
- "strip-json-comments": "^3.1.1",
- "supports-color": "^8.1.1",
- "workerpool": "^6.5.1",
- "yargs": "^16.2.0",
- "yargs-parser": "^20.2.9",
- "yargs-unparser": "^2.0.0"
- },
- "dependencies": {
- "escape-string-regexp": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
- "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
- "dev": true
- },
- "has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
- "dev": true
- },
- "supports-color": {
- "version": "8.1.1",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
- "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
- "dev": true,
- "requires": {
- "has-flag": "^4.0.0"
- }
- }
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
- "ms": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
- "dev": true
- },
- "normalize-package-data": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz",
- "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==",
+ "node_modules/terser": {
+ "version": "5.43.1",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz",
+ "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==",
"dev": true,
- "requires": {
- "hosted-git-info": "^4.0.1",
- "is-core-module": "^2.5.0",
- "semver": "^7.3.4",
- "validate-npm-package-license": "^3.0.1"
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@jridgewell/source-map": "^0.3.3",
+ "acorn": "^8.14.0",
+ "commander": "^2.20.0",
+ "source-map-support": "~0.5.20"
+ },
+ "bin": {
+ "terser": "bin/terser"
+ },
+ "engines": {
+ "node": ">=10"
}
},
- "normalize-path": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
- "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
- "dev": true
- },
- "once": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
- "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+ "node_modules/test-exclude": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz",
+ "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==",
"dev": true,
- "requires": {
- "wrappy": "1"
+ "license": "ISC",
+ "dependencies": {
+ "@istanbuljs/schema": "^0.1.2",
+ "glob": "^10.4.1",
+ "minimatch": "^9.0.4"
+ },
+ "engines": {
+ "node": ">=18"
}
},
- "p-limit": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
- "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "node_modules/test-exclude/node_modules/brace-expansion": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
+ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"dev": true,
- "requires": {
- "yocto-queue": "^0.1.0"
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
}
},
- "p-locate": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
- "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "node_modules/test-exclude/node_modules/glob": {
+ "version": "10.4.5",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
+ "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
"dev": true,
- "requires": {
- "p-limit": "^3.0.2"
+ "license": "ISC",
+ "dependencies": {
+ "foreground-child": "^3.1.0",
+ "jackspeak": "^3.1.2",
+ "minimatch": "^9.0.4",
+ "minipass": "^7.1.2",
+ "package-json-from-dist": "^1.0.0",
+ "path-scurry": "^1.11.1"
+ },
+ "bin": {
+ "glob": "dist/esm/bin.mjs"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "p-try": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
- "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
- "dev": true
- },
- "parse-json": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
- "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
+ "node_modules/test-exclude/node_modules/jackspeak": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
+ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
"dev": true,
- "requires": {
- "@babel/code-frame": "^7.0.0",
- "error-ex": "^1.3.1",
- "json-parse-even-better-errors": "^2.3.0",
- "lines-and-columns": "^1.1.6"
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "@isaacs/cliui": "^8.0.2"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ },
+ "optionalDependencies": {
+ "@pkgjs/parseargs": "^0.11.0"
}
},
- "path-exists": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
- "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
- "dev": true
- },
- "path-parse": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
- "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
- "dev": true
- },
- "path-type": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
- "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
- "dev": true
- },
- "picomatch": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
- "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
- "dev": true
+ "node_modules/test-exclude/node_modules/lru-cache": {
+ "version": "10.4.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
+ "dev": true,
+ "license": "ISC"
},
- "plur": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz",
- "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==",
+ "node_modules/test-exclude/node_modules/minimatch": {
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
- "requires": {
- "irregular-plurals": "^3.2.0"
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "pretty-format": {
- "version": "29.5.0",
- "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.5.0.tgz",
- "integrity": "sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==",
+ "node_modules/test-exclude/node_modules/path-scurry": {
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
+ "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"dev": true,
- "requires": {
- "@jest/schemas": "^29.4.3",
- "ansi-styles": "^5.0.0",
- "react-is": "^18.0.0"
- },
+ "license": "BlueOak-1.0.0",
"dependencies": {
- "ansi-styles": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
- "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
- "dev": true
- }
+ "lru-cache": "^10.2.0",
+ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
- "queue-microtask": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
- "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
- "dev": true
+ "node_modules/tinybench": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",
+ "dev": true,
+ "license": "MIT"
},
- "quick-lru": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz",
- "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==",
- "dev": true
+ "node_modules/tinyexec": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz",
+ "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==",
+ "dev": true,
+ "license": "MIT"
},
- "randombytes": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
- "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "node_modules/tinyglobby": {
+ "version": "0.2.14",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz",
+ "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==",
"dev": true,
- "requires": {
- "safe-buffer": "^5.1.0"
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.4.4",
+ "picomatch": "^4.0.2"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
}
},
- "react-is": {
- "version": "18.2.0",
- "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
- "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==",
- "dev": true
- },
- "read-pkg": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz",
- "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==",
+ "node_modules/tinyglobby/node_modules/fdir": {
+ "version": "6.4.6",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz",
+ "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==",
"dev": true,
- "requires": {
- "@types/normalize-package-data": "^2.4.0",
- "normalize-package-data": "^2.5.0",
- "parse-json": "^5.0.0",
- "type-fest": "^0.6.0"
+ "license": "MIT",
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
},
- "dependencies": {
- "hosted-git-info": {
- "version": "2.8.9",
- "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
- "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
- "dev": true
- },
- "normalize-package-data": {
- "version": "2.5.0",
- "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
- "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
- "dev": true,
- "requires": {
- "hosted-git-info": "^2.1.4",
- "resolve": "^1.10.0",
- "semver": "2 || 3 || 4 || 5",
- "validate-npm-package-license": "^3.0.1"
- }
- },
- "semver": {
- "version": "5.7.2",
- "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
- "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
- "dev": true
- },
- "type-fest": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",
- "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==",
- "dev": true
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
}
}
},
- "read-pkg-up": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz",
- "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==",
- "dev": true,
- "requires": {
- "find-up": "^4.1.0",
- "read-pkg": "^5.2.0",
- "type-fest": "^0.8.1"
- },
- "dependencies": {
- "find-up": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
- "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
- "dev": true,
- "requires": {
- "locate-path": "^5.0.0",
- "path-exists": "^4.0.0"
- }
- },
- "locate-path": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
- "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
- "dev": true,
- "requires": {
- "p-locate": "^4.1.0"
- }
- },
- "p-limit": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
- "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
- "dev": true,
- "requires": {
- "p-try": "^2.0.0"
- }
- },
- "p-locate": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
- "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
- "dev": true,
- "requires": {
- "p-limit": "^2.2.0"
- }
- },
- "type-fest": {
- "version": "0.8.1",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
- "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
- "dev": true
- }
+ "node_modules/tinyglobby/node_modules/picomatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz",
+ "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
}
},
- "readdirp": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
- "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "node_modules/tinypool": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz",
+ "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==",
"dev": true,
- "requires": {
- "picomatch": "^2.2.1"
+ "license": "MIT",
+ "engines": {
+ "node": "^18.0.0 || >=20.0.0"
}
},
- "redent": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz",
- "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==",
+ "node_modules/tinyrainbow": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz",
+ "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==",
"dev": true,
- "requires": {
- "indent-string": "^4.0.0",
- "strip-indent": "^3.0.0"
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
}
},
- "require-directory": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
- "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
- "dev": true
+ "node_modules/tinyspy": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.3.tgz",
+ "integrity": "sha512-t2T/WLB2WRgZ9EpE4jgPJ9w+i66UZfDc8wHh0xrwiRNN+UwH98GIJkTeZqX9rg0i0ptwzqW+uYeIF0T4F8LR7A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
},
- "resolve": {
- "version": "1.22.0",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz",
- "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
- "requires": {
- "is-core-module": "^2.8.1",
- "path-parse": "^1.0.7",
- "supports-preserve-symlinks-flag": "^1.0.0"
+ "license": "MIT",
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
}
},
- "reusify": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
- "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
- "dev": true
- },
- "rollup": {
- "version": "4.22.5",
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.5.tgz",
- "integrity": "sha512-WoinX7GeQOFMGznEcWA1WrTQCd/tpEbMkc3nuMs9BT0CPjMdSjPMTVClwWd4pgSQwJdP65SK9mTCNvItlr5o7w==",
- "dev": true,
- "requires": {
- "@rollup/rollup-android-arm-eabi": "4.22.5",
- "@rollup/rollup-android-arm64": "4.22.5",
- "@rollup/rollup-darwin-arm64": "4.22.5",
- "@rollup/rollup-darwin-x64": "4.22.5",
- "@rollup/rollup-linux-arm-gnueabihf": "4.22.5",
- "@rollup/rollup-linux-arm-musleabihf": "4.22.5",
- "@rollup/rollup-linux-arm64-gnu": "4.22.5",
- "@rollup/rollup-linux-arm64-musl": "4.22.5",
- "@rollup/rollup-linux-powerpc64le-gnu": "4.22.5",
- "@rollup/rollup-linux-riscv64-gnu": "4.22.5",
- "@rollup/rollup-linux-s390x-gnu": "4.22.5",
- "@rollup/rollup-linux-x64-gnu": "4.22.5",
- "@rollup/rollup-linux-x64-musl": "4.22.5",
- "@rollup/rollup-win32-arm64-msvc": "4.22.5",
- "@rollup/rollup-win32-ia32-msvc": "4.22.5",
- "@rollup/rollup-win32-x64-msvc": "4.22.5",
- "@types/estree": "1.0.6",
- "fsevents": "~2.3.2"
+ "node_modules/ts-api-utils": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
+ "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.12"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4"
}
},
- "run-parallel": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
- "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+ "node_modules/tsx": {
+ "version": "4.20.3",
+ "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.3.tgz",
+ "integrity": "sha512-qjbnuR9Tr+FJOMBqJCW5ehvIo/buZq7vH7qD7JziU98h6l3qGy0a/yPFjwO+y0/T7GFpNgNAvEcPPVfyT8rrPQ==",
"dev": true,
- "requires": {
- "queue-microtask": "^1.2.2"
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "~0.25.0",
+ "get-tsconfig": "^4.7.5"
+ },
+ "bin": {
+ "tsx": "dist/cli.mjs"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
}
},
- "safe-buffer": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "dev": true
- },
- "semver": {
- "version": "7.5.4",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
- "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
+ "node_modules/type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
"dev": true,
- "requires": {
- "lru-cache": "^6.0.0"
+ "dependencies": {
+ "prelude-ls": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
}
},
- "serialize-javascript": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
- "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
+ "node_modules/typescript": {
+ "version": "5.8.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
+ "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
"dev": true,
- "requires": {
- "randombytes": "^2.1.0"
+ "license": "Apache-2.0",
+ "peer": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
}
},
- "slash": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
- "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
- "dev": true
- },
- "smob": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/smob/-/smob-1.4.0.tgz",
- "integrity": "sha512-MqR3fVulhjWuRNSMydnTlweu38UhQ0HXM4buStD/S3mc/BzX3CuM9OmhyQpmtYCvoYdl5ris6TI0ZqH355Ymqg==",
- "dev": true
+ "node_modules/typescript-eslint": {
+ "version": "8.38.0",
+ "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.38.0.tgz",
+ "integrity": "sha512-FsZlrYK6bPDGoLeZRuvx2v6qrM03I0U0SnfCLPs/XCCPCFD80xU9Pg09H/K+XFa68uJuZo7l/Xhs+eDRg2l3hg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/eslint-plugin": "8.38.0",
+ "@typescript-eslint/parser": "8.38.0",
+ "@typescript-eslint/typescript-estree": "8.38.0",
+ "@typescript-eslint/utils": "8.38.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0",
+ "typescript": ">=4.8.4 <5.9.0"
+ }
},
- "source-map": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
- "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
- "dev": true
+ "node_modules/undici-types": {
+ "version": "7.8.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
+ "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
+ "dev": true,
+ "license": "MIT"
},
- "source-map-support": {
- "version": "0.5.21",
- "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
- "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
+ "node_modules/unplugin-utils": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/unplugin-utils/-/unplugin-utils-0.2.4.tgz",
+ "integrity": "sha512-8U/MtpkPkkk3Atewj1+RcKIjb5WBimZ/WSLhhR3w6SsIj8XJuKTacSP8g+2JhfSGw0Cb125Y+2zA/IzJZDVbhA==",
"dev": true,
- "requires": {
- "buffer-from": "^1.0.0",
- "source-map": "^0.6.0"
+ "license": "MIT",
+ "dependencies": {
+ "pathe": "^2.0.2",
+ "picomatch": "^4.0.2"
+ },
+ "engines": {
+ "node": ">=18.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sxzz"
}
},
- "spdx-correct": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
- "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "node_modules/unplugin-utils/node_modules/picomatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz",
+ "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
"dev": true,
- "requires": {
- "spdx-expression-parse": "^3.0.0",
- "spdx-license-ids": "^3.0.0"
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
}
},
- "spdx-exceptions": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
- "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
- "dev": true
- },
- "spdx-expression-parse": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
- "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"dev": true,
- "requires": {
- "spdx-exceptions": "^2.1.0",
- "spdx-license-ids": "^3.0.0"
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "punycode": "^2.1.0"
}
},
- "spdx-license-ids": {
- "version": "3.0.11",
- "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz",
- "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==",
- "dev": true
- },
- "string-width": {
- "version": "4.2.3",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
- "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "node_modules/vite": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.3.tgz",
+ "integrity": "sha512-y2L5oJZF7bj4c0jgGYgBNSdIu+5HF+m68rn2cQXFbGoShdhV1phX9rbnxy9YXj82aS8MMsCLAAFkRxZeWdldrQ==",
"dev": true,
- "requires": {
- "emoji-regex": "^8.0.0",
- "is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.1"
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "^0.25.0",
+ "fdir": "^6.4.6",
+ "picomatch": "^4.0.2",
+ "postcss": "^8.5.6",
+ "rollup": "^4.40.0",
+ "tinyglobby": "^0.2.14"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^20.19.0 || >=22.12.0",
+ "jiti": ">=1.21.0",
+ "less": "^4.0.0",
+ "lightningcss": "^1.21.0",
+ "sass": "^1.70.0",
+ "sass-embedded": "^1.70.0",
+ "stylus": ">=0.54.8",
+ "sugarss": "^5.0.0",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "lightningcss": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
}
},
- "strip-ansi": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
- "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "node_modules/vite-node": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz",
+ "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==",
"dev": true,
- "requires": {
- "ansi-regex": "^5.0.1"
+ "license": "MIT",
+ "dependencies": {
+ "cac": "^6.7.14",
+ "debug": "^4.4.1",
+ "es-module-lexer": "^1.7.0",
+ "pathe": "^2.0.3",
+ "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0"
+ },
+ "bin": {
+ "vite-node": "vite-node.mjs"
+ },
+ "engines": {
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
}
},
- "strip-indent": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
- "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
+ "node_modules/vite/node_modules/fdir": {
+ "version": "6.4.6",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz",
+ "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==",
"dev": true,
- "requires": {
- "min-indent": "^1.0.0"
+ "license": "MIT",
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
}
},
- "strip-json-comments": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
- "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
- "dev": true
- },
- "supports-color": {
- "version": "5.5.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
- "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "node_modules/vite/node_modules/picomatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz",
+ "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
"dev": true,
- "requires": {
- "has-flag": "^3.0.0"
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
}
},
- "supports-hyperlinks": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz",
- "integrity": "sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ==",
+ "node_modules/vitest": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.4.tgz",
+ "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==",
"dev": true,
- "requires": {
- "has-flag": "^4.0.0",
- "supports-color": "^7.0.0"
- },
+ "license": "MIT",
"dependencies": {
- "has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
- "dev": true
+ "@types/chai": "^5.2.2",
+ "@vitest/expect": "3.2.4",
+ "@vitest/mocker": "3.2.4",
+ "@vitest/pretty-format": "^3.2.4",
+ "@vitest/runner": "3.2.4",
+ "@vitest/snapshot": "3.2.4",
+ "@vitest/spy": "3.2.4",
+ "@vitest/utils": "3.2.4",
+ "chai": "^5.2.0",
+ "debug": "^4.4.1",
+ "expect-type": "^1.2.1",
+ "magic-string": "^0.30.17",
+ "pathe": "^2.0.3",
+ "picomatch": "^4.0.2",
+ "std-env": "^3.9.0",
+ "tinybench": "^2.9.0",
+ "tinyexec": "^0.3.2",
+ "tinyglobby": "^0.2.14",
+ "tinypool": "^1.1.1",
+ "tinyrainbow": "^2.0.0",
+ "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0",
+ "vite-node": "3.2.4",
+ "why-is-node-running": "^2.3.0"
+ },
+ "bin": {
+ "vitest": "vitest.mjs"
+ },
+ "engines": {
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@edge-runtime/vm": "*",
+ "@types/debug": "^4.1.12",
+ "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
+ "@vitest/browser": "3.2.4",
+ "@vitest/ui": "3.2.4",
+ "happy-dom": "*",
+ "jsdom": "*"
+ },
+ "peerDependenciesMeta": {
+ "@edge-runtime/vm": {
+ "optional": true
},
- "supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
- "dev": true,
- "requires": {
- "has-flag": "^4.0.0"
- }
+ "@types/debug": {
+ "optional": true
+ },
+ "@types/node": {
+ "optional": true
+ },
+ "@vitest/browser": {
+ "optional": true
+ },
+ "@vitest/ui": {
+ "optional": true
+ },
+ "happy-dom": {
+ "optional": true
+ },
+ "jsdom": {
+ "optional": true
}
}
},
- "supports-preserve-symlinks-flag": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
- "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
- "dev": true
- },
- "terser": {
- "version": "5.17.7",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.7.tgz",
- "integrity": "sha512-/bi0Zm2C6VAexlGgLlVxA0P2lru/sdLyfCVaRMfKVo9nWxbmz7f/sD8VPybPeSUJaJcwmCJis9pBIhcVcG1QcQ==",
+ "node_modules/vitest/node_modules/picomatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz",
+ "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
"dev": true,
- "requires": {
- "@jridgewell/source-map": "^0.3.3",
- "acorn": "^8.8.2",
- "commander": "^2.20.0",
- "source-map-support": "~0.5.20"
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
}
},
- "to-regex-range": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
- "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "node_modules/which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
- "requires": {
- "is-number": "^7.0.0"
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
}
},
- "trim-newlines": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz",
- "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==",
- "dev": true
- },
- "tsd": {
- "version": "0.31.2",
- "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.31.2.tgz",
- "integrity": "sha512-VplBAQwvYrHzVihtzXiUVXu5bGcr7uH1juQZ1lmKgkuGNGT+FechUCqmx9/zk7wibcqR2xaNEwCkDyKh+VVZnQ==",
- "dev": true,
- "requires": {
- "@tsd/typescript": "~5.4.3",
- "eslint-formatter-pretty": "^4.1.0",
- "globby": "^11.0.1",
- "jest-diff": "^29.0.3",
- "meow": "^9.0.0",
- "path-exists": "^4.0.0",
- "read-pkg-up": "^7.0.0"
- }
- },
- "type-fest": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
- "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
- "dev": true
- },
- "validate-npm-package-license": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
- "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "node_modules/why-is-node-running": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",
"dev": true,
- "requires": {
- "spdx-correct": "^3.0.0",
- "spdx-expression-parse": "^3.0.0"
+ "license": "MIT",
+ "dependencies": {
+ "siginfo": "^2.0.0",
+ "stackback": "0.0.2"
+ },
+ "bin": {
+ "why-is-node-running": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
}
},
- "workerpool": {
- "version": "6.5.1",
- "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
- "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
- "dev": true
+ "node_modules/word-wrap": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
},
- "wrap-ansi": {
+ "node_modules/wrap-ansi-cjs": {
+ "name": "wrap-ansi",
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
- "requires": {
+ "license": "MIT",
+ "dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
- "dependencies": {
- "ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "dev": true,
- "requires": {
- "color-convert": "^2.0.1"
- }
- },
- "color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "dev": true,
- "requires": {
- "color-name": "~1.1.4"
- }
- },
- "color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
- }
- }
- },
- "wrappy": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
- "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
- "dev": true
- },
- "y18n": {
- "version": "5.0.8",
- "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
- "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
- "dev": true
- },
- "yallist": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
- },
- "yargs": {
- "version": "16.2.0",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
- "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
- "dev": true,
- "requires": {
- "cliui": "^7.0.2",
- "escalade": "^3.1.1",
- "get-caller-file": "^2.0.5",
- "require-directory": "^2.1.1",
- "string-width": "^4.2.0",
- "y18n": "^5.0.5",
- "yargs-parser": "^20.2.2"
- }
- },
- "yargs-parser": {
- "version": "20.2.9",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
- "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
- "dev": true
- },
- "yargs-unparser": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
- "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
- "dev": true,
- "requires": {
- "camelcase": "^6.0.0",
- "decamelize": "^4.0.0",
- "flat": "^5.0.2",
- "is-plain-obj": "^2.1.0"
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
- "yocto-queue": {
+ "node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
- "dev": true
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
}
}
}
diff --git a/package.json b/package.json
index 2582bd6..8a3c07e 100644
--- a/package.json
+++ b/package.json
@@ -1,58 +1,74 @@
{
"name": "date-and-time",
- "version": "3.6.0",
- "description": "A Minimalist DateTime utility for Node.js and the browser",
- "main": "date-and-time.js",
- "module": "esm/date-and-time.es.js",
- "types": "date-and-time.d.ts",
- "unpkg": "date-and-time.min.js",
+ "version": "4.0.0",
+ "description": "The simplest and most user-friendly date and time manipulation library",
+ "main": "dist/index.js",
+ "types": "dist/index.d.ts",
"exports": {
".": {
- "types": "./date-and-time.d.ts",
- "import": "./esm/date-and-time.mjs",
- "require": "./date-and-time.js",
- "browser": "./esm/date-and-time.es.js"
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.js",
+ "require": "./dist/index.cjs"
},
- "./locale/*": {
- "types": "./locale/*.d.ts",
- "import": "./esm/locale/*.mjs",
- "require": "./locale/*.js",
- "browser": "./esm/locale/*.es.js"
+ "./plugin": {
+ "types": "./dist/plugin.d.ts",
+ "import": "./dist/plugin.js",
+ "require": "./dist/plugin.cjs"
},
- "./plugin/*": {
- "types": "./plugin/*.d.ts",
- "import": "./esm/plugin/*.mjs",
- "require": "./plugin/*.js",
- "browser": "./esm/plugin/*.es.js"
+ "./locales/*": {
+ "import": "./dist/locales/*.js",
+ "require": "./dist/locales/*.cjs"
+ },
+ "./numerals/*": {
+ "import": "./dist/numerals/*.js",
+ "require": "./dist/numerals/*.cjs"
+ },
+ "./plugins/*": {
+ "types": "./dist/plugins/*.d.ts",
+ "import": "./dist/plugins/*.js",
+ "require": "./dist/plugins/*.cjs"
+ },
+ "./timezones/*": {
+ "import": "./dist/timezones/*.js",
+ "require": "./dist/timezones/*.cjs"
}
},
+ "files": [
+ "LICENSE",
+ "README.md",
+ "dist/",
+ "docs/"
+ ],
"scripts": {
"build": "rollup -c",
- "test": "./test.sh",
- "test:ts": "tsd ./test/ts"
+ "build-watch": "rollup -c --watch",
+ "build:ts": "rollup -c --config-ts",
+ "build:types": "rollup -c --config-types",
+ "lint": "eslint src",
+ "prepublishOnly": "npm run build",
+ "test": "vitest run",
+ "test:coverage": "vitest run --coverage",
+ "timezone": "tsx tools/timezone.ts",
+ "zonename": "tsx tools/zonename.ts"
},
- "repository": {
- "type": "git",
- "url": "https://github.com/knowledgecode/date-and-time.git"
- },
- "keywords": [
- "date",
- "time",
- "format",
- "parse",
- "utility"
- ],
"author": "KNOWLEDGECODE",
"license": "MIT",
- "bugs": {
- "url": "https://github.com/knowledgecode/date-and-time/issues"
- },
- "homepage": "https://github.com/knowledgecode/date-and-time",
+ "type": "module",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
- "expect.js": "^0.3.1",
- "mocha": "^10.7.3",
- "rollup": "^4.22.5",
- "tsd": "^0.31.2"
+ "@rollup/plugin-typescript": "^12.1.4",
+ "@types/node": "^24.1.0",
+ "@vitest/coverage-v8": "^3.2.4",
+ "eslint": "^9.32.0",
+ "glob": "^11.0.3",
+ "globals": "^16.3.0",
+ "jiti": "^2.5.1",
+ "prettier": "^3.6.2",
+ "rollup": "^4.46.1",
+ "rollup-plugin-dts": "^6.2.1",
+ "rollup-plugin-esbuild": "^6.2.1",
+ "tsx": "^4.20.3",
+ "typescript-eslint": "^8.38.0",
+ "vitest": "^3.2.4"
}
}
diff --git a/plugin/day-of-week.d.ts b/plugin/day-of-week.d.ts
deleted file mode 100644
index 267d284..0000000
--- a/plugin/day-of-week.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (proto: unknown, date?: unknown): string;
diff --git a/plugin/day-of-week.js b/plugin/day-of-week.js
deleted file mode 100644
index 33e8525..0000000
--- a/plugin/day-of-week.js
+++ /dev/null
@@ -1,27 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin["day-of-week"] = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js plugin
- * @preserve day-of-week
- */
-
- var plugin = function (date) {
- var name = 'day-of-week';
-
- date.plugin(name, {
- parser: {
- dddd: function (str) { return this.find(this.res.dddd, str); },
- ddd: function (str) { return this.find(this.res.ddd, str); },
- dd: function (str) { return this.find(this.res.dd, str); }
- }
- });
- return name;
- };
-
- return plugin;
-
-}));
diff --git a/plugin/meridiem.d.ts b/plugin/meridiem.d.ts
deleted file mode 100644
index 267d284..0000000
--- a/plugin/meridiem.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (proto: unknown, date?: unknown): string;
diff --git a/plugin/meridiem.js b/plugin/meridiem.js
deleted file mode 100644
index f7ba2b8..0000000
--- a/plugin/meridiem.js
+++ /dev/null
@@ -1,55 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.meridiem = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js plugin
- * @preserve meridiem
- */
-
- var plugin = function (date) {
- var name = 'meridiem';
-
- date.plugin(name, {
- res: {
- AA: ['A.M.', 'P.M.'],
- a: ['am', 'pm'],
- aa: ['a.m.', 'p.m.']
- },
- formatter: {
- AA: function (d) {
- return this.res.AA[d.getHours() > 11 | 0];
- },
- a: function (d) {
- return this.res.a[d.getHours() > 11 | 0];
- },
- aa: function (d) {
- return this.res.aa[d.getHours() > 11 | 0];
- }
- },
- parser: {
- AA: function (str) {
- var result = this.find(this.res.AA, str);
- result.token = 'A';
- return result;
- },
- a: function (str) {
- var result = this.find(this.res.a, str);
- result.token = 'A';
- return result;
- },
- aa: function (str) {
- var result = this.find(this.res.aa, str);
- result.token = 'A';
- return result;
- }
- }
- });
- return name;
- };
-
- return plugin;
-
-}));
diff --git a/plugin/microsecond.d.ts b/plugin/microsecond.d.ts
deleted file mode 100644
index 267d284..0000000
--- a/plugin/microsecond.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (proto: unknown, date?: unknown): string;
diff --git a/plugin/microsecond.js b/plugin/microsecond.js
deleted file mode 100644
index c55b9bb..0000000
--- a/plugin/microsecond.js
+++ /dev/null
@@ -1,39 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.microsecond = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js plugin
- * @preserve microsecond
- */
-
- var plugin = function (date) {
- var name = 'microsecond';
-
- date.plugin(name, {
- parser: {
- SSSSSS: function (str) {
- var result = this.exec(/^\d{1,6}/, str);
- result.value = result.value / 1000 | 0;
- return result;
- },
- SSSSS: function (str) {
- var result = this.exec(/^\d{1,5}/, str);
- result.value = result.value / 100 | 0;
- return result;
- },
- SSSS: function (str) {
- var result = this.exec(/^\d{1,4}/, str);
- result.value = result.value / 10 | 0;
- return result;
- }
- }
- });
- return name;
- };
-
- return plugin;
-
-}));
diff --git a/plugin/ordinal.d.ts b/plugin/ordinal.d.ts
deleted file mode 100644
index 267d284..0000000
--- a/plugin/ordinal.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (proto: unknown, date?: unknown): string;
diff --git a/plugin/ordinal.js b/plugin/ordinal.js
deleted file mode 100644
index 3bb4c9f..0000000
--- a/plugin/ordinal.js
+++ /dev/null
@@ -1,42 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.ordinal = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js plugin
- * @preserve ordinal
- */
-
- var plugin = function (date) {
- var name = 'ordinal';
-
- date.plugin(name, {
- formatter: {
- DDD: function (d) {
- var day = d.getDate();
-
- switch (day) {
- case 1:
- case 21:
- case 31:
- return day + 'st';
- case 2:
- case 22:
- return day + 'nd';
- case 3:
- case 23:
- return day + 'rd';
- default:
- return day + 'th';
- }
- }
- }
- });
- return name;
- };
-
- return plugin;
-
-}));
diff --git a/plugin/timespan.d.ts b/plugin/timespan.d.ts
deleted file mode 100644
index ca22f21..0000000
--- a/plugin/timespan.d.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-declare module '../date-and-time' {
- export type TimeSpanResult = {
- /** Returns the result value in milliseconds. */
- toMilliseconds: (formatString: string) => string,
- /** Returns the result value in seconds. */
- toSeconds: (formatString: string) => string,
- /** Returns the result value in minutes. */
- toMinutes: (formatString: string) => string,
- /** Returns the result value in hours. */
- toHours: (formatString: string) => string,
- /** Returns the result value in days. */
- toDays: (formatString: string) => string
- };
-
- /**
- * Subtracting two dates (date1 - date2)
- * @param date1 - A Date object
- * @param date2 - A Date object
- * @returns The result object of subtracting date2 from date1
- */
- export function timeSpan(date1: Date, date2: Date): TimeSpanResult;
-}
-
-export default function (proto: unknown, date?: unknown): string;
diff --git a/plugin/timespan.js b/plugin/timespan.js
deleted file mode 100644
index e5d5add..0000000
--- a/plugin/timespan.js
+++ /dev/null
@@ -1,83 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.timespan = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js plugin
- * @preserve timespan
- */
-
- var plugin = function (date) {
- var timeSpan = function (date1, date2) {
- var milliseconds = function (dt, time) {
- dt.S = time;
- return dt;
- },
- seconds = function (dt, time) {
- dt.s = time / 1000 | 0;
- return milliseconds(dt, Math.abs(time) % 1000);
- },
- minutes = function (dt, time) {
- dt.m = time / 60000 | 0;
- return seconds(dt, Math.abs(time) % 60000);
- },
- hours = function (dt, time) {
- dt.H = time / 3600000 | 0;
- return minutes(dt, Math.abs(time) % 3600000);
- },
- days = function (dt, time) {
- dt.D = time / 86400000 | 0;
- return hours(dt, Math.abs(time) % 86400000);
- },
- format = function (dt, formatString) {
- var pattern = date.compile(formatString);
- var str = '';
-
- for (var i = 1, len = pattern.length, token, value; i < len; i++) {
- token = pattern[i].charAt(0);
- if (token in dt) {
- value = '' + Math.abs(dt[token]);
- while (value.length < pattern[i].length) {
- value = '0' + value;
- }
- if (dt[token] < 0) {
- value = '-' + value;
- }
- str += value;
- } else {
- str += pattern[i].replace(/\[(.*)]/, '$1');
- }
- }
- return str;
- },
- delta = date1.getTime() - date2.getTime();
-
- return {
- toMilliseconds: function (formatString) {
- return format(milliseconds({}, delta), formatString);
- },
- toSeconds: function (formatString) {
- return format(seconds({}, delta), formatString);
- },
- toMinutes: function (formatString) {
- return format(minutes({}, delta), formatString);
- },
- toHours: function (formatString) {
- return format(hours({}, delta), formatString);
- },
- toDays: function (formatString) {
- return format(days({}, delta), formatString);
- }
- };
- };
- var name = 'timespan';
-
- date.plugin(name, { extender: { timeSpan: timeSpan } });
- return name;
- };
-
- return plugin;
-
-}));
diff --git a/plugin/timezone.d.ts b/plugin/timezone.d.ts
deleted file mode 100644
index bd5b546..0000000
--- a/plugin/timezone.d.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-declare module '../date-and-time' {
- /**
- * Formatting date and time objects using time zone names (Date -> String)
- * @param dateObj - A Date object
- * @param formatString - A format string
- * @param [timeZone] - Output as this time zone
- * @returns A formatted string
- */
- export function formatTZ(dateObj: Date, formatString: string, timeZone?: string): string;
-
- /**
- * Formatting date and time objects using time zone names (Date -> String)
- * @param dateObj - A Date object
- * @param compiledObj - A compiled object of format string
- * @param [timeZone] - Output as this time zone
- * @returns A formatted string
- */
- export function formatTZ(dateObj: Date, compiledObj: string[], timeZone?: string): string;
-
- /**
- * Parsing date and time strings using time zone names (String -> Date)
- * @param dateString - A date and time string
- * @param formatString - A format string
- * @param [timeZone] - Input as this time zone
- * @returns A Date object
- */
- export function parseTZ(dateString: string, formatString: string, timeZone?: string): Date;
-
- /**
- * Parsing date and time strings using time zone names (String -> Date)
- * @param dateString - A date and time string
- * @param compiledObj - A compiled object of format string
- * @param [timeZone] - Input as this time zone
- * @returns A Date object
- */
- export function parseTZ(dateString: string, compiledObj: string[], timeZone?: string): Date;
-
- /**
- * Format transformation of date and time strings using time zone names (String -> String)
- * @param dateString - A date and time string
- * @param formatString1 - A format string before transformation
- * @param formatString2 - A format string after transformation
- * @param [timeZone] - Output as this time zone
- * @returns A formatted string
- */
- export function transformTZ(dateString: string, formatString1: string, formatString2: string, timeZone?: string): string;
-
- /**
- * Format transformation of date and time strings using time zone names (String -> String)
- * @param dateString - A date and time string
- * @param formatString - A format string before transformation
- * @param compiledObj - A compiled object of format string after transformation
- * @param [timeZone] - Output as this time zone
- * @returns A formatted string
- */
- export function transformTZ(dateString: string, formatString: string, compiledObj: string[], timeZone?: string): string;
-
- /**
- * Format transformation of date and time strings using time zone names (String -> String)
- * @param dateString - A date and time string
- * @param compiledObj - A compiled object of format string before transformation
- * @param formatString - A format string after transformation
- * @param [timeZone] - Output as this time zone
- * @returns A formatted string
- */
- export function transformTZ(dateString: string, compiledObj: string[], formatString: string, timeZone?: string): string;
-
- /**
- * Format transformation of date and time strings using time zone names (String -> String)
- * @param dateString - A date and time string
- * @param compiledObj1 - A compiled object of format string before transformation
- * @param compiledObj2 - A compiled object of format string after transformation
- * @param [timeZone] - Output as this time zone
- * @returns A formatted string
- */
- export function transformTZ(dateString: string, compiledObj1: string[], compiledObj2: string[], timeZone?: string): string;
-
- /**
- * Adding years considering time zones
- * @param dateObj - A Date object
- * @param years - The number of years to add
- * @param [timeZone] - The time zone to use for the calculation
- * @returns The Date object after adding the specified number of years
- */
- export function addYearsTZ(dateObj: Date, years: number, timeZone?: string): Date;
-
- /**
- * Adding months considering time zones
- * @param dateObj - A Date object
- * @param months - The number of months to add
- * @param [timeZone] - The time zone to use for the calculation
- * @returns The Date object after adding the specified number of months
- */
- export function addMonthsTZ(dateObj: Date, months: number, timeZone?: string): Date;
-
- /**
- * Adding days considering time zones
- * @param dateObj - A Date object
- * @param days - The number of days to add
- * @param [timeZone] - The time zone to use for the calculation
- * @returns The Date object after adding the specified number of days
- */
- export function addDaysTZ(dateObj: Date, days: number, timeZone?: string): Date;
-}
-
-export default function (proto: unknown, date?: unknown): string;
diff --git a/plugin/timezone.js b/plugin/timezone.js
deleted file mode 100644
index 0d1d41e..0000000
--- a/plugin/timezone.js
+++ /dev/null
@@ -1,732 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.timezone = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js plugin
- * @preserve timezone
- */
-
- var plugin = function (proto, date) {
- var timeZones = {
- africa: {
- abidjan: [0, -968],
- accra: [0, -968],
- addis_ababa: [10800, 9900, 9000, 8836],
- algiers: [7200, 3600, 732, 561, 0],
- asmara: [10800, 9900, 9000, 8836],
- bamako: [0, -968],
- bangui: [3600, 1800, 815, 0],
- banjul: [0, -968],
- bissau: [0, -3600, -3740],
- blantyre: [7820, 7200],
- brazzaville: [3600, 1800, 815, 0],
- bujumbura: [7820, 7200],
- cairo: [10800, 7509, 7200],
- casablanca: [3600, 0, -1820],
- ceuta: [7200, 3600, 0, -1276],
- conakry: [0, -968],
- dakar: [0, -968],
- dar_es_salaam: [10800, 9900, 9000, 8836],
- djibouti: [10800, 9900, 9000, 8836],
- douala: [3600, 1800, 815, 0],
- el_aaiun: [3600, 0, -3168, -3600],
- freetown: [0, -968],
- gaborone: [7820, 7200],
- harare: [7820, 7200],
- johannesburg: [10800, 7200, 6720, 5400],
- juba: [10800, 7588, 7200],
- kampala: [10800, 9900, 9000, 8836],
- khartoum: [10800, 7808, 7200],
- kigali: [7820, 7200],
- kinshasa: [3600, 1800, 815, 0],
- lagos: [3600, 1800, 815, 0],
- libreville: [3600, 1800, 815, 0],
- lome: [0, -968],
- luanda: [3600, 1800, 815, 0],
- lubumbashi: [7820, 7200],
- lusaka: [7820, 7200],
- malabo: [3600, 1800, 815, 0],
- maputo: [7820, 7200],
- maseru: [10800, 7200, 6720, 5400],
- mbabane: [10800, 7200, 6720, 5400],
- mogadishu: [10800, 9900, 9000, 8836],
- monrovia: [0, -2588, -2670],
- nairobi: [10800, 9900, 9000, 8836],
- ndjamena: [7200, 3612, 3600],
- niamey: [3600, 1800, 815, 0],
- nouakchott: [0, -968],
- ouagadougou: [0, -968],
- 'porto-novo': [3600, 1800, 815, 0],
- sao_tome: [3600, 1616, 0, -2205],
- tripoli: [7200, 3600, 3164],
- tunis: [7200, 3600, 2444, 561],
- windhoek: [10800, 7200, 5400, 4104, 3600]
- },
- america: {
- adak: [44002, -32400, -36000, -39600, -42398],
- anchorage: [50424, -28800, -32400, -35976, -36000],
- anguilla: [-10800, -14400, -15865],
- antigua: [-10800, -14400, -15865],
- araguaina: [-7200, -10800, -11568],
- argentina: {
- buenos_aires: [-7200, -10800, -14028, -14400, -15408],
- catamarca: [-7200, -10800, -14400, -15408, -15788],
- cordoba: [-7200, -10800, -14400, -15408],
- jujuy: [-7200, -10800, -14400, -15408, -15672],
- la_rioja: [-7200, -10800, -14400, -15408, -16044],
- mendoza: [-7200, -10800, -14400, -15408, -16516],
- rio_gallegos: [-7200, -10800, -14400, -15408, -16612],
- salta: [-7200, -10800, -14400, -15408, -15700],
- san_juan: [-7200, -10800, -14400, -15408, -16444],
- san_luis: [-7200, -10800, -14400, -15408, -15924],
- tucuman: [-7200, -10800, -14400, -15408, -15652],
- ushuaia: [-7200, -10800, -14400, -15408, -16392]
- },
- aruba: [-10800, -14400, -15865],
- asuncion: [-10800, -13840, -14400],
- atikokan: [-18000, -19088, -19176],
- bahia_banderas: [-18000, -21600, -25200, -25260, -28800],
- bahia: [-7200, -9244, -10800],
- barbados: [-10800, -12600, -14309, -14400],
- belem: [-7200, -10800, -11636],
- belize: [-18000, -19800, -21168, -21600],
- 'blanc-sablon': [-10800, -14400, -15865],
- boa_vista: [-10800, -14400, -14560],
- bogota: [-14400, -17776, -18000],
- boise: [-21600, -25200, -27889, -28800],
- cambridge_bay: [0, -18000, -21600, -25200],
- campo_grande: [-10800, -13108, -14400],
- cancun: [-14400, -18000, -20824, -21600],
- caracas: [-14400, -16060, -16064, -16200],
- cayenne: [-10800, -12560, -14400],
- cayman: [-18000, -19088, -19176],
- chicago: [-18000, -21036, -21600],
- chihuahua: [-18000, -21600, -25200, -25460],
- ciudad_juarez: [-18000, -21600, -25200, -25556],
- costa_rica: [-18000, -20173, -21600],
- creston: [-21600, -25200, -26898],
- cuiaba: [-10800, -13460, -14400],
- curacao: [-10800, -14400, -15865],
- danmarkshavn: [0, -4480, -7200, -10800],
- dawson: [-25200, -28800, -32400, -33460],
- dawson_creek: [-25200, -28800, -28856],
- denver: [-21600, -25196, -25200],
- detroit: [-14400, -18000, -19931, -21600],
- dominica: [-10800, -14400, -15865],
- edmonton: [-21600, -25200, -27232],
- eirunepe: [-14400, -16768, -18000],
- el_salvador: [-18000, -21408, -21600],
- fortaleza: [-7200, -9240, -10800],
- fort_nelson: [-25200, -28800, -29447],
- glace_bay: [-10800, -14388, -14400],
- goose_bay: [-7200, -9000, -9052, -10800, -12600, -12652, -14400, -14500],
- grand_turk: [-14400, -17072, -18000, -18430],
- grenada: [-10800, -14400, -15865],
- guadeloupe: [-10800, -14400, -15865],
- guatemala: [-18000, -21600, -21724],
- guayaquil: [-14400, -18000, -18840, -19160],
- guyana: [-10800, -13500, -13959, -14400],
- halifax: [-10800, -14400, -15264],
- havana: [-14400, -18000, -19768, -19776],
- hermosillo: [-21600, -25200, -26632, -28800],
- indiana: {
- indianapolis: [-14400, -18000, -20678, -21600],
- knox: [-18000, -20790, -21600],
- marengo: [-14400, -18000, -20723, -21600],
- petersburg: [-14400, -18000, -20947, -21600],
- tell_city: [-14400, -18000, -20823, -21600],
- vevay: [-14400, -18000, -20416, -21600],
- vincennes: [-14400, -18000, -21007, -21600],
- winamac: [-14400, -18000, -20785, -21600]
- },
- inuvik: [0, -21600, -25200, -28800],
- iqaluit: [0, -14400, -18000, -21600],
- jamaica: [-14400, -18000, -18430],
- juneau: [54139, -25200, -28800, -32261, -32400],
- kentucky: {
- louisville: [-14400, -18000, -20582, -21600],
- monticello: [-14400, -18000, -20364, -21600]
- },
- kralendijk: [-10800, -14400, -15865],
- la_paz: [-12756, -14400, -16356],
- lima: [-14400, -18000, -18492, -18516],
- los_angeles: [-25200, -28378, -28800],
- lower_princes: [-10800, -14400, -15865],
- maceio: [-7200, -8572, -10800],
- managua: [-18000, -20708, -20712, -21600],
- manaus: [-10800, -14400, -14404],
- marigot: [-10800, -14400, -15865],
- martinique: [-10800, -14400, -14660],
- matamoros: [-18000, -21600, -23400],
- mazatlan: [-21600, -25200, -25540, -28800],
- menominee: [-18000, -21027, -21600],
- merida: [-18000, -21508, -21600],
- metlakatla: [54822, -25200, -28800, -31578, -32400],
- mexico_city: [-18000, -21600, -23796, -25200],
- miquelon: [-7200, -10800, -13480, -14400],
- moncton: [-10800, -14400, -15548, -18000],
- monterrey: [-18000, -21600, -24076],
- montevideo: [-5400, -7200, -9000, -10800, -12600, -13491, -14400],
- montserrat: [-10800, -14400, -15865],
- nassau: [-14400, -18000, -19052],
- new_york: [-14400, -17762, -18000],
- nome: [46702, -28800, -32400, -36000, -39600, -39698],
- noronha: [-3600, -7200, -7780],
- north_dakota: {
- beulah: [-18000, -21600, -24427, -25200],
- center: [-18000, -21600, -24312, -25200],
- new_salem: [-18000, -21600, -24339, -25200]
- },
- nuuk: [-3600, -7200, -10800, -12416],
- ojinaga: [-18000, -21600, -25060, -25200],
- panama: [-18000, -19088, -19176],
- paramaribo: [-10800, -12600, -13236, -13240, -13252],
- phoenix: [-21600, -25200, -26898],
- 'port-au-prince': [-14400, -17340, -17360, -18000],
- port_of_spain: [-10800, -14400, -15865],
- porto_velho: [-10800, -14400, -15336],
- puerto_rico: [-10800, -14400, -15865],
- punta_arenas: [-10800, -14400, -16965, -17020, -18000],
- rankin_inlet: [0, -18000, -21600],
- recife: [-7200, -8376, -10800],
- regina: [-21600, -25116, -25200],
- resolute: [0, -18000, -21600],
- rio_branco: [-14400, -16272, -18000],
- santarem: [-10800, -13128, -14400],
- santiago: [-10800, -14400, -16965, -18000],
- santo_domingo: [-14400, -16200, -16776, -16800, -18000],
- sao_paulo: [-7200, -10800, -11188],
- scoresbysund: [0, -3600, -5272, -7200],
- sitka: [53927, -25200, -28800, -32400, -32473],
- st_barthelemy: [-10800, -14400, -15865],
- st_johns: [-5400, -9000, -9052, -12600, -12652],
- st_kitts: [-10800, -14400, -15865],
- st_lucia: [-10800, -14400, -15865],
- st_thomas: [-10800, -14400, -15865],
- st_vincent: [-10800, -14400, -15865],
- swift_current: [-21600, -25200, -25880],
- tegucigalpa: [-18000, -20932, -21600],
- thule: [-10800, -14400, -16508],
- tijuana: [-25200, -28084, -28800],
- toronto: [-14400, -18000, -19052],
- tortola: [-10800, -14400, -15865],
- vancouver: [-25200, -28800, -29548],
- whitehorse: [-25200, -28800, -32400, -32412],
- winnipeg: [-18000, -21600, -23316],
- yakutat: [52865, -28800, -32400, -33535]
- },
- antarctica: {
- casey: [39600, 28800, 0],
- davis: [25200, 18000, 0],
- dumontdurville: [36000, 35320, 35312],
- macquarie: [39600, 36000, 0],
- mawson: [21600, 18000, 0],
- mcmurdo: [46800, 45000, 43200, 41944, 41400],
- palmer: [0, -7200, -10800, -14400],
- rothera: [0, -10800],
- syowa: [11212, 10800],
- troll: [7200, 0],
- vostok: [25200, 18000, 0]
- },
- arctic: { longyearbyen: [10800, 7200, 3600, 3208] },
- asia: {
- aden: [11212, 10800],
- almaty: [25200, 21600, 18468, 18000],
- amman: [10800, 8624, 7200],
- anadyr: [50400, 46800, 43200, 42596, 39600],
- aqtau: [21600, 18000, 14400, 12064],
- aqtobe: [21600, 18000, 14400, 13720],
- ashgabat: [21600, 18000, 14400, 14012],
- atyrau: [21600, 18000, 14400, 12464, 10800],
- baghdad: [14400, 10800, 10660, 10656],
- bahrain: [14400, 12368, 10800],
- baku: [18000, 14400, 11964, 10800],
- bangkok: [25200, 24124],
- barnaul: [28800, 25200, 21600, 20100],
- beirut: [10800, 8520, 7200],
- bishkek: [25200, 21600, 18000, 17904],
- brunei: [32400, 30000, 28800, 27000, 26480],
- chita: [36000, 32400, 28800, 27232],
- choibalsan: [36000, 32400, 28800, 27480, 25200],
- colombo: [23400, 21600, 19800, 19172, 19164],
- damascus: [10800, 8712, 7200],
- dhaka: [25200, 23400, 21700, 21600, 21200, 19800],
- dili: [32400, 30140, 28800],
- dubai: [14400, 13272],
- dushanbe: [25200, 21600, 18000, 16512],
- famagusta: [10800, 8148, 7200],
- gaza: [10800, 8272, 7200],
- hebron: [10800, 8423, 7200],
- ho_chi_minh: [32400, 28800, 25590, 25200],
- hong_kong: [32400, 30600, 28800, 27402],
- hovd: [28800, 25200, 21996, 21600],
- irkutsk: [32400, 28800, 25200, 25025],
- jakarta: [32400, 28800, 27000, 26400, 25632, 25200],
- jayapura: [34200, 33768, 32400],
- jerusalem: [14400, 10800, 8454, 8440, 7200],
- kabul: [16608, 16200, 14400],
- kamchatka: [46800, 43200, 39600, 38076],
- karachi: [23400, 21600, 19800, 18000, 16092],
- kathmandu: [20700, 20476, 19800],
- khandyga: [39600, 36000, 32533, 32400, 28800],
- kolkata: [23400, 21208, 21200, 19800, 19270],
- krasnoyarsk: [28800, 25200, 22286, 21600],
- kuala_lumpur: [32400, 28800, 27000, 26400, 25200, 24925],
- kuching: [32400, 30000, 28800, 27000, 26480],
- kuwait: [11212, 10800],
- macau: [36000, 32400, 28800, 27250],
- magadan: [43200, 39600, 36192, 36000],
- makassar: [32400, 28800, 28656],
- manila: [32400, 29040, 28800, -57360],
- muscat: [14400, 13272],
- nicosia: [10800, 8008, 7200],
- novokuznetsk: [28800, 25200, 21600, 20928],
- novosibirsk: [28800, 25200, 21600, 19900],
- omsk: [25200, 21600, 18000, 17610],
- oral: [21600, 18000, 14400, 12324, 10800],
- phnom_penh: [25200, 24124],
- pontianak: [32400, 28800, 27000, 26240, 25200],
- pyongyang: [32400, 30600, 30180],
- qatar: [14400, 12368, 10800],
- qostanay: [21600, 18000, 15268, 14400],
- qyzylorda: [21600, 18000, 15712, 14400],
- riyadh: [11212, 10800],
- sakhalin: [43200, 39600, 36000, 34248, 32400],
- samarkand: [21600, 18000, 16073, 14400],
- seoul: [36000, 34200, 32400, 30600, 30472],
- shanghai: [32400, 29143, 28800],
- singapore: [32400, 28800, 27000, 26400, 25200, 24925],
- srednekolymsk: [43200, 39600, 36892, 36000],
- taipei: [32400, 29160, 28800],
- tashkent: [25200, 21600, 18000, 16631],
- tbilisi: [18000, 14400, 10800, 10751],
- tehran: [18000, 16200, 14400, 12600, 12344],
- thimphu: [21600, 21516, 19800],
- tokyo: [36000, 33539, 32400],
- tomsk: [28800, 25200, 21600, 20391],
- ulaanbaatar: [32400, 28800, 25652, 25200],
- urumqi: [21600, 21020],
- 'ust-nera': [43200, 39600, 36000, 34374, 32400, 28800],
- vientiane: [25200, 24124],
- vladivostok: [39600, 36000, 32400, 31651],
- yakutsk: [36000, 32400, 31138, 28800],
- yangon: [32400, 23400, 23087],
- yekaterinburg: [21600, 18000, 14553, 14400, 13505],
- yerevan: [18000, 14400, 10800, 10680]
- },
- atlantic: {
- azores: [0, -3600, -6160, -6872, -7200],
- bermuda: [-10800, -11958, -14400, -15558],
- canary: [3600, 0, -3600, -3696],
- cape_verde: [-3600, -5644, -7200],
- faroe: [3600, 0, -1624],
- madeira: [3600, 0, -3600, -4056],
- reykjavik: [0, -968],
- south_georgia: [-7200, -8768],
- stanley: [-7200, -10800, -13884, -14400],
- st_helena: [0, -968]
- },
- australia: {
- adelaide: [37800, 34200, 33260, 32400],
- brisbane: [39600, 36728, 36000],
- broken_hill: [37800, 36000, 34200, 33948, 32400],
- darwin: [37800, 34200, 32400, 31400],
- eucla: [35100, 31500, 30928],
- hobart: [39600, 36000, 35356],
- lindeman: [39600, 36000, 35756],
- lord_howe: [41400, 39600, 38180, 37800, 36000],
- melbourne: [39600, 36000, 34792],
- perth: [32400, 28800, 27804],
- sydney: [39600, 36292, 36000]
- },
- europe: {
- amsterdam: [7200, 3600, 1050, 0],
- andorra: [7200, 3600, 364, 0],
- astrakhan: [18000, 14400, 11532, 10800],
- athens: [10800, 7200, 5692, 3600],
- belgrade: [7200, 4920, 3600],
- berlin: [10800, 7200, 3600, 3208],
- bratislava: [7200, 3600, 3464, 0],
- brussels: [7200, 3600, 1050, 0],
- bucharest: [10800, 7200, 6264],
- budapest: [7200, 4580, 3600],
- busingen: [7200, 3600, 2048, 1786],
- chisinau: [14400, 10800, 7200, 6920, 6900, 6264, 3600],
- copenhagen: [10800, 7200, 3600, 3208],
- dublin: [3600, 2079, 0, -1521],
- gibraltar: [7200, 3600, 0, -1284],
- guernsey: [7200, 3600, 0, -75],
- helsinki: [10800, 7200, 5989],
- isle_of_man: [7200, 3600, 0, -75],
- istanbul: [14400, 10800, 7200, 7016, 6952],
- jersey: [7200, 3600, 0, -75],
- kaliningrad: [14400, 10800, 7200, 4920, 3600],
- kirov: [18000, 14400, 11928, 10800],
- kyiv: [14400, 10800, 7324, 7200, 3600],
- lisbon: [7200, 3600, 0, -2205],
- ljubljana: [7200, 4920, 3600],
- london: [7200, 3600, 0, -75],
- luxembourg: [7200, 3600, 1050, 0],
- madrid: [7200, 3600, 0, -884],
- malta: [7200, 3600, 3484],
- mariehamn: [10800, 7200, 5989],
- minsk: [14400, 10800, 7200, 6616, 6600, 3600],
- monaco: [7200, 3600, 561, 0],
- moscow: [18000, 16279, 14400, 12679, 10800, 9079, 9017, 7200],
- oslo: [10800, 7200, 3600, 3208],
- paris: [7200, 3600, 561, 0],
- podgorica: [7200, 4920, 3600],
- prague: [7200, 3600, 3464, 0],
- riga: [14400, 10800, 9394, 7200, 5794, 3600],
- rome: [7200, 3600, 2996],
- samara: [18000, 14400, 12020, 10800],
- san_marino: [7200, 3600, 2996],
- sarajevo: [7200, 4920, 3600],
- saratov: [18000, 14400, 11058, 10800],
- simferopol: [14400, 10800, 8184, 8160, 7200, 3600],
- skopje: [7200, 4920, 3600],
- sofia: [10800, 7200, 7016, 5596, 3600],
- stockholm: [10800, 7200, 3600, 3208],
- tallinn: [14400, 10800, 7200, 5940, 3600],
- tirane: [7200, 4760, 3600],
- ulyanovsk: [18000, 14400, 11616, 10800, 7200],
- vaduz: [7200, 3600, 2048, 1786],
- vatican: [7200, 3600, 2996],
- vienna: [7200, 3921, 3600],
- vilnius: [14400, 10800, 7200, 6076, 5736, 5040, 3600],
- volgograd: [18000, 14400, 10800, 10660],
- warsaw: [10800, 7200, 5040, 3600],
- zagreb: [7200, 4920, 3600],
- zurich: [7200, 3600, 2048, 1786]
- },
- indian: {
- antananarivo: [10800, 9900, 9000, 8836],
- chagos: [21600, 18000, 17380],
- christmas: [25200, 24124],
- cocos: [32400, 23400, 23087],
- comoro: [10800, 9900, 9000, 8836],
- kerguelen: [18000, 17640],
- mahe: [14400, 13272],
- maldives: [18000, 17640],
- mauritius: [18000, 14400, 13800],
- mayotte: [10800, 9900, 9000, 8836],
- reunion: [14400, 13272]
- },
- pacific: {
- apia: [50400, 46800, 45184, -36000, -39600, -41216, -41400],
- auckland: [46800, 45000, 43200, 41944, 41400],
- bougainville: [39600, 37336, 36000, 35312, 32400],
- chatham: [49500, 45900, 44100, 44028],
- chuuk: [36000, 35320, 35312],
- easter: [-18000, -21600, -25200, -26248],
- efate: [43200, 40396, 39600],
- fakaofo: [46800, -39600, -41096],
- fiji: [46800, 43200, 42944],
- funafuti: [43200, 41524],
- galapagos: [-18000, -21504, -21600],
- gambier: [-32388, -32400],
- guadalcanal: [39600, 38388],
- guam: [39600, 36000, 34740, 32400, -51660],
- honolulu: [-34200, -36000, -37800, -37886],
- kanton: [46800, 0, -39600, -43200],
- kiritimati: [50400, -36000, -37760, -38400],
- kosrae: [43200, 39600, 39116, 36000, 32400, -47284],
- kwajalein: [43200, 40160, 39600, 36000, 32400, -43200],
- majuro: [43200, 41524],
- marquesas: [-33480, -34200],
- midway: [45432, -39600, -40968],
- nauru: [43200, 41400, 40060, 32400],
- niue: [-39600, -40780, -40800],
- norfolk: [45000, 43200, 41400, 40320, 40312, 39600],
- noumea: [43200, 39948, 39600],
- pago_pago: [45432, -39600, -40968],
- palau: [32400, 32276, -54124],
- pitcairn: [-28800, -30600, -31220],
- pohnpei: [39600, 38388],
- port_moresby: [36000, 35320, 35312],
- rarotonga: [48056, -34200, -36000, -37800, -38344],
- saipan: [39600, 36000, 34740, 32400, -51660],
- tahiti: [-35896, -36000],
- tarawa: [43200, 41524],
- tongatapu: [50400, 46800, 44400, 44352],
- wake: [43200, 41524],
- wallis: [43200, 41524]
- }
- };
- var timeZoneNames = {
- 'Acre Standard Time': 'ACT', 'Acre Summer Time': 'ACST', 'Afghanistan Time': 'AFT',
- 'Alaska Daylight Time': 'AKDT', 'Alaska Standard Time': 'AKST', 'Almaty Standard Time': 'ALMT',
- 'Almaty Summer Time': 'ALMST', 'Amazon Standard Time': 'AMT', 'Amazon Summer Time': 'AMST',
- 'Anadyr Standard Time': 'ANAT', 'Anadyr Summer Time': 'ANAST', 'Apia Daylight Time': 'WSDT',
- 'Apia Standard Time': 'WSST', 'Aqtau Standard Time': 'AQTT', 'Aqtau Summer Time': 'AQTST',
- 'Aqtobe Standard Time': 'AQTT', 'Aqtobe Summer Time': 'AQST', 'Arabian Daylight Time': 'ADT',
- 'Arabian Standard Time': 'AST', 'Argentina Standard Time': 'ART', 'Argentina Summer Time': 'ARST',
- 'Armenia Standard Time': 'AMT', 'Armenia Summer Time': 'AMST', 'Atlantic Daylight Time': 'ADT',
- 'Atlantic Standard Time': 'AST', 'Australian Central Daylight Time': 'ACDT', 'Australian Central Standard Time': 'ACST',
- 'Australian Central Western Daylight Time': 'ACWDT', 'Australian Central Western Standard Time': 'ACWST', 'Australian Eastern Daylight Time': 'AEDT',
- 'Australian Eastern Standard Time': 'AEST', 'Australian Western Daylight Time': 'AWDT', 'Australian Western Standard Time': 'AWST',
- 'Azerbaijan Standard Time': 'AZT', 'Azerbaijan Summer Time': 'AZST', 'Azores Standard Time': 'AZOT',
- 'Azores Summer Time': 'AZOST', 'Bangladesh Standard Time': 'BST', 'Bangladesh Summer Time': 'BDST',
- 'Bhutan Time': 'BTT', 'Bolivia Time': 'BOT', 'Brasilia Standard Time': 'BRT',
- 'Brasilia Summer Time': 'BRST', 'British Summer Time': 'BST', 'Brunei Darussalam Time': 'BNT',
- 'Cape Verde Standard Time': 'CVT', 'Casey Time': 'CAST', 'Central Africa Time': 'CAT',
- 'Central Daylight Time': 'CDT', 'Central European Standard Time': 'CET', 'Central European Summer Time': 'CEST',
- 'Central Indonesia Time': 'WITA', 'Central Standard Time': 'CST', 'Chamorro Standard Time': 'ChST',
- 'Chatham Daylight Time': 'CHADT', 'Chatham Standard Time': 'CHAST', 'Chile Standard Time': 'CLT',
- 'Chile Summer Time': 'CLST', 'China Daylight Time': 'CDT', 'China Standard Time': 'CST',
- 'Christmas Island Time': 'CXT', 'Chuuk Time': 'CHUT', 'Cocos Islands Time': 'CCT',
- 'Colombia Standard Time': 'COT', 'Colombia Summer Time': 'COST', 'Cook Islands Half Summer Time': 'CKHST',
- 'Cook Islands Standard Time': 'CKT', 'Coordinated Universal Time': 'UTC', 'Cuba Daylight Time': 'CDT',
- 'Cuba Standard Time': 'CST', 'Davis Time': 'DAVT', 'Dumont-d’Urville Time': 'DDUT',
- 'East Africa Time': 'EAT', 'East Greenland Standard Time': 'EGT', 'East Greenland Summer Time': 'EGST',
- 'East Kazakhstan Time': 'ALMT', 'East Timor Time': 'TLT', 'Easter Island Standard Time': 'EAST',
- 'Easter Island Summer Time': 'EASST', 'Eastern Daylight Time': 'EDT', 'Eastern European Standard Time': 'EET',
- 'Eastern European Summer Time': 'EEST', 'Eastern Indonesia Time': 'WIT', 'Eastern Standard Time': 'EST',
- 'Ecuador Time': 'ECT', 'Falkland Islands Standard Time': 'FKST', 'Falkland Islands Summer Time': 'FKDT',
- 'Fernando de Noronha Standard Time': 'FNT', 'Fernando de Noronha Summer Time': 'FNST', 'Fiji Standard Time': 'FJT',
- 'Fiji Summer Time': 'FJST', 'French Guiana Time': 'GFT', 'French Southern & Antarctic Time': 'TFT',
- 'Further-eastern European Time': 'FET', 'Galapagos Time': 'GALT', 'Gambier Time': 'GAMT',
- 'Georgia Standard Time': 'GET', 'Georgia Summer Time': 'GEST', 'Gilbert Islands Time': 'GILT',
- 'Greenwich Mean Time': 'GMT', 'Guam Standard Time': 'ChST', 'Gulf Standard Time': 'GST',
- 'Guyana Time': 'GYT', 'Hawaii-Aleutian Daylight Time': 'HADT', 'Hawaii-Aleutian Standard Time': 'HAST',
- 'Hong Kong Standard Time': 'HKT', 'Hong Kong Summer Time': 'HKST', 'Hovd Standard Time': 'HOVT',
- 'Hovd Summer Time': 'HOVST', 'India Standard Time': 'IST', 'Indian Ocean Time': 'IOT',
- 'Indochina Time': 'ICT', 'Iran Daylight Time': 'IRDT', 'Iran Standard Time': 'IRST',
- 'Irish Standard Time': 'IST', 'Irkutsk Standard Time': 'IRKT', 'Irkutsk Summer Time': 'IRKST',
- 'Israel Daylight Time': 'IDT', 'Israel Standard Time': 'IST', 'Japan Standard Time': 'JST',
- 'Korean Daylight Time': 'KDT', 'Korean Standard Time': 'KST', 'Kosrae Time': 'KOST',
- 'Krasnoyarsk Standard Time': 'KRAT', 'Krasnoyarsk Summer Time': 'KRAST', 'Kyrgyzstan Time': 'KGT',
- 'Lanka Time': 'LKT', 'Line Islands Time': 'LINT', 'Lord Howe Daylight Time': 'LHDT',
- 'Lord Howe Standard Time': 'LHST', 'Macao Standard Time': 'CST', 'Macao Summer Time': 'CDT',
- 'Magadan Standard Time': 'MAGT', 'Magadan Summer Time': 'MAGST', 'Malaysia Time': 'MYT',
- 'Maldives Time': 'MVT', 'Marquesas Time': 'MART', 'Marshall Islands Time': 'MHT',
- 'Mauritius Standard Time': 'MUT', 'Mauritius Summer Time': 'MUST', 'Mawson Time': 'MAWT',
- 'Mexican Pacific Daylight Time': 'PDT', 'Mexican Pacific Standard Time': 'PST', 'Moscow Standard Time': 'MSK',
- 'Moscow Summer Time': 'MSD', 'Mountain Daylight Time': 'MDT', 'Mountain Standard Time': 'MST',
- 'Myanmar Time': 'MMT', 'Nauru Time': 'NRT', 'Nepal Time': 'NPT',
- 'New Caledonia Standard Time': 'NCT', 'New Caledonia Summer Time': 'NCST', 'New Zealand Daylight Time': 'NZDT',
- 'New Zealand Standard Time': 'NZST', 'Newfoundland Daylight Time': 'NDT', 'Newfoundland Standard Time': 'NST',
- 'Niue Time': 'NUT', 'Norfolk Island Daylight Time': 'NFDT', 'Norfolk Island Standard Time': 'NFT',
- 'North Mariana Islands Time': 'ChST', 'Novosibirsk Standard Time': 'NOVT', 'Novosibirsk Summer Time': 'NOVST',
- 'Omsk Standard Time': 'OMST', 'Omsk Summer Time': 'OMSST', 'Pacific Daylight Time': 'PDT',
- 'Pacific Standard Time': 'PST', 'Pakistan Standard Time': 'PKT', 'Pakistan Summer Time': 'PKST',
- 'Palau Time': 'PWT', 'Papua New Guinea Time': 'PGT', 'Paraguay Standard Time': 'PYT',
- 'Paraguay Summer Time': 'PYST', 'Peru Standard Time': 'PET', 'Peru Summer Time': 'PEST',
- 'Petropavlovsk-Kamchatski Standard Time': 'PETT', 'Petropavlovsk-Kamchatski Summer Time': 'PETST', 'Philippine Standard Time': 'PST',
- 'Philippine Summer Time': 'PHST', 'Phoenix Islands Time': 'PHOT', 'Pitcairn Time': 'PIT',
- 'Ponape Time': 'PONT', 'Pyongyang Time': 'KST', 'Qyzylorda Standard Time': 'QYZT',
- 'Qyzylorda Summer Time': 'QYZST', 'Rothera Time': 'ROOTT', 'Réunion Time': 'RET',
- 'Sakhalin Standard Time': 'SAKT', 'Sakhalin Summer Time': 'SAKST', 'Samara Standard Time': 'SAMT',
- 'Samara Summer Time': 'SAMST', 'Samoa Standard Time': 'SST', 'Seychelles Time': 'SCT',
- 'Singapore Standard Time': 'SGT', 'Solomon Islands Time': 'SBT', 'South Africa Standard Time': 'SAST',
- 'South Georgia Time': 'GST', 'St. Pierre & Miquelon Daylight Time': 'PMDT', 'St. Pierre & Miquelon Standard Time': 'PMST',
- 'Suriname Time': 'SRT', 'Syowa Time': 'SYOT', 'Tahiti Time': 'TAHT',
- 'Taipei Daylight Time': 'CDT', 'Taipei Standard Time': 'CST', 'Tajikistan Time': 'TJT',
- 'Tokelau Time': 'TKT', 'Tonga Standard Time': 'TOT', 'Tonga Summer Time': 'TOST',
- 'Turkmenistan Standard Time': 'TMT', 'Tuvalu Time': 'TVT', 'Ulaanbaatar Standard Time': 'ULAT',
- 'Ulaanbaatar Summer Time': 'ULAST', 'Uruguay Standard Time': 'UYT', 'Uruguay Summer Time': 'UYST',
- 'Uzbekistan Standard Time': 'UZT', 'Uzbekistan Summer Time': 'UZST', 'Vanuatu Standard Time': 'VUT',
- 'Vanuatu Summer Time': 'VUST', 'Venezuela Time': 'VET', 'Vladivostok Standard Time': 'VLAT',
- 'Vladivostok Summer Time': 'VLAST', 'Volgograd Standard Time': 'VOLT', 'Volgograd Summer Time': 'VOLST',
- 'Vostok Time': 'VOST', 'Wake Island Time': 'WAKT', 'Wallis & Futuna Time': 'WFT',
- 'West Africa Standard Time': 'WAT', 'West Africa Summer Time': 'WAST', 'West Greenland Standard Time': 'WGST',
- 'West Greenland Summer Time': 'WGST', 'West Kazakhstan Time': 'AQTT', 'Western Argentina Standard Time': 'ART',
- 'Western Argentina Summer Time': 'ARST', 'Western European Standard Time': 'WET', 'Western European Summer Time': 'WEST',
- 'Western Indonesia Time': 'WIB', 'Yakutsk Standard Time': 'YAKT', 'Yakutsk Summer Time': 'YAKST',
- 'Yekaterinburg Standard Time': 'YEKT', 'Yekaterinburg Summer Time': 'YEKST', 'Yukon Time': 'YT'
- };
- var options = {
- hour12: false, weekday: 'short', year: 'numeric', month: 'numeric', day: 'numeric',
- hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3,
- timeZone: 'UTC'
- };
- var cache = {
- utc: new Intl.DateTimeFormat('en-US', options)
- };
- var getDateTimeFormat = function (timeZone) {
- if (timeZone) {
- var tz = timeZone.toLowerCase();
-
- if (!cache[tz]) {
- options.timeZone = timeZone;
- cache[tz] = new Intl.DateTimeFormat('en-US', options);
- }
- return cache[tz];
- }
- options.timeZone = undefined;
- return new Intl.DateTimeFormat('en-US', options);
- };
- var formatToParts = function (dateTimeFormat, dateObjOrTime) {
- var array = dateTimeFormat.formatToParts(dateObjOrTime),
- values = {};
-
- for (var i = 0, len = array.length; i < len; i++) {
- var type = array[i].type,
- value = array[i].value;
-
- switch (type) {
- case 'weekday':
- values[type] = 'SunMonTueWedThuFriSat'.indexOf(value) / 3;
- break;
- case 'hour':
- values[type] = value % 24;
- break;
- case 'year':
- case 'month':
- case 'day':
- case 'minute':
- case 'second':
- case 'fractionalSecond':
- values[type] = value | 0;
- }
- }
- return values;
- };
- var getTimeFromParts = function (parts) {
- return Date.UTC(
- parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day,
- parts.hour, parts.minute, parts.second, parts.fractionalSecond
- );
- };
- var formatTZ = function (dateObj, arg, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- return date.format({
- getFullYear: function () { return parts.year; },
- getMonth: function () { return parts.month - 1; },
- getDate: function () { return parts.day; },
- getHours: function () { return parts.hour; },
- getMinutes: function () { return parts.minute; },
- getSeconds: function () { return parts.second; },
- getMilliseconds: function () { return parts.fractionalSecond; },
- getDay: function () { return parts.weekday; },
- getTime: function () { return dateObj.getTime(); },
- getTimezoneOffset: function () {
- return (dateObj.getTime() - getTimeFromParts(parts)) / 60000 | 0;
- },
- getTimezoneName: function () { return timeZone || undefined; }
- }, arg);
- };
- var parseTZ = function (arg1, arg2, timeZone) {
- var pattern = typeof arg2 === 'string' ? date.compile(arg2) : arg2;
- var time = typeof arg1 === 'string' ? date.parse(arg1, pattern, !!timeZone).getTime() : arg1;
- var hasZ = function (array) {
- for (var i = 1, len = array.length; i < len; i++) {
- if (!array[i].indexOf('Z')) {
- return true;
- }
- }
- return false;
- };
-
- if (!timeZone || hasZ(pattern) || timeZone.toUpperCase() === 'UTC' || isNaN(time)) {
- return new Date(time);
- }
-
- var getOffset = function (timeZoneName) {
- var keys = (timeZoneName || '').toLowerCase().split('/');
- var value = timeZones[keys[0]] || {};
-
- for (var i = 1, len = keys.length; i < len; i++) {
- value = value[keys[i]] || {};
- }
- return Array.isArray(value) ? value : [];
- };
-
- var utc = getDateTimeFormat('UTC');
- var tz = getDateTimeFormat(timeZone);
- var offset = getOffset(timeZone);
-
- for (var i = 0; i < 2; i++) {
- var targetString = utc.format(time - i * 24 * 60 * 60 * 1000);
-
- for (var j = 0, len = offset.length; j < len; j++) {
- if (tz.format(time - (offset[j] + i * 24 * 60 * 60) * 1000) === targetString) {
- return new Date(time - offset[j] * 1000);
- }
- }
- }
- return new Date(NaN);
- };
- var transformTZ = function (dateString, arg1, arg2, timeZone) {
- return formatTZ(date.parse(dateString, arg1), arg2, timeZone);
- };
- var normalizeDateParts = function (parts, adjustEOM) {
- var d = new Date(Date.UTC(
- parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day
- ));
-
- if (adjustEOM && d.getUTCDate() < parts.day) {
- d.setUTCDate(0);
- }
- parts.year = d.getUTCFullYear();
- parts.month = d.getUTCMonth() + 1;
- parts.day = d.getUTCDate();
-
- return parts;
- };
- var addYearsTZ = function (dateObj, years, timeZone) {
- return addMonthsTZ(dateObj, years * 12, timeZone);
- };
- var addMonthsTZ = function (dateObj, months, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- parts.month += months;
- var dateObj2 = parseTZ(getTimeFromParts(normalizeDateParts(parts, true)), [], timeZone);
-
- return isNaN(dateObj2.getTime()) ? date.addMonths(dateObj, months, true) : dateObj2;
- };
- var addDaysTZ = function (dateObj, days, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- parts.day += days;
- var dateObj2 = parseTZ(getTimeFromParts(normalizeDateParts(parts, false)), [], timeZone);
-
- return isNaN(dateObj2.getTime()) ? date.addDays(dateObj, days, true) : dateObj2;
- };
-
- var name = 'timezone';
-
- var getName = function (d) {
- var parts = new Intl.DateTimeFormat('en-US', {
- timeZone: typeof d.getTimezoneName === 'function' ? d.getTimezoneName() : undefined,
- timeZoneName: 'long'
- }).formatToParts(d.getTime());
-
- for (var i = 0, len = parts.length; i < len; i++) {
- if (parts[i].type === 'timeZoneName') {
- return parts[i].value;
- }
- }
- return '';
- };
-
- proto.plugin(name, {
- formatter: {
- z: function (d) {
- var name = getName(d);
- return timeZoneNames[name] || '';
- },
- zz: function (d) {
- var name = getName(d);
- return /^GMT[+-].+$/.test(name) ? '' : name;
- }
- },
- extender: {
- formatTZ: formatTZ,
- parseTZ: parseTZ,
- transformTZ: transformTZ,
- addYearsTZ: addYearsTZ,
- addMonthsTZ: addMonthsTZ,
- addDaysTZ: addDaysTZ
- }
- });
- return name;
- };
-
- return plugin;
-
-}));
diff --git a/plugin/two-digit-year.d.ts b/plugin/two-digit-year.d.ts
deleted file mode 100644
index 267d284..0000000
--- a/plugin/two-digit-year.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default function (proto: unknown, date?: unknown): string;
diff --git a/plugin/two-digit-year.js b/plugin/two-digit-year.js
deleted file mode 100644
index 88d851b..0000000
--- a/plugin/two-digit-year.js
+++ /dev/null
@@ -1,29 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin["two-digit-year"] = factory()));
-})(this, (function () { 'use strict';
-
- /**
- * @preserve date-and-time.js plugin
- * @preserve two-digit-year
- */
-
- var plugin = function (date) {
- var name = 'two-digit-year';
-
- date.plugin(name, {
- parser: {
- YY: function (str) {
- var result = this.exec(/^\d\d/, str);
- result.value += result.value < 70 ? 2000 : 1900;
- return result;
- }
- }
- });
- return name;
- };
-
- return plugin;
-
-}));
diff --git a/rollup.config.mjs b/rollup.config.mjs
deleted file mode 100644
index 7d023f8..0000000
--- a/rollup.config.mjs
+++ /dev/null
@@ -1,356 +0,0 @@
-import terser from '@rollup/plugin-terser';
-
-export default [
- {
- input: 'src/index.js',
- output: [
- { file: 'esm/date-and-time.es.js', format: 'es' },
- { file: 'esm/date-and-time.mjs', format: 'es' },
- { file: 'date-and-time.js', format: 'umd', name: 'date', esModule: false }
- ]
- },
- {
- input: 'src/locale/ar.js',
- output: [
- { file: 'esm/locale/ar.es.js', format: 'es' },
- { file: 'esm/locale/ar.mjs', format: 'es' },
- { file: 'locale/ar.js', format: 'umd', name: 'date.locale.ar', esModule: false }
- ]
- },
- {
- input: 'src/locale/az.js',
- output: [
- { file: 'esm/locale/az.es.js', format: 'es' },
- { file: 'esm/locale/az.mjs', format: 'es' },
- { file: 'locale/az.js', format: 'umd', name: 'date.locale.az', esModule: false }
- ]
- },
- {
- input: 'src/locale/bn.js',
- output: [
- { file: 'esm/locale/bn.es.js', format: 'es' },
- { file: 'esm/locale/bn.mjs', format: 'es' },
- { file: 'locale/bn.js', format: 'umd', name: 'date.locale.bn', esModule: false }
- ]
- },
- {
- input: 'src/locale/cs.js',
- output: [
- { file: 'esm/locale/cs.es.js', format: 'es' },
- { file: 'esm/locale/cs.mjs', format: 'es' },
- { file: 'locale/cs.js', format: 'umd', name: 'date.locale.cs', esModule: false }
- ]
- },
- {
- input: 'src/locale/de.js',
- output: [
- { file: 'esm/locale/de.es.js', format: 'es' },
- { file: 'esm/locale/de.mjs', format: 'es' },
- { file: 'locale/de.js', format: 'umd', name: 'date.locale.de', esModule: false }
- ]
- },
- {
- input: 'src/locale/dk.js',
- output: [
- { file: 'esm/locale/dk.es.js', format: 'es' },
- { file: 'esm/locale/dk.mjs', format: 'es' },
- { file: 'locale/dk.js', format: 'umd', name: 'date.locale.dk', esModule: false }
- ]
- },
- {
- input: 'src/locale/el.js',
- output: [
- { file: 'esm/locale/el.es.js', format: 'es' },
- { file: 'esm/locale/el.mjs', format: 'es' },
- { file: 'locale/el.js', format: 'umd', name: 'date.locale.el', esModule: false }
- ]
- },
- {
- input: 'src/locale/en.js',
- output: [
- { file: 'esm/locale/en.es.js', format: 'es' },
- { file: 'esm/locale/en.mjs', format: 'es' },
- { file: 'locale/en.js', format: 'umd', name: 'date.locale.en', esModule: false }
- ]
- },
- {
- input: 'src/locale/es.js',
- output: [
- { file: 'esm/locale/es.es.js', format: 'es' },
- { file: 'esm/locale/es.mjs', format: 'es' },
- { file: 'locale/es.js', format: 'umd', name: 'date.locale.es', esModule: false }
- ]
- },
- {
- input: 'src/locale/fa.js',
- output: [
- { file: 'esm/locale/fa.es.js', format: 'es' },
- { file: 'esm/locale/fa.mjs', format: 'es' },
- { file: 'locale/fa.js', format: 'umd', name: 'date.locale.fa', esModule: false }
- ]
- },
- {
- input: 'src/locale/fr.js',
- output: [
- { file: 'esm/locale/fr.es.js', format: 'es' },
- { file: 'esm/locale/fr.mjs', format: 'es' },
- { file: 'locale/fr.js', format: 'umd', name: 'date.locale.fr', esModule: false }
- ]
- },
- {
- input: 'src/locale/hi.js',
- output: [
- { file: 'esm/locale/hi.es.js', format: 'es' },
- { file: 'esm/locale/hi.mjs', format: 'es' },
- { file: 'locale/hi.js', format: 'umd', name: 'date.locale.hi', esModule: false }
- ]
- },
- {
- input: 'src/locale/hu.js',
- output: [
- { file: 'esm/locale/hu.es.js', format: 'es' },
- { file: 'esm/locale/hu.mjs', format: 'es' },
- { file: 'locale/hu.js', format: 'umd', name: 'date.locale.hu', esModule: false }
- ]
- },
- {
- input: 'src/locale/id.js',
- output: [
- { file: 'esm/locale/id.es.js', format: 'es' },
- { file: 'esm/locale/id.mjs', format: 'es' },
- { file: 'locale/id.js', format: 'umd', name: 'date.locale.id', esModule: false }
- ]
- },
- {
- input: 'src/locale/it.js',
- output: [
- { file: 'esm/locale/it.es.js', format: 'es' },
- { file: 'esm/locale/it.mjs', format: 'es' },
- { file: 'locale/it.js', format: 'umd', name: 'date.locale.it', esModule: false }
- ]
- },
- {
- input: 'src/locale/ja.js',
- output: [
- { file: 'esm/locale/ja.es.js', format: 'es' },
- { file: 'esm/locale/ja.mjs', format: 'es' },
- { file: 'locale/ja.js', format: 'umd', name: 'date.locale.ja', esModule: false }
- ]
- },
- {
- input: 'src/locale/jv.js',
- output: [
- { file: 'esm/locale/jv.es.js', format: 'es' },
- { file: 'esm/locale/jv.mjs', format: 'es' },
- { file: 'locale/jv.js', format: 'umd', name: 'date.locale.jv', esModule: false }
- ]
- },
- {
- input: 'src/locale/ko.js',
- output: [
- { file: 'esm/locale/ko.es.js', format: 'es' },
- { file: 'esm/locale/ko.mjs', format: 'es' },
- { file: 'locale/ko.js', format: 'umd', name: 'date.locale.ko', esModule: false }
- ]
- },
- {
- input: 'src/locale/my.js',
- output: [
- { file: 'esm/locale/my.es.js', format: 'es' },
- { file: 'esm/locale/my.mjs', format: 'es' },
- { file: 'locale/my.js', format: 'umd', name: 'date.locale.my', esModule: false }
- ]
- },
- {
- input: 'src/locale/nl.js',
- output: [
- { file: 'esm/locale/nl.es.js', format: 'es' },
- { file: 'esm/locale/nl.mjs', format: 'es' },
- { file: 'locale/nl.js', format: 'umd', name: 'date.locale.nl', esModule: false }
- ]
- },
- {
- input: 'src/locale/pa-in.js',
- output: [
- { file: 'esm/locale/pa-in.es.js', format: 'es' },
- { file: 'esm/locale/pa-in.mjs', format: 'es' },
- { file: 'locale/pa-in.js', format: 'umd', name: 'date.locale.pa-in', esModule: false }
- ]
- },
- {
- input: 'src/locale/pl.js',
- output: [
- { file: 'esm/locale/pl.es.js', format: 'es' },
- { file: 'esm/locale/pl.mjs', format: 'es' },
- { file: 'locale/pl.js', format: 'umd', name: 'date.locale.pl', esModule: false }
- ]
- },
- {
- input: 'src/locale/pt.js',
- output: [
- { file: 'esm/locale/pt.es.js', format: 'es' },
- { file: 'esm/locale/pt.mjs', format: 'es' },
- { file: 'locale/pt.js', format: 'umd', name: 'date.locale.pt', esModule: false }
- ]
- },
- {
- input: 'src/locale/ro.js',
- output: [
- { file: 'esm/locale/ro.es.js', format: 'es' },
- { file: 'esm/locale/ro.mjs', format: 'es' },
- { file: 'locale/ro.js', format: 'umd', name: 'date.locale.ro', esModule: false }
- ]
- },
- {
- input: 'src/locale/ru.js',
- output: [
- { file: 'esm/locale/ru.es.js', format: 'es' },
- { file: 'esm/locale/ru.mjs', format: 'es' },
- { file: 'locale/ru.js', format: 'umd', name: 'date.locale.ru', esModule: false }
- ]
- },
- {
- input: 'src/locale/rw.js',
- output: [
- { file: 'esm/locale/rw.es.js', format: 'es' },
- { file: 'esm/locale/rw.mjs', format: 'es' },
- { file: 'locale/rw.js', format: 'umd', name: 'date.locale.rw', esModule: false }
- ]
- },
- {
- input: 'src/locale/sr.js',
- output: [
- { file: 'esm/locale/sr.es.js', format: 'es' },
- { file: 'esm/locale/sr.mjs', format: 'es' },
- { file: 'locale/sr.js', format: 'umd', name: 'date.locale.sr', esModule: false }
- ]
- },
- {
- input: 'src/locale/sv.js',
- output: [
- { file: 'esm/locale/sv.es.js', format: 'es' },
- { file: 'esm/locale/sv.mjs', format: 'es' },
- { file: 'locale/sv.js', format: 'umd', name: 'date.locale.sv', esModule: false }
- ]
- },
- {
- input: 'src/locale/th.js',
- output: [
- { file: 'esm/locale/th.es.js', format: 'es' },
- { file: 'esm/locale/th.mjs', format: 'es' },
- { file: 'locale/th.js', format: 'umd', name: 'date.locale.th', esModule: false }
- ]
- },
- {
- input: 'src/locale/tr.js',
- output: [
- { file: 'esm/locale/tr.es.js', format: 'es' },
- { file: 'esm/locale/tr.mjs', format: 'es' },
- { file: 'locale/tr.js', format: 'umd', name: 'date.locale.tr', esModule: false }
- ]
- },
- {
- input: 'src/locale/uk.js',
- output: [
- { file: 'esm/locale/uk.es.js', format: 'es' },
- { file: 'esm/locale/uk.mjs', format: 'es' },
- { file: 'locale/uk.js', format: 'umd', name: 'date.locale.uk', esModule: false }
- ]
- },
- {
- input: 'src/locale/uz.js',
- output: [
- { file: 'esm/locale/uz.es.js', format: 'es' },
- { file: 'esm/locale/uz.mjs', format: 'es' },
- { file: 'locale/uz.js', format: 'umd', name: 'date.locale.uz', esModule: false }
- ]
- },
- {
- input: 'src/locale/vi.js',
- output: [
- { file: 'esm/locale/vi.es.js', format: 'es' },
- { file: 'esm/locale/vi.mjs', format: 'es' },
- { file: 'locale/vi.js', format: 'umd', name: 'date.locale.vi', esModule: false }
- ]
- },
- {
- input: 'src/locale/zh-cn.js',
- output: [
- { file: 'esm/locale/zh-cn.es.js', format: 'es' },
- { file: 'esm/locale/zh-cn.mjs', format: 'es' },
- { file: 'locale/zh-cn.js', format: 'umd', name: 'date.locale.zh-cn', esModule: false }
- ]
- },
- {
- input: 'src/locale/zh-tw.js',
- output: [
- { file: 'esm/locale/zh-tw.es.js', format: 'es' },
- { file: 'esm/locale/zh-tw.mjs', format: 'es' },
- { file: 'locale/zh-tw.js', format: 'umd', name: 'date.locale.zh-tw', esModule: false }
- ]
- },
- {
- input: 'src/plugin/day-of-week.js',
- output: [
- { file: 'esm/plugin/day-of-week.es.js', format: 'es' },
- { file: 'esm/plugin/day-of-week.mjs', format: 'es' },
- { file: 'plugin/day-of-week.js', format: 'umd', name: 'date.plugin.day-of-week', esModule: false }
- ]
- },
- {
- input: 'src/plugin/meridiem.js',
- output: [
- { file: 'esm/plugin/meridiem.es.js', format: 'es' },
- { file: 'esm/plugin/meridiem.mjs', format: 'es' },
- { file: 'plugin/meridiem.js', format: 'umd', name: 'date.plugin.meridiem', esModule: false }
- ]
- },
- {
- input: 'src/plugin/microsecond.js',
- output: [
- { file: 'esm/plugin/microsecond.es.js', format: 'es' },
- { file: 'esm/plugin/microsecond.mjs', format: 'es' },
- { file: 'plugin/microsecond.js', format: 'umd', name: 'date.plugin.microsecond', esModule: false }
- ]
- },
- {
- input: 'src/plugin/ordinal.js',
- output: [
- { file: 'esm/plugin/ordinal.es.js', format: 'es' },
- { file: 'esm/plugin/ordinal.mjs', format: 'es' },
- { file: 'plugin/ordinal.js', format: 'umd', name: 'date.plugin.ordinal', esModule: false }
- ]
- },
- {
- input: 'src/plugin/timespan.js',
- output: [
- { file: 'esm/plugin/timespan.es.js', format: 'es' },
- { file: 'esm/plugin/timespan.mjs', format: 'es' },
- { file: 'plugin/timespan.js', format: 'umd', name: 'date.plugin.timespan', esModule: false }
- ]
- },
- {
- input: 'src/plugin/timezone.js',
- output: [
- { file: 'esm/plugin/timezone.es.js', format: 'es' },
- { file: 'esm/plugin/timezone.mjs', format: 'es' },
- { file: 'plugin/timezone.js', format: 'umd', name: 'date.plugin.timezone', esModule: false }
- ]
- },
- {
- input: 'src/plugin/two-digit-year.js',
- output: [
- { file: 'esm/plugin/two-digit-year.es.js', format: 'es' },
- { file: 'esm/plugin/two-digit-year.mjs', format: 'es' },
- { file: 'plugin/two-digit-year.js', format: 'umd', name: 'date.plugin.two-digit-year', esModule: false }
- ]
- },
- {
- input: 'src/index.js',
- output: [
- { file: 'esm/date-and-time.es.min.js', format: 'es' },
- { file: 'date-and-time.min.js', format: 'umd', name: 'date', esModule: false }
- ],
- plugins: [terser()]
- }
-];
diff --git a/rollup.config.ts b/rollup.config.ts
new file mode 100644
index 0000000..c1bd96e
--- /dev/null
+++ b/rollup.config.ts
@@ -0,0 +1,55 @@
+import esbuild from 'rollup-plugin-esbuild';
+import terser from '@rollup/plugin-terser';
+import { dts } from 'rollup-plugin-dts';
+import { globSync } from 'glob';
+
+const ts = () => {
+ const plugins = [
+ esbuild({ minify: false, target: 'es2021' }),
+ terser()
+ ];
+ const config = (input: string | Record, outputDir: string) => ({
+ input,
+ output: [
+ { dir: outputDir, format: 'es' },
+ { dir: outputDir, format: 'cjs', entryFileNames: '[name].cjs' }
+ ],
+ plugins
+ });
+
+ return [
+ config('src/index.ts', 'dist'),
+ config('src/plugin.ts', 'dist'),
+ globSync('src/numerals/**/*.ts').map(input => config(input, 'dist/numerals')),
+ globSync('src/locales/**/*.ts').map(input => config(input, 'dist/locales')),
+ globSync('src/plugins/**/*.ts').map(input => config(input, 'dist/plugins')),
+ config(Object.fromEntries(
+ globSync('src/timezones/**/*.ts').map(input => [input.replace(/(^src\/|\.ts$)/g, ''), input])
+ ), 'dist')
+ ].flat();
+};
+
+const types = () => {
+ const plugins = [dts()];
+ const config = (input: string | Record, outputDir: string) => ({
+ input,
+ output: { dir: outputDir },
+ plugins
+ });
+
+ return [
+ config('src/index.ts', 'dist'),
+ config('src/plugin.ts', 'dist'),
+ globSync('src/plugins/**/*.ts').map(input => config(input, 'dist/plugins'))
+ ].flat();
+};
+
+export default (args: Record) => {
+ if (args['config-ts']) {
+ return ts();
+ }
+ if (args['config-types']) {
+ return types();
+ }
+ return [...ts(), ...types()];
+};
diff --git a/src/addDays.ts b/src/addDays.ts
new file mode 100644
index 0000000..370faeb
--- /dev/null
+++ b/src/addDays.ts
@@ -0,0 +1,35 @@
+import { toParts, fromParts } from './datetime.ts';
+import { isTimeZone, isUTC, getTimezoneOffset } from './timezone.ts';
+import type { TimeZone } from './timezone.ts';
+
+/**
+ * Adds the specified number of days to a Date object.
+ * @param dateObj - The Date object to modify
+ * @param days - The number of days to add
+ * @param [timeZone] - Optional time zone object or 'UTC'
+ * @returns A new Date object with the specified number of days added
+ */
+export function addDays(dateObj: Date, days: number, timeZone?: TimeZone | 'UTC') {
+ // Handle timezone-specific calculation
+ if (isTimeZone(timeZone)) {
+ const parts = toParts(dateObj, timeZone.zone_name);
+
+ parts.day += days;
+ parts.timezoneOffset = 0;
+
+ const utcTime = fromParts(parts);
+ const offset = getTimezoneOffset(utcTime, timeZone);
+
+ return new Date(utcTime - offset * 1000);
+ }
+
+ const d = new Date(dateObj.getTime());
+
+ // Handle UTC calculation
+ if (isUTC(timeZone)) {
+ d.setUTCDate(d.getUTCDate() + days);
+ return d;
+ }
+ d.setDate(d.getDate() + days);
+ return d;
+}
diff --git a/src/addHours.ts b/src/addHours.ts
new file mode 100644
index 0000000..2e761a5
--- /dev/null
+++ b/src/addHours.ts
@@ -0,0 +1,9 @@
+/**
+ * Adds the specified number of hours to a Date object.
+ * @param dateObj - The Date object to modify
+ * @param hours - The number of hours to add
+ * @returns A new Date object with the specified number of hours added
+ */
+export function addHours(dateObj: Date, hours: number) {
+ return new Date(dateObj.getTime() + hours * 3600000);
+}
diff --git a/src/addMilliseconds.ts b/src/addMilliseconds.ts
new file mode 100644
index 0000000..a514ce4
--- /dev/null
+++ b/src/addMilliseconds.ts
@@ -0,0 +1,9 @@
+/**
+ * Adds the specified number of milliseconds to a Date object.
+ * @param dateObj - The Date object to modify
+ * @param milliseconds - The number of milliseconds to add
+ * @returns A new Date object with the specified number of milliseconds added
+ */
+export function addMilliseconds(dateObj: Date, milliseconds: number) {
+ return new Date(dateObj.getTime() + milliseconds);
+}
diff --git a/src/addMinutes.ts b/src/addMinutes.ts
new file mode 100644
index 0000000..eec5217
--- /dev/null
+++ b/src/addMinutes.ts
@@ -0,0 +1,9 @@
+/**
+ * Adds the specified number of minutes to a Date object.
+ * @param dateObj - The Date object to modify
+ * @param minutes - The number of minutes to add
+ * @returns A new Date object with the specified number of minutes added
+ */
+export function addMinutes(dateObj: Date, minutes: number) {
+ return new Date(dateObj.getTime() + minutes * 60000);
+}
diff --git a/src/addMonths.ts b/src/addMonths.ts
new file mode 100644
index 0000000..8547b16
--- /dev/null
+++ b/src/addMonths.ts
@@ -0,0 +1,56 @@
+import { toParts, fromParts } from './datetime.ts';
+import { isTimeZone, isUTC, getTimezoneOffset } from './timezone.ts';
+import type { TimeZone } from './timezone.ts';
+
+/**
+ * Adds the specified number of months to a Date object.
+ * @param dateObj - The Date object to modify
+ * @param months - The number of months to add
+ * @param [timeZone] - Optional time zone object or 'UTC'
+ * @returns A new Date object with the specified number of months added
+ */
+export function addMonths(dateObj: Date, months: number, timeZone?: TimeZone | 'UTC') {
+ // Handle timezone-specific calculation
+ if (isTimeZone(timeZone)) {
+ const parts = toParts(dateObj, timeZone.zone_name);
+
+ parts.month += months;
+ parts.timezoneOffset = 0;
+
+ const d = new Date(fromParts(parts));
+
+ if (d.getUTCDate() < parts.day) {
+ d.setUTCDate(0);
+ }
+
+ const utcTime = fromParts({
+ ...parts,
+ year: d.getUTCFullYear(),
+ month: d.getUTCMonth() + 1,
+ day: d.getUTCDate()
+ });
+ const offset = getTimezoneOffset(utcTime, timeZone);
+
+ return new Date(utcTime - offset * 1000);
+ }
+
+ const d = new Date(dateObj.getTime());
+
+ // Handle UTC calculation
+ if (isUTC(timeZone)) {
+ d.setUTCMonth(d.getUTCMonth() + months);
+ // Adjust to last day of month if new month has fewer days
+ if (d.getUTCDate() < dateObj.getUTCDate()) {
+ d.setUTCDate(0);
+ return d;
+ }
+ return d;
+ }
+ d.setMonth(d.getMonth() + months);
+ // Adjust to last day of month if new month has fewer days
+ if (d.getDate() < dateObj.getDate()) {
+ d.setDate(0);
+ return d;
+ }
+ return d;
+}
diff --git a/src/addSeconds.ts b/src/addSeconds.ts
new file mode 100644
index 0000000..4e4815b
--- /dev/null
+++ b/src/addSeconds.ts
@@ -0,0 +1,9 @@
+/**
+ * Adds the specified number of seconds to a Date object.
+ * @param dateObj - The Date object to modify
+ * @param seconds - The number of seconds to add
+ * @returns A new Date object with the specified number of seconds added
+ */
+export function addSeconds(dateObj: Date, seconds: number) {
+ return new Date(dateObj.getTime() + seconds * 1000);
+}
diff --git a/src/addYears.ts b/src/addYears.ts
new file mode 100644
index 0000000..0e0db11
--- /dev/null
+++ b/src/addYears.ts
@@ -0,0 +1,13 @@
+import { addMonths } from './addMonths.ts';
+import type { TimeZone } from './timezone.ts';
+
+/**
+ * Adds the specified number of years to a Date object.
+ * @param dateObj - The Date object to modify
+ * @param years - The number of years to add
+ * @param [timeZone] - Optional time zone object or 'UTC'
+ * @returns A new Date object with the specified number of years added
+ */
+export function addYears(dateObj: Date, years: number, timeZone?: TimeZone | 'UTC') {
+ return addMonths(dateObj, years * 12, timeZone);
+}
diff --git a/src/compile.ts b/src/compile.ts
new file mode 100644
index 0000000..34ef7eb
--- /dev/null
+++ b/src/compile.ts
@@ -0,0 +1,13 @@
+/** @preserve Copyright (c) KNOWLEDGECODE - MIT License */
+
+export type CompiledObject = string[];
+
+/**
+ * Compiles a format string into a tokenized array for efficient parsing and formatting.
+ * @param formatString - The format string to compile
+ * @returns A compiled array where the first element is the original format string,
+ * followed by tokenized format components
+ */
+export const compile = (formatString: string): CompiledObject => {
+ return [formatString, ...formatString.match(/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g) || []];
+};
diff --git a/src/datetime.ts b/src/datetime.ts
new file mode 100644
index 0000000..edf322b
--- /dev/null
+++ b/src/datetime.ts
@@ -0,0 +1,167 @@
+import { getDateTimeFormat } from './dtf.ts';
+
+export interface DateTimeParts {
+ weekday: number;
+ year: number;
+ month: number;
+ day: number;
+ hour: number;
+ minute: number;
+ second: number;
+ fractionalSecond: number;
+ timezoneOffset: number;
+}
+
+export const toParts = (dateObj: Date, zoneName: string): DateTimeParts => {
+ if (zoneName?.toUpperCase() === 'UTC') {
+ return {
+ weekday: dateObj.getUTCDay(),
+ year: dateObj.getUTCFullYear(),
+ month: dateObj.getUTCMonth() + 1,
+ day: dateObj.getUTCDate(),
+ hour: dateObj.getUTCHours(),
+ minute: dateObj.getUTCMinutes(),
+ second: dateObj.getUTCSeconds(),
+ fractionalSecond: dateObj.getUTCMilliseconds(),
+ timezoneOffset: 0
+ };
+ }
+
+ const values = getDateTimeFormat(zoneName)
+ .formatToParts(dateObj)
+ .reduce((parts, { type, value }) => {
+ switch (type) {
+ case 'weekday':
+ parts[type] = 'SunMonTueWedThuFriSat'.indexOf(value) / 3;
+ break;
+ case 'hour':
+ parts[type] = +value % 24;
+ break;
+ case 'year':
+ case 'month':
+ case 'day':
+ case 'minute':
+ case 'second':
+ case 'fractionalSecond':
+ parts[type] = +value;
+ }
+ return parts;
+ }, {
+ weekday: 4, year: 1970, month: 1, day: 1,
+ hour: 0, minute: 0, second: 0, fractionalSecond: 0,
+ timezoneOffset: 0
+ });
+
+ values.timezoneOffset = (dateObj.getTime() - Date.UTC(
+ values.year,
+ values.month - (values.year < 100 ? 1900 * 12 + 1 : 1),
+ values.day,
+ values.hour,
+ values.minute,
+ values.second,
+ values.fractionalSecond
+ )) / 60000;
+
+ return values;
+};
+
+export const fromParts = (parts: DateTimeParts) => {
+ return Date.UTC(
+ parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day,
+ parts.hour, parts.minute, parts.second, parts.fractionalSecond + parts.timezoneOffset * 60000
+ );
+};
+
+export interface DateLike {
+ /**
+ * Returns the year of the date.
+ */
+ getFullYear(): number,
+ /**
+ * Returns the month of the date (0-11).
+ */
+ getMonth(): number,
+ /**
+ * Returns the day of the month (1-31).
+ */
+ getDate(): number,
+ /**
+ * Returns the hours of the date (0-23).
+ */
+ getHours(): number,
+ /**
+ * Returns the minutes of the date (0-59).
+ */
+ getMinutes(): number,
+ /**
+ * Returns the seconds of the date (0-59).
+ */
+ getSeconds(): number,
+ /**
+ * Returns the milliseconds of the date (0-999).
+ */
+ getMilliseconds(): number,
+ /**
+ * Returns the day of the week (0-6, where 0 is Sunday).
+ */
+ getDay(): number,
+ /**
+ * Returns the time value in milliseconds since the Unix epoch (January 1, 1970).
+ */
+ getTime(): number,
+ /**
+ * Returns the timezone offset in minutes from UTC.
+ */
+ getTimezoneOffset(): number
+}
+
+export class DateTime implements DateLike {
+ private readonly parts: DateTimeParts;
+
+ private readonly time: number;
+
+ constructor (dateObj: Date, zoneName: string) {
+ this.parts = toParts(dateObj, zoneName);
+ this.time = dateObj.getTime();
+ }
+
+ getFullYear () {
+ return this.parts.year;
+ }
+
+ getMonth () {
+ return this.parts.month - 1;
+ }
+
+ getDate () {
+ return this.parts.day;
+ }
+
+ getHours () {
+ return this.parts.hour;
+ }
+
+ getMinutes () {
+ return this.parts.minute;
+ }
+
+ getSeconds () {
+ return this.parts.second;
+ }
+
+ getMilliseconds () {
+ return this.parts.fractionalSecond;
+ }
+
+ getDay () {
+ return this.parts.weekday;
+ }
+
+ getTime () {
+ return this.time;
+ }
+
+ getTimezoneOffset () {
+ return this.parts.timezoneOffset;
+ }
+}
diff --git a/src/dtf.ts b/src/dtf.ts
new file mode 100644
index 0000000..a200d79
--- /dev/null
+++ b/src/dtf.ts
@@ -0,0 +1,16 @@
+const cache = new Map();
+
+export const getDateTimeFormat = (zoneName: string): Intl.DateTimeFormat => {
+ return cache.get(zoneName) || (() => {
+ const dtf = new Intl.DateTimeFormat('en-US', {
+ hour12: false, weekday: 'short', year: 'numeric', month: 'numeric', day: 'numeric',
+ hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3,
+ timeZone: zoneName
+ });
+
+ if (zoneName) {
+ cache.set(zoneName, dtf);
+ }
+ return dtf;
+ })();
+};
diff --git a/src/duration.ts b/src/duration.ts
new file mode 100644
index 0000000..7f236cf
--- /dev/null
+++ b/src/duration.ts
@@ -0,0 +1,278 @@
+import { compile } from './compile.ts';
+import latn from './numerals/latn.ts';
+import type { Numeral } from './numeral.ts';
+
+const comment = /^\[(.*)\]$/;
+
+interface DurationFormatter {
+ D?: number;
+ H?: number;
+ m?: number;
+ s?: number;
+ S?: number;
+ f?: number;
+ F?: number;
+}
+
+const nanosecondsPart = (parts: DurationFormatter, time: number | DOMHighResTimeStamp) => {
+ parts.F = Math.trunc(time * 1000000);
+ return parts;
+};
+
+const microsecondsPart = (parts: DurationFormatter, time: number | DOMHighResTimeStamp) => {
+ parts.f = Math.trunc(time * 1000);
+ return nanosecondsPart(parts, Math.abs(time) * 1000 % 1 / 1000);
+};
+
+const millisecondsPart = (parts: DurationFormatter, time: number | DOMHighResTimeStamp) => {
+ parts.S = Math.trunc(time);
+ return microsecondsPart(parts, Math.abs(time) % 1);
+};
+
+const secondsPart = (parts: DurationFormatter, time: number) => {
+ parts.s = Math.trunc(time / 1000);
+ return millisecondsPart(parts, Math.abs(time) % 1000);
+};
+
+const minutesPart = (parts: DurationFormatter, time: number) => {
+ parts.m = Math.trunc(time / 60000);
+ return secondsPart(parts, Math.abs(time) % 60000);
+};
+
+const hoursPart = (parts: DurationFormatter, time: number) => {
+ parts.H = Math.trunc(time / 3600000);
+ return minutesPart(parts, Math.abs(time) % 3600000);
+};
+
+const daysPart = (parts: DurationFormatter, time: number) => {
+ parts.D = Math.trunc(time / 86400000);
+ return hoursPart(parts, Math.abs(time) % 86400000);
+};
+
+const sign = (time: number) => {
+ return time < 0 || time === 0 && (1 / time) === -Infinity ? '-' : '';
+};
+
+const format = (times: DurationFormatter, formatString: string, numeral: Numeral = latn) => {
+ const pattern = compile(formatString).slice(1);
+ const resolveToken = (token: string) => {
+ if (token[0] in times) {
+ const time = times[token[0] as keyof DurationFormatter] ?? 0;
+ return numeral.encode(`${sign(time)}${`${Math.abs(time)}`.padStart(token.length, '0')}`);
+ }
+ return comment.test(token) ? token.replace(comment, '$1') : token;
+ };
+
+ return pattern.reduce((result, token) => result + resolveToken(token), '');
+};
+
+export interface NanosecondsParts {
+ nanoseconds: number;
+}
+
+export interface MicrosecondsParts extends NanosecondsParts {
+ microseconds: number;
+}
+
+export interface MillisecondsParts extends MicrosecondsParts {
+ milliseconds: number;
+}
+
+export interface SecondsParts extends MillisecondsParts {
+ seconds: number;
+}
+
+export interface MinutesParts extends SecondsParts {
+ minutes: number;
+}
+
+export interface HoursParts extends MinutesParts {
+ hours: number;
+}
+
+export interface DaysParts extends HoursParts {
+ days: number;
+}
+
+export interface DurationDescriptor {
+ /**
+ * The value of the duration in the respective unit.
+ */
+ value: number;
+
+ /**
+ * Formats the duration according to the provided format string.
+ * @param formatString - The format string to use for formatting
+ * @param numeral - Optional numeral object for number formatting
+ * @returns Formatted string representation of the duration
+ */
+ format: (formatString: string, numeral?: Numeral) => string;
+
+ /**
+ * Converts the duration to an object containing the parts of the duration in the respective unit.
+ * @returns An object containing the parts of the duration in the respective unit.
+ */
+ toParts: () => T;
+}
+
+export class Duration {
+ private readonly time: number | DOMHighResTimeStamp;
+
+ constructor (time: number | DOMHighResTimeStamp) {
+ this.time = time;
+ }
+
+ /**
+ * Converts the duration to nanoseconds.
+ * @returns DurationDescriptor with the value in nanoseconds and methods to format and get
+ * the parts of the duration in nanoseconds.
+ */
+ toNanoseconds (): DurationDescriptor {
+ return {
+ value: this.time * 1000000,
+ format: (formatString: string, numeral?: Numeral) => {
+ return format(nanosecondsPart({}, this.time), formatString, numeral);
+ },
+ toParts: () => {
+ return {
+ nanoseconds: Math.trunc(this.time * 1000000) + 0
+ };
+ }
+ };
+ }
+
+ /**
+ * Converts the duration to microseconds.
+ * @returns DurationDescriptor with the value in microseconds and methods to format and get
+ * the parts of the duration in microseconds and nanoseconds.
+ */
+ toMicroseconds (): DurationDescriptor {
+ return {
+ value: this.time * 1000,
+ format: (formatString: string, numeral?: Numeral) => {
+ return format(microsecondsPart({}, this.time), formatString, numeral);
+ },
+ toParts: () => {
+ return {
+ microseconds: Math.trunc(this.time * 1000) + 0,
+ nanoseconds: Math.trunc(this.time * 1000000 % 1000) + 0
+ };
+ }
+ };
+ }
+
+ /**
+ * Converts the duration to milliseconds.
+ * @returns DurationDescriptor with the value in milliseconds and methods to format and get
+ * the parts of the duration in milliseconds, microseconds, and nanoseconds.
+ */
+ toMilliseconds (): DurationDescriptor {
+ return {
+ value: this.time,
+ format: (formatString: string, numeral?: Numeral) => {
+ return format(millisecondsPart({}, this.time), formatString, numeral);
+ },
+ toParts: () => {
+ return {
+ milliseconds: Math.trunc(this.time) + 0,
+ microseconds: Math.trunc(this.time * 1000 % 1000) + 0,
+ nanoseconds: Math.trunc(this.time * 1000000 % 1000) + 0
+ };
+ }
+ };
+ }
+
+ /**
+ * Converts the duration to seconds.
+ * @returns DurationDescriptor with the value in seconds and methods to format and get
+ * the parts of the duration in seconds, milliseconds, microseconds, and nanoseconds.
+ */
+ toSeconds (): DurationDescriptor {
+ return {
+ value: this.time / 1000,
+ format: (formatString: string, numeral?: Numeral) => {
+ return format(secondsPart({}, this.time), formatString, numeral);
+ },
+ toParts: () => {
+ return {
+ seconds: Math.trunc(this.time / 1000) + 0,
+ milliseconds: Math.trunc(this.time % 1000) + 0,
+ microseconds: Math.trunc(this.time * 1000 % 1000) + 0,
+ nanoseconds: Math.trunc(this.time * 1000000 % 1000) + 0
+ };
+ }
+ };
+ }
+
+ /**
+ * Converts the duration to minutes.
+ * @returns DurationDescriptor with the value in minutes and methods to format and get
+ * the parts of the duration in minutes, seconds, milliseconds, microseconds, and nanoseconds.
+ */
+ toMinutes (): DurationDescriptor {
+ return {
+ value: this.time / 60000,
+ format: (formatString: string, numeral?: Numeral) => {
+ return format(minutesPart({}, this.time), formatString, numeral);
+ },
+ toParts: () => {
+ return {
+ minutes: Math.trunc(this.time / 60000) + 0,
+ seconds: Math.trunc(this.time % 86400000 % 3600000 % 60000 / 1000) + 0,
+ milliseconds: Math.trunc(this.time % 1000) + 0,
+ microseconds: Math.trunc(this.time * 1000 % 1000) + 0,
+ nanoseconds: Math.trunc(this.time * 1000000 % 1000) + 0
+ };
+ }
+ };
+ }
+
+ /**
+ * Converts the duration to hours.
+ * @returns DurationDescriptor with the value in hours and methods to format and get
+ * the parts of the duration in hours, minutes, seconds, milliseconds, microseconds, and nanoseconds.
+ */
+ toHours (): DurationDescriptor {
+ return {
+ value: this.time / 3600000,
+ format: (formatString: string, numeral?: Numeral) => {
+ return format(hoursPart({}, this.time), formatString, numeral);
+ },
+ toParts: () => {
+ return {
+ hours: Math.trunc(this.time / 3600000) + 0,
+ minutes: Math.trunc(this.time % 86400000 % 3600000 / 60000) + 0,
+ seconds: Math.trunc(this.time % 86400000 % 3600000 % 60000 / 1000) + 0,
+ milliseconds: Math.trunc(this.time % 1000) + 0,
+ microseconds: Math.trunc(this.time * 1000 % 1000) + 0,
+ nanoseconds: Math.trunc(this.time * 1000000 % 1000) + 0
+ };
+ }
+ };
+ }
+
+ /**
+ * Converts the duration to days.
+ * @returns DurationDescriptor with the value in days and methods to format and get
+ * the parts of the duration in days, hours, minutes, seconds, milliseconds, microseconds, and nanoseconds.
+ */
+ toDays (): DurationDescriptor {
+ return {
+ value: this.time / 86400000,
+ format: (formatString: string, numeral?: Numeral) => {
+ return format(daysPart({}, this.time), formatString, numeral);
+ },
+ toParts: () => {
+ return {
+ days: Math.trunc(this.time / 86400000) + 0,
+ hours: Math.trunc(this.time % 86400000 / 3600000) + 0,
+ minutes: Math.trunc(this.time % 86400000 % 3600000 / 60000) + 0,
+ seconds: Math.trunc(this.time % 86400000 % 3600000 % 60000 / 1000) + 0,
+ milliseconds: Math.trunc(this.time % 1000) + 0,
+ microseconds: Math.trunc(this.time * 1000 % 1000) + 0,
+ nanoseconds: Math.trunc(this.time * 1000000 % 1000) + 0
+ };
+ }
+ };
+ }
+}
diff --git a/src/format.ts b/src/format.ts
new file mode 100644
index 0000000..ec572a9
--- /dev/null
+++ b/src/format.ts
@@ -0,0 +1,44 @@
+import { compile } from './compile.ts';
+import { DateTime } from './datetime.ts';
+import { formatter as defaultFormatter } from './formatter.ts';
+import en from './locales/en.ts';
+import latn from './numerals/latn.ts';
+import { isTimeZone, isUTC } from './timezone.ts';
+import type { CompiledObject } from './compile.ts';
+import type { FormatterOptions } from './formatter.ts';
+
+const comment = /^\[(.*)\]$/;
+
+/**
+ * Formats a Date object according to the specified format string.
+ * @param dateObj - The Date object to format
+ * @param arg - The format string or compiled object to match against the Date object
+ * @param [options] - Optional formatter options for customization
+ * @returns The formatted date string representation
+ */
+export function format(dateObj: Date, arg: string | CompiledObject, options?: FormatterOptions) {
+ const pattern = (typeof arg === 'string' ? compile(arg) : arg).slice(1);
+ const timeZone = isTimeZone(options?.timeZone) || isUTC(options?.timeZone) ? options.timeZone : undefined;
+ const zoneName = typeof timeZone === 'string' ? timeZone : timeZone?.zone_name || '';
+ const dateTime = zoneName ? new DateTime(dateObj, zoneName) : dateObj;
+ const formatterOptions = {
+ hour12: options?.hour12 || 'h12',
+ hour24: options?.hour24 || 'h23',
+ numeral: options?.numeral || latn,
+ calendar: options?.calendar || 'gregory',
+ timeZone,
+ locale: options?.locale || en
+ };
+ const formatters = [...options?.plugins || [], defaultFormatter];
+ const encode = formatterOptions.numeral.encode;
+ const resolveToken = (token: string, compiledObj: CompiledObject) => {
+ for (const formatter of formatters) {
+ if (formatter[token]) {
+ return encode(formatter[token](dateTime, formatterOptions, compiledObj));
+ }
+ }
+ return comment.test(token) ? token.replace(comment, '$1') : token;
+ };
+
+ return pattern.reduce((result, token) => result + resolveToken(token, pattern), '');
+}
diff --git a/src/formatter.ts b/src/formatter.ts
new file mode 100644
index 0000000..daf45bd
--- /dev/null
+++ b/src/formatter.ts
@@ -0,0 +1,191 @@
+import type { CompiledObject } from './compile.ts';
+import type { DateLike } from './datetime.ts';
+import type { Locale } from './locale.ts';
+import type { Numeral } from './numeral.ts';
+import type { TimeZone } from './timezone.ts';
+
+export interface FormatterPluginOptions {
+ /**
+ * The hour format to use for formatting.
+ * This is used when the hour is in 12-hour format.
+ * It can be 'h11' for 11-hour format or 'h12' for 12-hour format.
+ */
+ hour12: 'h11' | 'h12';
+
+ /**
+ * The hour format to use for formatting.
+ * This is used when the hour is in 24-hour format.
+ * It can be 'h23' for 23-hour format or 'h24' for 24-hour format.
+ */
+ hour24: 'h23' | 'h24';
+
+ /**
+ * The numeral system to use for formatting numbers.
+ * This is an object that provides methods to encode and decode numbers in the specified numeral system.
+ */
+ numeral: Numeral;
+
+ /**
+ * The calendar system to use for formatting dates.
+ * This can be 'buddhist' for Buddhist calendar or 'gregory' for Gregorian calendar.
+ */
+ calendar: 'buddhist' | 'gregory';
+
+ /**
+ * The time zone to use for formatting dates and times.
+ * This can be a specific time zone object or 'UTC' to use Coordinated Universal Time.
+ * If not specified, it defaults to undefined, which means the local time zone will be used.
+ */
+ timeZone: TimeZone | 'UTC' | undefined;
+
+ /**
+ * The locale to use for formatting dates and times.
+ * This is an object that provides methods to get localized month names, day names, and meridiems.
+ */
+ locale: Locale;
+}
+
+export abstract class FormatterPlugin {
+ [key: string]: (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string;
+}
+
+export interface FormatterOptions extends Partial {
+ plugins?: FormatterPlugin[];
+}
+
+const getFullYear = (d: DateLike, calendar: 'buddhist' | 'gregory') => {
+ return d.getFullYear() + (calendar === 'buddhist' ? 543 : 0);
+};
+
+class DefaultFormatter extends FormatterPlugin {
+ YYYY (d: DateLike, options: FormatterPluginOptions) {
+ return `000${getFullYear(d, options.calendar)}`.slice(-4);
+ }
+
+ YY (d: DateLike, options: FormatterPluginOptions) {
+ return `0${getFullYear(d, options.calendar)}`.slice(-2);
+ }
+
+ Y (d: DateLike, options: FormatterPluginOptions) {
+ return `${getFullYear(d, options.calendar)}`;
+ }
+
+ MMMM (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getMonthList({ style: 'long', compiledObj });
+ return list[d.getMonth()] || '';
+ }
+
+ MMM (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getMonthList({ style: 'short', compiledObj });
+ return list[d.getMonth()] || '';
+ }
+
+ MM (d: DateLike) {
+ return `0${d.getMonth() + 1}`.slice(-2);
+ }
+
+ M (d: DateLike) {
+ return `${d.getMonth() + 1}`;
+ }
+
+ DD (d: DateLike) {
+ return `0${d.getDate()}`.slice(-2);
+ }
+
+ D (d: DateLike) {
+ return `${d.getDate()}`;
+ }
+
+ HH (d: DateLike, options: FormatterPluginOptions) {
+ return `0${d.getHours() || (options.hour24 === 'h24' ? 24 : 0)}`.slice(-2);
+ }
+
+ H (d: DateLike, options: FormatterPluginOptions) {
+ return `${d.getHours() || (options.hour24 === 'h24' ? 24 : 0)}`;
+ }
+
+ AA (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getMeridiemList({ style: 'long', compiledObj, case: 'uppercase' });
+ return list[+(d.getHours() > 11)] || '';
+ }
+
+ A (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getMeridiemList({ style: 'short', compiledObj, case: 'uppercase' });
+ return list[+(d.getHours() > 11)] || '';
+ }
+
+ aa (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getMeridiemList({ style: 'long', compiledObj, case: 'lowercase' });
+ return list[+(d.getHours() > 11)] || '';
+ }
+
+ a (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getMeridiemList({ style: 'short', compiledObj, case: 'lowercase' });
+ return list[+(d.getHours() > 11)] || '';
+ }
+
+ hh (d: DateLike, options: FormatterPluginOptions) {
+ return `0${d.getHours() % 12 || (options.hour12 === 'h12' ? 12 : 0)}`.slice(-2);
+ }
+
+ h (d: DateLike, options: FormatterPluginOptions) {
+ return `${d.getHours() % 12 || (options.hour12 === 'h12' ? 12 : 0)}`;
+ }
+
+ mm (d: DateLike) {
+ return `0${d.getMinutes()}`.slice(-2);
+ }
+
+ m (d: DateLike) {
+ return `${d.getMinutes()}`;
+ }
+
+ ss (d: DateLike) {
+ return `0${d.getSeconds()}`.slice(-2);
+ }
+
+ s (d: DateLike) {
+ return `${d.getSeconds()}`;
+ }
+
+ SSS (d: DateLike) {
+ return `00${d.getMilliseconds()}`.slice(-3);
+ }
+
+ SS (d: DateLike) {
+ return `00${d.getMilliseconds()}`.slice(-3, -1);
+ }
+
+ S (d: DateLike) {
+ return `00${d.getMilliseconds()}`.slice(-3, -2);
+ }
+
+ dddd (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getDayOfWeekList({ style: 'long', compiledObj });
+ return list[d.getDay()] || '';
+ }
+
+ ddd (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getDayOfWeekList({ style: 'short', compiledObj });
+ return list[d.getDay()] || '';
+ }
+
+ dd (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) {
+ const list = options.locale.getDayOfWeekList({ style: 'narrow', compiledObj });
+ return list[d.getDay()] || '';
+ }
+
+ Z (d: DateLike) {
+ const offset = d.getTimezoneOffset();
+ const absOffset = Math.abs(offset);
+ return `${offset > 0 ? '-' : '+'}${`0${absOffset / 60 | 0}`.slice(-2)}${`0${absOffset % 60}`.slice(-2)}`;
+ }
+
+ ZZ (d: DateLike) {
+ const offset = d.getTimezoneOffset();
+ const absOffset = Math.abs(offset);
+ return `${offset > 0 ? '-' : '+'}${`0${absOffset / 60 | 0}`.slice(-2)}:${`0${absOffset % 60}`.slice(-2)}`;
+ }
+}
+
+export const formatter = new DefaultFormatter();
diff --git a/src/index.js b/src/index.js
deleted file mode 100644
index 92fda03..0000000
--- a/src/index.js
+++ /dev/null
@@ -1,510 +0,0 @@
-/**
- * @preserve date-and-time (c) KNOWLEDGECODE | MIT
- */
-
-var locales = {},
- plugins = {},
- lang = 'en',
- _res = {
- MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- dddd: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
- ddd: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- dd: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
- A: ['AM', 'PM']
- },
- _formatter = {
- YYYY: function (d/*, formatString*/) { return ('000' + d.getFullYear()).slice(-4); },
- YY: function (d/*, formatString*/) { return ('0' + d.getFullYear()).slice(-2); },
- Y: function (d/*, formatString*/) { return '' + d.getFullYear(); },
- MMMM: function (d/*, formatString*/) { return this.res.MMMM[d.getMonth()]; },
- MMM: function (d/*, formatString*/) { return this.res.MMM[d.getMonth()]; },
- MM: function (d/*, formatString*/) { return ('0' + (d.getMonth() + 1)).slice(-2); },
- M: function (d/*, formatString*/) { return '' + (d.getMonth() + 1); },
- DD: function (d/*, formatString*/) { return ('0' + d.getDate()).slice(-2); },
- D: function (d/*, formatString*/) { return '' + d.getDate(); },
- HH: function (d/*, formatString*/) { return ('0' + d.getHours()).slice(-2); },
- H: function (d/*, formatString*/) { return '' + d.getHours(); },
- A: function (d/*, formatString*/) { return this.res.A[d.getHours() > 11 | 0]; },
- hh: function (d/*, formatString*/) { return ('0' + (d.getHours() % 12 || 12)).slice(-2); },
- h: function (d/*, formatString*/) { return '' + (d.getHours() % 12 || 12); },
- mm: function (d/*, formatString*/) { return ('0' + d.getMinutes()).slice(-2); },
- m: function (d/*, formatString*/) { return '' + d.getMinutes(); },
- ss: function (d/*, formatString*/) { return ('0' + d.getSeconds()).slice(-2); },
- s: function (d/*, formatString*/) { return '' + d.getSeconds(); },
- SSS: function (d/*, formatString*/) { return ('00' + d.getMilliseconds()).slice(-3); },
- SS: function (d/*, formatString*/) { return ('0' + (d.getMilliseconds() / 10 | 0)).slice(-2); },
- S: function (d/*, formatString*/) { return '' + (d.getMilliseconds() / 100 | 0); },
- dddd: function (d/*, formatString*/) { return this.res.dddd[d.getDay()]; },
- ddd: function (d/*, formatString*/) { return this.res.ddd[d.getDay()]; },
- dd: function (d/*, formatString*/) { return this.res.dd[d.getDay()]; },
- Z: function (d/*, formatString*/) {
- var offset = d.getTimezoneOffset() / 0.6 | 0;
- return (offset > 0 ? '-' : '+') + ('000' + Math.abs(offset - (offset % 100 * 0.4 | 0))).slice(-4);
- },
- ZZ: function (d/*, formatString*/) {
- var offset = d.getTimezoneOffset();
- var mod = Math.abs(offset);
- return (offset > 0 ? '-' : '+') + ('0' + (mod / 60 | 0)).slice(-2) + ':' + ('0' + mod % 60).slice(-2);
- },
- post: function (str) { return str; },
- res: _res
- },
- _parser = {
- YYYY: function (str/*, formatString */) { return this.exec(/^\d{4}/, str); },
- Y: function (str/*, formatString */) { return this.exec(/^\d{1,4}/, str); },
- MMMM: function (str/*, formatString */) {
- var result = this.find(this.res.MMMM, str);
- result.value++;
- return result;
- },
- MMM: function (str/*, formatString */) {
- var result = this.find(this.res.MMM, str);
- result.value++;
- return result;
- },
- MM: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- M: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- DD: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- D: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- HH: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- H: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- A: function (str/*, formatString */) { return this.find(this.res.A, str); },
- hh: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- h: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- mm: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- m: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- ss: function (str/*, formatString */) { return this.exec(/^\d\d/, str); },
- s: function (str/*, formatString */) { return this.exec(/^\d\d?/, str); },
- SSS: function (str/*, formatString */) { return this.exec(/^\d{1,3}/, str); },
- SS: function (str/*, formatString */) {
- var result = this.exec(/^\d\d?/, str);
- result.value *= 10;
- return result;
- },
- S: function (str/*, formatString */) {
- var result = this.exec(/^\d/, str);
- result.value *= 100;
- return result;
- },
- Z: function (str/*, formatString */) {
- var result = this.exec(/^[+-]\d{2}[0-5]\d/, str);
- result.value = (result.value / 100 | 0) * -60 - result.value % 100;
- return result;
- },
- ZZ: function (str/*, formatString */) {
- var arr = /^([+-])(\d{2}):([0-5]\d)/.exec(str) || ['', '', '', ''];
- return { value: 0 - ((arr[1] + arr[2] | 0) * 60 + (arr[1] + arr[3] | 0)), length: arr[0].length };
- },
- h12: function (h, a) { return (h === 12 ? 0 : h) + a * 12; },
- exec: function (re, str) {
- var result = (re.exec(str) || [''])[0];
- return { value: result | 0, length: result.length };
- },
- find: function (array, str) {
- var index = -1, length = 0;
-
- for (var i = 0, len = array.length, item; i < len; i++) {
- item = array[i];
- if (!str.indexOf(item) && item.length > length) {
- index = i;
- length = item.length;
- }
- }
- return { value: index, length: length };
- },
- pre: function (str) { return str; },
- res: _res
- },
- extend = function (base, props, override, res) {
- var obj = {}, key;
-
- for (key in base) {
- obj[key] = base[key];
- }
- for (key in props || {}) {
- if (!(!!override ^ !!obj[key])) {
- obj[key] = props[key];
- }
- }
- if (res) {
- obj.res = res;
- }
- return obj;
- },
- proto = {
- _formatter: _formatter,
- _parser: _parser
- },
- date;
-
-/**
- * Compiling format strings
- * @param {string} formatString - A format string
- * @returns {Array.} A compiled object
- */
-proto.compile = function (formatString) {
- return [formatString].concat(formatString.match(/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g) || []);
-};
-
-/**
- * Formatting date and time objects (Date -> String)
- * @param {Date} dateObj - A Date object
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Output as UTC
- * @returns {string} A formatted string
- */
-proto.format = function (dateObj, arg, utc) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- formatter = ctx._formatter,
- d = (function () {
- if (utc) {
- var u = new Date(dateObj.getTime());
-
- u.getFullYear = u.getUTCFullYear;
- u.getMonth = u.getUTCMonth;
- u.getDate = u.getUTCDate;
- u.getHours = u.getUTCHours;
- u.getMinutes = u.getUTCMinutes;
- u.getSeconds = u.getUTCSeconds;
- u.getMilliseconds = u.getUTCMilliseconds;
- u.getDay = u.getUTCDay;
- u.getTimezoneOffset = function () { return 0; };
- u.getTimezoneName = function () { return 'UTC'; };
- return u;
- }
- return dateObj;
- }()),
- comment = /^\[(.*)\]$/, str = '';
-
- for (var i = 1, len = pattern.length, token; i < len; i++) {
- token = pattern[i];
- str += formatter[token]
- ? formatter.post(formatter[token](d, pattern[0]))
- : comment.test(token) ? token.replace(comment, '$1') : token;
- }
- return str;
-};
-
-/**
- * Pre-parsing date and time strings
- * @param {string} dateString - A date and time string
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Input as UTC
- * @returns {Object} A pre-parsed result object
- */
-proto.preparse = function (dateString, arg) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- parser = ctx._parser,
- dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 0, _match: 0 },
- wildcard = ' ', comment = /^\[(.*)\]$/, ellipsis = '...';
-
- dateString = parser.pre(dateString);
- for (var i = 1, len = pattern.length, token, str, result; i < len; i++) {
- token = pattern[i];
- str = dateString.substring(dt._index);
-
- if (parser[token]) {
- result = parser[token](str, pattern[0]);
- if (!result.length) {
- break;
- }
- dt[result.token || token.charAt(0)] = result.value;
- dt._index += result.length;
- dt._match++;
- } else if (token === str.charAt(0) || token === wildcard) {
- dt._index++;
- } else if (comment.test(token) && !str.indexOf(token.replace(comment, '$1'))) {
- dt._index += token.length - 2;
- } else if (token === ellipsis) {
- dt._index = dateString.length;
- break;
- } else {
- break;
- }
- }
- dt.H = dt.H || parser.h12(dt.h, dt.A);
- dt._length = dateString.length;
- return dt;
-};
-
-/**
- * Parsing of date and time string (String -> Date)
- * @param {string} dateString - A date-time string
- * @param {string|Array.} arg - A format string or its compiled object
- * @param {boolean} [utc] - Input as UTC
- * @returns {Date} A Date object
- */
-proto.parse = function (dateString, arg, utc) {
- var ctx = this || date, pattern = typeof arg === 'string' ? ctx.compile(arg) : arg,
- dt = ctx.preparse(dateString, pattern);
-
- if (ctx.isValid(dt)) {
- dt.M -= dt.Y < 100 ? 22801 : 1; // 22801 = 1900 * 12 + 1
- if (utc || ~ctx._parser.find(pattern, 'ZZ').value) {
- return new Date(Date.UTC(dt.Y, dt.M, dt.D, dt.H, dt.m + dt.Z, dt.s, dt.S));
- }
- return new Date(dt.Y, dt.M, dt.D, dt.H, dt.m, dt.s, dt.S);
- }
- return new Date(NaN);
-};
-
-/**
- * Date and time string validation
- * @param {Object|string} arg1 - A pre-parsed result object or a date and time string
- * @param {string|Array.} [arg2] - A format string or its compiled object
- * @returns {boolean} Whether the date and time string is a valid date and time
- */
-proto.isValid = function (arg1, arg2) {
- var ctx = this || date, dt = typeof arg1 === 'string' ? ctx.preparse(arg1, arg2) : arg1;
-
- return !(
- dt._index < 1 || dt._length < 1 || dt._index - dt._length || dt._match < 1
- || dt.Y < 1 || dt.Y > 9999 || dt.M < 1 || dt.M > 12 || dt.D < 1 || dt.D > new Date(dt.Y, dt.M, 0).getDate()
- || dt.H < 0 || dt.H > 23 || dt.m < 0 || dt.m > 59 || dt.s < 0 || dt.s > 59 || dt.S < 0 || dt.S > 999
- || dt.Z < -840 || dt.Z > 720
- );
-};
-
-/**
- * Format transformation of date and time string (String -> String)
- * @param {string} dateString - A date and time string
- * @param {string|Array.} arg1 - A format string or its compiled object before transformation
- * @param {string|Array.} arg2 - A format string or its compiled object after transformation
- * @param {boolean} [utc] - Output as UTC
- * @returns {string} A formatted string
- */
-proto.transform = function (dateString, arg1, arg2, utc) {
- const ctx = this || date;
- return ctx.format(ctx.parse(dateString, arg1), arg2, utc);
-};
-
-/**
- * Adding years
- * @param {Date} dateObj - A Date object
- * @param {number} years - Number of years to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addYears = function (dateObj, years, utc) {
- return (this || date).addMonths(dateObj, years * 12, utc);
-};
-
-/**
- * Adding months
- * @param {Date} dateObj - A Date object
- * @param {number} months - Number of months to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addMonths = function (dateObj, months, utc) {
- var d = new Date(dateObj.getTime());
-
- if (utc) {
- d.setUTCMonth(d.getUTCMonth() + months);
- if (d.getUTCDate() < dateObj.getUTCDate()) {
- d.setUTCDate(0);
- return d;
- }
- } else {
- d.setMonth(d.getMonth() + months);
- if (d.getDate() < dateObj.getDate()) {
- d.setDate(0);
- return d;
- }
- }
- return d;
-};
-
-/**
- * Adding days
- * @param {Date} dateObj - A Date object
- * @param {number} days - Number of days to add
- * @param {boolean} [utc] - Calculates as UTC
- * @returns {Date} The Date object after adding the value
- */
-proto.addDays = function (dateObj, days, utc) {
- var d = new Date(dateObj.getTime());
-
- if (utc) {
- d.setUTCDate(d.getUTCDate() + days);
- } else {
- d.setDate(d.getDate() + days);
- }
- return d;
-};
-
-/**
- * Adding hours
- * @param {Date} dateObj - A Date object
- * @param {number} hours - Number of hours to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addHours = function (dateObj, hours) {
- return new Date(dateObj.getTime() + hours * 60 * 60 * 1000);
-};
-
-/**
- * Adding minutes
- * @param {Date} dateObj - A Date object
- * @param {number} minutes - Number of minutes to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addMinutes = function (dateObj, minutes) {
- return new Date(dateObj.getTime() + minutes * 60 * 1000);
-};
-
-/**
- * Adding seconds
- * @param {Date} dateObj - A Date object
- * @param {number} seconds - Number of seconds to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addSeconds = function (dateObj, seconds) {
- return new Date(dateObj.getTime() + seconds * 1000);
-};
-
-/**
- * Adding milliseconds
- * @param {Date} dateObj - A Date object
- * @param {number} milliseconds - Number of milliseconds to add
- * @returns {Date} The Date object after adding the value
- */
-proto.addMilliseconds = function (dateObj, milliseconds) {
- return new Date(dateObj.getTime() + milliseconds);
-};
-
-/**
- * Subtracting two dates (date1 - date2)
- * @param {Date} date1 - A Date object
- * @param {Date} date2 - A Date object
- * @returns {Object} The result object of subtracting date2 from date1
- */
-proto.subtract = function (date1, date2) {
- var delta = date1.getTime() - date2.getTime();
-
- return {
- toMilliseconds: function () {
- return delta;
- },
- toSeconds: function () {
- return delta / 1000;
- },
- toMinutes: function () {
- return delta / 60000;
- },
- toHours: function () {
- return delta / 3600000;
- },
- toDays: function () {
- return delta / 86400000;
- }
- };
-};
-
-/**
- * Whether a year is a leap year
- * @param {number} y - A year to check
- * @returns {boolean} Whether the year is a leap year
- */
-proto.isLeapYear = function (y) {
- return (!(y % 4) && !!(y % 100)) || !(y % 400);
-};
-
-/**
- * Comparison of two dates
- * @param {Date} date1 - A Date object
- * @param {Date} date2 - A Date object
- * @returns {boolean} Whether the two dates are the same day (time is ignored)
- */
-proto.isSameDay = function (date1, date2) {
- return date1.toDateString() === date2.toDateString();
-};
-
-/**
- * Definition of new locale
- * @param {string} code - A language code
- * @param {Function} locale - A locale installer
- * @returns {void}
- */
-proto.locale = function (code, locale) {
- if (!locales[code]) {
- locales[code] = locale;
- }
-};
-
-/**
- * Definition of new plugin
- * @param {string} name - A plugin name
- * @param {Function} plugin - A plugin installer
- * @returns {void}
- */
-proto.plugin = function (name, plugin) {
- if (!plugins[name]) {
- plugins[name] = plugin;
- }
-};
-
-date = extend(proto);
-
-/**
- * Changing locales
- * @param {Function|string} [locale] - A locale installer or language code
- * @returns {string} The current language code
- */
-date.locale = function (locale) {
- var install = typeof locale === 'function' ? locale : date.locale[locale];
-
- if (!install) {
- return lang;
- }
- lang = install(proto);
-
- var extension = locales[lang] || {};
- var res = extend(_res, extension.res, true);
- var formatter = extend(_formatter, extension.formatter, true, res);
- var parser = extend(_parser, extension.parser, true, res);
-
- date._formatter = formatter;
- date._parser = parser;
-
- for (var plugin in plugins) {
- date.extend(plugins[plugin]);
- }
-
- return lang;
-};
-
-/**
- * Functional extension
- * @param {Object} extension - An extension object
- * @returns {void}
- */
-date.extend = function (extension) {
- var res = extend(date._parser.res, extension.res);
- var extender = extension.extender || {};
-
- date._formatter = extend(date._formatter, extension.formatter, false, res);
- date._parser = extend(date._parser, extension.parser, false, res);
-
- for (var key in extender) {
- if (!date[key]) {
- date[key] = extender[key];
- }
- }
-};
-
-/**
- * Importing plugins
- * @param {Function|string} plugin - A plugin installer or plugin name
- * @returns {void}
- */
-date.plugin = function (plugin) {
- var install = typeof plugin === 'function' ? plugin : date.plugin[plugin];
-
- if (install) {
- date.extend(plugins[install(proto, date)] || {});
- }
-};
-
-export default date;
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
new file mode 100644
index 0000000..17e06bc
--- /dev/null
+++ b/src/index.ts
@@ -0,0 +1,16 @@
+export { compile } from './compile.ts';
+export { format } from './format.ts';
+export { preparse } from './preparse.ts';
+export { isValid } from './isValid.ts';
+export { parse } from './parse.ts';
+export { transform } from './transform.ts';
+export { addYears } from './addYears.ts';
+export { addMonths } from './addMonths.ts';
+export { addDays } from './addDays.ts';
+export { addHours } from './addHours.ts';
+export { addMinutes } from './addMinutes.ts';
+export { addSeconds } from './addSeconds.ts';
+export { addMilliseconds } from './addMilliseconds.ts';
+export { Duration } from './duration.ts';
+export { subtract } from './subtract.ts';
+export { isLeapYear, isSameDay } from './utils.ts';
diff --git a/src/isValid.ts b/src/isValid.ts
new file mode 100644
index 0000000..b004ec3
--- /dev/null
+++ b/src/isValid.ts
@@ -0,0 +1,47 @@
+import { preparse } from './preparse.ts';
+import { CompiledObject } from './compile.ts';
+import type { ParserOptions } from './parser.ts';
+import type { PreparseResult } from './preparse.ts';
+
+const getLastDayOfMonth = (year: number, month: number) => {
+ return new Date(year, month - (year < 100 ? 1900 * 12 : 0), 0).getDate();
+};
+
+/**
+ * Validates whether a preparse result object is valid.
+ * @param pr - The preparse result object to validate
+ * @param [options] - Optional parser options
+ * @returns True if the preparse result is valid, false otherwise
+ */
+export function validatePreparseResult(pr: PreparseResult, options?: ParserOptions) {
+ const y = pr.Y === undefined ? 1970 : pr.Y - (options?.calendar === 'buddhist' ? 543 : 0);
+ const [min12, max12] = options?.hour12 === 'h11' ? [0, 11] : [1, 12];
+ const [min24, max24] = options?.hour24 === 'h24' ? [1, 24] : [0, 23];
+ const range = (value: number | undefined, min: number, max: number) => value === undefined || value >= min && value <= max;
+
+ return pr._index > 0
+ && pr._length > 0
+ && pr._index === pr._length
+ && pr._match > 0
+ && range(y, 1, 9999)
+ && range(pr.M, 1, 12)
+ && range(pr.D, 1, getLastDayOfMonth(y, pr.M || 1))
+ && range(pr.H, min24, max24)
+ && range(pr.A, 0, 1)
+ && range(pr.h, min12, max12)
+ && range(pr.m, 0, 59)
+ && range(pr.s, 0, 59)
+ && range(pr.S, 0, 999)
+ && range(pr.Z, -840, 720);
+}
+
+/**
+ * Validates whether a date string is valid according to the specified format.
+ * @param dateString - The date string to validate
+ * @param arg - The format string or compiled object
+ * @param [options] - Optional parser options
+ * @returns True if the date string is valid, false otherwise
+ */
+export function isValid(dateString: string, arg: string | CompiledObject, options?: ParserOptions) {
+ return validatePreparseResult(preparse(dateString, arg, options), options);
+}
diff --git a/src/locale.ts b/src/locale.ts
new file mode 100644
index 0000000..8c4385b
--- /dev/null
+++ b/src/locale.ts
@@ -0,0 +1,14 @@
+import type { CompiledObject } from './compile.ts';
+
+export interface LocaleOptions {
+ compiledObj: CompiledObject;
+ style: 'long' | 'short' | 'narrow';
+ case?: 'uppercase' | 'lowercase'
+}
+
+export interface Locale {
+ getLocale: () => string;
+ getMonthList: (options: LocaleOptions) => string[];
+ getDayOfWeekList: (options: LocaleOptions) => string[];
+ getMeridiemList: (options: LocaleOptions) => string[];
+}
diff --git a/src/locale/ar.js b/src/locale/ar.js
deleted file mode 100644
index eaca041..0000000
--- a/src/locale/ar.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Arabic (ar)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ar = function (date) {
- var code = 'ar';
-
- date.locale(code, {
- res: {
- MMMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- MMM: ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- dddd: ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
- ddd: ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
- dd: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
- A: ['ص', 'م']
- },
- formatter: {
- post: function (str) {
- var num = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '٠': 0, '١': 1, '٢': 2, '٣': 3, '٤': 4, '٥': 5, '٦': 6, '٧': 7, '٨': 8, '٩': 9 };
- return str.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export default ar;
diff --git a/src/locale/az.js b/src/locale/az.js
deleted file mode 100644
index 1627b80..0000000
--- a/src/locale/az.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Azerbaijani (az)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var az = function (date) {
- var code = 'az';
-
- date.locale(code, {
- res: {
- MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
- MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
- dddd: ['Bazar', 'Bazar ertəsi', 'Çərşənbə axşamı', 'Çərşənbə', 'Cümə axşamı', 'Cümə', 'Şənbə'],
- ddd: ['Baz', 'BzE', 'ÇAx', 'Çər', 'CAx', 'Cüm', 'Şən'],
- dd: ['Bz', 'BE', 'ÇA', 'Çə', 'CA', 'Cü', 'Şə'],
- A: ['gecə', 'səhər', 'gündüz', 'axşam']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // gecə
- } else if (h < 12) {
- return this.res.A[1]; // səhər
- } else if (h < 17) {
- return this.res.A[2]; // gündüz
- }
- return this.res.A[3]; // axşam
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // gecə, səhər
- }
- return h > 11 ? h : h + 12; // gündüz, axşam
- }
- }
- });
- return code;
-};
-
-export default az;
diff --git a/src/locale/bn.js b/src/locale/bn.js
deleted file mode 100644
index ed9262a..0000000
--- a/src/locale/bn.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Bengali (bn)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var bn = function (date) {
- var code = 'bn';
-
- date.locale(code, {
- res: {
- MMMM: ['জানুয়ারী', 'ফেবুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
- MMM: ['জানু', 'ফেব', 'মার্চ', 'এপর', 'মে', 'জুন', 'জুল', 'অগ', 'সেপ্ট', 'অক্টো', 'নভ', 'ডিসেম্'],
- dddd: ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পত্তিবার', 'শুক্রবার', 'শনিবার'],
- ddd: ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পত্তি', 'শুক্র', 'শনি'],
- dd: ['রব', 'সম', 'মঙ্গ', 'বু', 'ব্রিহ', 'শু', 'শনি'],
- A: ['রাত', 'সকাল', 'দুপুর', 'বিকাল']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // রাত
- } else if (h < 10) {
- return this.res.A[1]; // সকাল
- } else if (h < 17) {
- return this.res.A[2]; // দুপুর
- } else if (h < 20) {
- return this.res.A[3]; // বিকাল
- }
- return this.res.A[0]; // রাত
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // রাত
- } else if (a < 2) {
- return h; // সকাল
- } else if (a < 3) {
- return h > 9 ? h : h + 12; // দুপুর
- }
- return h + 12; // বিকাল
- }
- }
- });
- return code;
-};
-
-export default bn;
diff --git a/src/locale/cs.js b/src/locale/cs.js
deleted file mode 100644
index 3934bea..0000000
--- a/src/locale/cs.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Czech (cs)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var cs = function (date) {
- var code = 'cs';
-
- date.locale(code, {
- res: {
- MMMM: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
- MMM: ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'],
- dddd: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
- ddd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
- dd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so']
- }
- });
- return code;
-};
-
-export default cs;
diff --git a/src/locale/de.js b/src/locale/de.js
deleted file mode 100644
index 92c5cbf..0000000
--- a/src/locale/de.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve German (de)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var de = function (date) {
- var code = 'de';
-
- date.locale(code, {
- res: {
- MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
- MMM: ['Jan.', 'Febr.', 'Mrz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'],
- dddd: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
- ddd: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
- dd: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
- A: ['Uhr nachmittags', 'Uhr morgens']
- }
- });
- return code;
-};
-
-export default de;
diff --git a/src/locale/dk.js b/src/locale/dk.js
deleted file mode 100644
index 2175e52..0000000
--- a/src/locale/dk.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Danish (DK)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var dk = function (date) {
- var code = 'dk';
-
- date.locale(code, {
- res: {
- MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
- MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
- ddd: ['søn', 'man', 'tir', 'ons', 'tors', 'fre', 'lør'],
- dd: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø']
- }
- });
- return code;
-};
-
-export default dk;
diff --git a/src/locale/el.js b/src/locale/el.js
deleted file mode 100644
index 5a32b7f..0000000
--- a/src/locale/el.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Greek (el)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var el = function (date) {
- var code = 'el';
-
- date.locale(code, {
- res: {
- MMMM: [
- ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
- ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
- ],
- MMM: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
- dddd: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
- ddd: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
- dd: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
- A: ['πμ', 'μμ']
- },
- formatter: {
- MMMM: function (d, formatString) {
- return this.res.MMMM[/D.*MMMM/.test(formatString) | 0][d.getMonth()];
- },
- hh: function (d) {
- return ('0' + d.getHours() % 12).slice(-2);
- },
- h: function (d) {
- return d.getHours() % 12;
- }
- },
- parser: {
- MMMM: function (str, formatString) {
- var result = this.find(this.res.MMMM[/D.*MMMM/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export default el;
diff --git a/src/locale/en.js b/src/locale/en.js
deleted file mode 100644
index 1cb6959..0000000
--- a/src/locale/en.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Englis (en)
- * @preserve This is a dummy module.
- */
-
-var en = function (date) {
- var code = 'en';
-
- return code;
-};
-
-export default en;
diff --git a/src/locale/es.js b/src/locale/es.js
deleted file mode 100644
index 40c5959..0000000
--- a/src/locale/es.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Spanish (es)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var es = function (date) {
- var code = 'es';
-
- date.locale(code, {
- res: {
- MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
- MMM: ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'],
- dddd: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
- ddd: ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'],
- dd: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
- A: ['de la mañana', 'de la tarde', 'de la noche']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 12) {
- return this.res.A[0]; // de la mañana
- } else if (h < 19) {
- return this.res.A[1]; // de la tarde
- }
- return this.res.A[2]; // de la noche
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // de la mañana
- }
- return h > 11 ? h : h + 12; // de la tarde, de la noche
- }
- }
- });
- return code;
-};
-
-export default es;
diff --git a/src/locale/fa.js b/src/locale/fa.js
deleted file mode 100644
index b87740f..0000000
--- a/src/locale/fa.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Persian (fa)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var fa = function (date) {
- var code = 'fa';
-
- date.locale(code, {
- res: {
- MMMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- MMM: ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- dddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- ddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- dd: ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
- A: ['قبل از ظهر', 'بعد از ظهر']
- },
- formatter: {
- post: function (str) {
- var num = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '۰': 0, '۱': 1, '۲': 2, '۳': 3, '۴': 4, '۵': 5, '۶': 6, '۷': 7, '۸': 8, '۹': 9 };
- return str.replace(/[۰۱۲۳۴۵۶۷۸۹]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export default fa;
diff --git a/src/locale/fr.js b/src/locale/fr.js
deleted file mode 100644
index 4357858..0000000
--- a/src/locale/fr.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve French (fr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var fr = function (date) {
- var code = 'fr';
-
- date.locale(code, {
- res: {
- MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
- MMM: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
- dddd: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
- ddd: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
- dd: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
- A: ['matin', 'l\'après-midi']
- }
- });
- return code;
-};
-
-export default fr;
diff --git a/src/locale/hi.js b/src/locale/hi.js
deleted file mode 100644
index c429217..0000000
--- a/src/locale/hi.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Hindi (hi)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var hi = function (date) {
- var code = 'hi';
-
- date.locale(code, {
- res: {
- MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'],
- MMM: ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'],
- dddd: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'],
- ddd: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'],
- dd: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
- A: ['रात', 'सुबह', 'दोपहर', 'शाम']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // रात
- } else if (h < 10) {
- return this.res.A[1]; // सुबह
- } else if (h < 17) {
- return this.res.A[2]; // दोपहर
- } else if (h < 20) {
- return this.res.A[3]; // शाम
- }
- return this.res.A[0]; // रात
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // रात
- } else if (a < 2) {
- return h; // सुबह
- } else if (a < 3) {
- return h > 9 ? h : h + 12; // दोपहर
- }
- return h + 12; // शाम
- }
- }
- });
- return code;
-};
-
-export default hi;
diff --git a/src/locale/hu.js b/src/locale/hu.js
deleted file mode 100644
index 1b7b123..0000000
--- a/src/locale/hu.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Hungarian (hu)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var hu = function (date) {
- var code = 'hu';
-
- date.locale(code, {
- res: {
- MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'],
- MMM: ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'],
- dddd: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'],
- ddd: ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'],
- dd: ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'],
- A: ['de', 'du']
- }
- });
- return code;
-};
-
-export default hu;
diff --git a/src/locale/id.js b/src/locale/id.js
deleted file mode 100644
index b1027b3..0000000
--- a/src/locale/id.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Indonesian (id)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var id = function (date) {
- var code = 'id';
-
- date.locale(code, {
- res: {
- MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'],
- dddd: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
- ddd: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
- dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'],
- A: ['pagi', 'siang', 'sore', 'malam']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 11) {
- return this.res.A[0]; // pagi
- } else if (h < 15) {
- return this.res.A[1]; // siang
- } else if (h < 19) {
- return this.res.A[2]; // sore
- }
- return this.res.A[3]; // malam
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // pagi
- } else if (a < 2) {
- return h >= 11 ? h : h + 12; // siang
- }
- return h + 12; // sore, malam
- }
- }
- });
- return code;
-};
-
-export default id;
diff --git a/src/locale/it.js b/src/locale/it.js
deleted file mode 100644
index cde73d8..0000000
--- a/src/locale/it.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Italian (it)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var it = function (date) {
- var code = 'it';
-
- date.locale(code, {
- res: {
- MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],
- MMM: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
- dddd: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
- ddd: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
- dd: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
- A: ['di mattina', 'di pomerrigio']
- }
- });
- return code;
-};
-
-export default it;
diff --git a/src/locale/ja.js b/src/locale/ja.js
deleted file mode 100644
index 09680ce..0000000
--- a/src/locale/ja.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Japanese (ja)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ja = function (date) {
- var code = 'ja';
-
- date.locale(code, {
- res: {
- MMMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
- ddd: ['日', '月', '火', '水', '木', '金', '土'],
- dd: ['日', '月', '火', '水', '木', '金', '土'],
- A: ['午前', '午後']
- },
- formatter: {
- hh: function (d) {
- return ('0' + d.getHours() % 12).slice(-2);
- },
- h: function (d) {
- return d.getHours() % 12;
- }
- }
- });
- return code;
-};
-
-export default ja;
diff --git a/src/locale/jv.js b/src/locale/jv.js
deleted file mode 100644
index d067535..0000000
--- a/src/locale/jv.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Javanese (jv)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var jv = function (date) {
- var code = 'jv';
-
- date.locale(code, {
- res: {
- MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'],
- MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'],
- dddd: ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'],
- ddd: ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'],
- dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'],
- A: ['enjing', 'siyang', 'sonten', 'ndalu']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 11) {
- return this.res.A[0]; // enjing
- } else if (h < 15) {
- return this.res.A[1]; // siyang
- } else if (h < 19) {
- return this.res.A[2]; // sonten
- }
- return this.res.A[3]; // ndalu
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h; // enjing
- } else if (a < 2) {
- return h >= 11 ? h : h + 12; // siyang
- }
- return h + 12; // sonten, ndalu
- }
- }
- });
- return code;
-};
-
-export default jv;
diff --git a/src/locale/ko.js b/src/locale/ko.js
deleted file mode 100644
index c5d72d8..0000000
--- a/src/locale/ko.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Korean (ko)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ko = function (date) {
- var code = 'ko';
-
- date.locale(code, {
- res: {
- MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- MMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- dddd: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
- ddd: ['일', '월', '화', '수', '목', '금', '토'],
- dd: ['일', '월', '화', '수', '목', '금', '토'],
- A: ['오전', '오후']
- }
- });
- return code;
-};
-
-export default ko;
diff --git a/src/locale/my.js b/src/locale/my.js
deleted file mode 100644
index 81b63f8..0000000
--- a/src/locale/my.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Burmese (my)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var my = function (date) {
- var code = 'my';
-
- date.locale(code, {
- res: {
- MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'],
- MMM: ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'],
- dddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
- ddd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'],
- dd: ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ']
- },
- formatter: {
- post: function (str) {
- var num = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- pre: function (str) {
- var map = { '၀': 0, '၁': 1, '၂': 2, '၃': 3, '၄': 4, '၅': 5, '၆': 6, '၇': 7, '၈': 8, '၉': 9 };
- return str.replace(/[၀၁၂၃၄၅၆၇၈၉]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export default my;
diff --git a/src/locale/nl.js b/src/locale/nl.js
deleted file mode 100644
index 3f1a145..0000000
--- a/src/locale/nl.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Dutch (nl)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var nl = function (date) {
- var code = 'nl';
-
- date.locale(code, {
- res: {
- MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
- MMM: [
- ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
- ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
- ],
- dddd: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
- ddd: ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'],
- dd: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za']
- },
- formatter: {
- MMM: function (d, formatString) {
- return this.res.MMM[/-MMM-/.test(formatString) | 0][d.getMonth()];
- }
- },
- parser: {
- MMM: function (str, formatString) {
- var result = this.find(this.res.MMM[/-MMM-/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export default nl;
diff --git a/src/locale/pa-in.js b/src/locale/pa-in.js
deleted file mode 100644
index 082557c..0000000
--- a/src/locale/pa-in.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Punjabi (pa-in)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pa_in = function (date) {
- var code = 'pa-in';
-
- date.locale(code, {
- res: {
- MMMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- MMM: ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- dddd: ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'],
- ddd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- dd: ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- A: ['ਰਾਤ', 'ਸਵੇਰ', 'ਦੁਪਹਿਰ', 'ਸ਼ਾਮ']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ਰਾਤ
- } else if (h < 10) {
- return this.res.A[1]; // ਸਵੇਰ
- } else if (h < 17) {
- return this.res.A[2]; // ਦੁਪਹਿਰ
- } else if (h < 20) {
- return this.res.A[3]; // ਸ਼ਾਮ
- }
- return this.res.A[0]; // ਰਾਤ
- },
- post: function (str) {
- var num = ['੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯'];
- return str.replace(/\d/g, function (i) {
- return num[i | 0];
- });
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 1) {
- return h < 4 || h > 11 ? h : h + 12; // ਰਾਤ
- } else if (a < 2) {
- return h; // ਸਵੇਰ
- } else if (a < 3) {
- return h >= 10 ? h : h + 12; // ਦੁਪਹਿਰ
- }
- return h + 12; // ਸ਼ਾਮ
- },
- pre: function (str) {
- var map = { '੦': 0, '੧': 1, '੨': 2, '੩': 3, '੪': 4, '੫': 5, '੬': 6, '੭': 7, '੮': 8, '੯': 9 };
- return str.replace(/[੦੧੨੩੪੫੬੭੮੯]/g, function (i) {
- return '' + map[i];
- });
- }
- }
- });
- return code;
-};
-
-export default pa_in;
diff --git a/src/locale/pl.js b/src/locale/pl.js
deleted file mode 100644
index edf08b5..0000000
--- a/src/locale/pl.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Polish (pl)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pl = function (date) {
- var code = 'pl';
-
- date.locale(code, {
- res: {
- MMMM: [
- ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'],
- ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia']
- ],
- MMM: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
- dddd: ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'],
- ddd: ['nie', 'pon', 'wt', 'śr', 'czw', 'pt', 'sb'],
- dd: ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So']
- },
- formatter: {
- MMMM: function (d, formatString) {
- return this.res.MMMM[/D MMMM/.test(formatString) | 0][d.getMonth()];
- }
- },
- parser: {
- MMMM: function (str, formatString) {
- var result = this.find(this.res.MMMM[/D MMMM/.test(formatString) | 0], str);
- result.value++;
- return result;
- }
- }
- });
- return code;
-};
-
-export default pl;
diff --git a/src/locale/pt.js b/src/locale/pt.js
deleted file mode 100644
index 9f7caf6..0000000
--- a/src/locale/pt.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Portuguese (pt)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var pt = function (date) {
- var code = 'pt';
-
- date.locale(code, {
- res: {
- MMMM: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
- MMM: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
- dddd: ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado'],
- ddd: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
- dd: ['Dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sáb'],
- A: ['da madrugada', 'da manhã', 'da tarde', 'da noite']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 5) {
- return this.res.A[0]; // da madrugada
- } else if (h < 12) {
- return this.res.A[1]; // da manhã
- } else if (h < 19) {
- return this.res.A[2]; // da tarde
- }
- return this.res.A[3]; // da noite
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // da madrugada, da manhã
- }
- return h > 11 ? h : h + 12; // da tarde, da noite
- }
- }
- });
- return code;
-};
-
-export default pt;
diff --git a/src/locale/ro.js b/src/locale/ro.js
deleted file mode 100644
index 75905a4..0000000
--- a/src/locale/ro.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Romanian (ro)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ro = function (date) {
- var code = 'ro';
-
- date.locale(code, {
- res: {
- MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'],
- MMM: ['ian.', 'febr.', 'mart.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'],
- dddd: ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'],
- ddd: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'],
- dd: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ']
- }
- });
- return code;
-};
-
-export default ro;
diff --git a/src/locale/ru.js b/src/locale/ru.js
deleted file mode 100644
index 1651580..0000000
--- a/src/locale/ru.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Russian (ru)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var ru = function (date) {
- var code = 'ru';
-
- date.locale(code, {
- res: {
- MMMM: ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'],
- MMM: ['янв', 'фев', 'мар', 'апр', 'мая', 'июня', 'июля', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
- ddd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- dd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- A: ['ночи', 'утра', 'дня', 'вечера']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ночи
- } else if (h < 12) {
- return this.res.A[1]; // утра
- } else if (h < 17) {
- return this.res.A[2]; // дня
- }
- return this.res.A[3]; // вечера
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // ночи, утра
- }
- return h > 11 ? h : h + 12; // дня, вечера
- }
- }
- });
- return code;
-};
-
-export default ru;
diff --git a/src/locale/rw.js b/src/locale/rw.js
deleted file mode 100644
index b501881..0000000
--- a/src/locale/rw.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Kinyarwanda (rw)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var rw = function (date) {
- var code = 'rw';
-
- date.locale(code, {
- res: {
- MMMM: ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'],
- MMM: ['Mtr', 'Gas', 'Wer', 'Mta', 'Gic', 'Kmn', 'Nyk', 'Knm', 'Nze', 'Ukw', 'Ugu', 'Uku'],
- dddd: ['Ku cyumweru', 'Ku wambere', 'Ku wakabiri', 'Ku wagatatu', 'Ku wakane', 'Ku wagatanu', 'Ku wagatandatu'],
- ddd: ['Cyu', 'Mbe', 'Kbr', 'Gtt', 'Kne', 'Gtn', 'Gtd'],
- dd: ['Cy', 'Mb', 'Kb', 'Gt', 'Kn', 'Gn', 'Gd']
- }
- });
- return code;
-};
-
-export default rw;
diff --git a/src/locale/sr.js b/src/locale/sr.js
deleted file mode 100644
index 1ef512e..0000000
--- a/src/locale/sr.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Serbian (sr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var sr = function (date) {
- var code = 'sr';
-
- date.locale(code, {
- res: {
- MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
- MMM: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
- dddd: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
- ddd: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
- dd: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su']
- }
- });
- return code;
-};
-
-export default sr;
diff --git a/src/locale/sv.js b/src/locale/sv.js
deleted file mode 100644
index 335c0a5..0000000
--- a/src/locale/sv.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Swedish (SV)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var sv = function (date) {
- var code = 'sv';
-
- date.locale(code, {
- res: {
- MMMM: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
- MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
- ddd: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
- dd: ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö']
- }
- });
- return code;
-};
-
-export default sv;
diff --git a/src/locale/th.js b/src/locale/th.js
deleted file mode 100644
index 14bbf17..0000000
--- a/src/locale/th.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Thai (th)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var th = function (date) {
- var code = 'th';
-
- date.locale(code, {
- res: {
- MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'],
- MMM: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'],
- dddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'],
- ddd: ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'],
- dd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
- A: ['ก่อนเที่ยง', 'หลังเที่ยง']
- }
- });
- return code;
-};
-
-export default th;
diff --git a/src/locale/tr.js b/src/locale/tr.js
deleted file mode 100644
index 97ad8c6..0000000
--- a/src/locale/tr.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Turkish (tr)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var tr = function (date) {
- var code = 'tr';
-
- date.locale(code, {
- res: {
- MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
- MMM: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
- dddd: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
- ddd: ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'],
- dd: ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct']
- }
- });
- return code;
-};
-
-export default tr;
diff --git a/src/locale/uk.js b/src/locale/uk.js
deleted file mode 100644
index 9d1600c..0000000
--- a/src/locale/uk.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Ukrainian (uk)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var uk = function (date) {
- var code = 'uk';
-
- date.locale(code, {
- res: {
- MMMM: ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'],
- MMM: ['січ', 'лют', 'бер', 'квіт', 'трав', 'черв', 'лип', 'серп', 'вер', 'жовт', 'лист', 'груд'],
- dddd: [
- ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'],
- ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'],
- ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи']
- ],
- ddd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- dd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- A: ['ночі', 'ранку', 'дня', 'вечора']
- },
- formatter: {
- A: function (d) {
- var h = d.getHours();
- if (h < 4) {
- return this.res.A[0]; // ночі
- } else if (h < 12) {
- return this.res.A[1]; // ранку
- } else if (h < 17) {
- return this.res.A[2]; // дня
- }
- return this.res.A[3]; // вечора
- },
- dddd: function (d, formatString) {
- var type = 0;
- if (/(\[[ВвУу]\]) ?dddd/.test(formatString)) {
- type = 1;
- } else if (/\[?(?:минулої|наступної)? ?\] ?dddd/.test(formatString)) {
- type = 2;
- }
- return this.res.dddd[type][d.getDay()];
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 2) {
- return h; // ночі, ранку
- }
- return h > 11 ? h : h + 12; // дня, вечора
- }
- }
- });
- return code;
-};
-
-export default uk;
diff --git a/src/locale/uz.js b/src/locale/uz.js
deleted file mode 100644
index e5fb5c5..0000000
--- a/src/locale/uz.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Uzbek (uz)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var uz = function (date) {
- var code = 'uz';
-
- date.locale(code, {
- res: {
- MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'],
- MMM: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd: ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'],
- ddd: ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'],
- dd: ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша']
- }
- });
- return code;
-};
-
-export default uz;
diff --git a/src/locale/vi.js b/src/locale/vi.js
deleted file mode 100644
index 9340420..0000000
--- a/src/locale/vi.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Vietnamese (vi)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var vi = function (date) {
- var code = 'vi';
-
- date.locale(code, {
- res: {
- MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'],
- MMM: ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'],
- dddd: ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'],
- ddd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- dd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- A: ['sa', 'ch']
- }
- });
- return code;
-};
-
-export default vi;
diff --git a/src/locale/zh-cn.js b/src/locale/zh-cn.js
deleted file mode 100644
index ea6e4fe..0000000
--- a/src/locale/zh-cn.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Chinese (zh-cn)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var zh_cn = function (date) {
- var code = 'zh-cn';
-
- date.locale(code, {
- res: {
- MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd: ['日', '一', '二', '三', '四', '五', '六'],
- A: ['凌晨', '早上', '上午', '中午', '下午', '晚上']
- },
- formatter: {
- A: function (d) {
- var hm = d.getHours() * 100 + d.getMinutes();
- if (hm < 600) {
- return this.res.A[0]; // 凌晨
- } else if (hm < 900) {
- return this.res.A[1]; // 早上
- } else if (hm < 1130) {
- return this.res.A[2]; // 上午
- } else if (hm < 1230) {
- return this.res.A[3]; // 中午
- } else if (hm < 1800) {
- return this.res.A[4]; // 下午
- }
- return this.res.A[5]; // 晚上
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 4) {
- return h; // 凌晨, 早上, 上午, 中午
- }
- return h > 11 ? h : h + 12; // 下午, 晚上
- }
- }
- });
- return code;
-};
-
-export default zh_cn;
diff --git a/src/locale/zh-tw.js b/src/locale/zh-tw.js
deleted file mode 100644
index 32ec286..0000000
--- a/src/locale/zh-tw.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @preserve date-and-time.js locale configuration
- * @preserve Chinese (zh-tw)
- * @preserve It is using moment.js locale configuration as a reference.
- */
-
-var zh_tw = function (date) {
- var code = 'zh-tw';
-
- date.locale(code, {
- res: {
- MMMM: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd: ['日', '一', '二', '三', '四', '五', '六'],
- A: ['早上', '上午', '中午', '下午', '晚上']
- },
- formatter: {
- A: function (d) {
- var hm = d.getHours() * 100 + d.getMinutes();
- if (hm < 900) {
- return this.res.A[0]; // 早上
- } else if (hm < 1130) {
- return this.res.A[1]; // 上午
- } else if (hm < 1230) {
- return this.res.A[2]; // 中午
- } else if (hm < 1800) {
- return this.res.A[3]; // 下午
- }
- return this.res.A[4]; // 晚上
- }
- },
- parser: {
- h12: function (h, a) {
- if (a < 3) {
- return h; // 早上, 上午, 中午
- }
- return h > 11 ? h : h + 12; // 下午, 晚上
- }
- }
- });
- return code;
-};
-
-export default zh_tw;
diff --git a/src/locales/ar.ts b/src/locales/ar.ts
new file mode 100644
index 0000000..abe6df2
--- /dev/null
+++ b/src/locales/ar.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Arabic (ar)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
+ MMM: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
+ dddd: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
+ ddd: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
+ dd: ['أح', 'اث', 'ثل', 'أر', 'خم', 'جم', 'سب'],
+ A: ['ص', 'م'],
+ AA: ['ص', 'م'],
+ a: ['ص', 'م'],
+ aa: ['ص', 'م']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'ar';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/az.ts b/src/locales/az.ts
new file mode 100644
index 0000000..c99053a
--- /dev/null
+++ b/src/locales/az.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Azerbaijani (az)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
+ MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
+ dddd: ['bazar', 'bazar ertəsi', 'çərşənbə axşamı', 'çərşənbə', 'cümə axşamı', 'cümə', 'şənbə'],
+ ddd: ['B.', 'B.E.', 'Ç.A.', 'Ç.', 'C.A.', 'C.', 'Ş.'],
+ dd: ['7', '1', '2', '3', '4', '5', '6'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'az';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/bn.ts b/src/locales/bn.ts
new file mode 100644
index 0000000..5c7e407
--- /dev/null
+++ b/src/locales/bn.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Bangla (bn)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
+ MMM: ['জানু', 'ফেব', 'মার্চ', 'এপ্রি', 'মে', 'জুন', 'জুল', 'আগ', 'সেপ', 'অক্টো', 'নভে', 'ডিসে'],
+ dddd: ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পতিবার', 'শুক্রবার', 'শনিবার'],
+ ddd: ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'],
+ dd: ['র', 'সো', 'ম', 'বু', 'বৃ', 'শু', 'শ'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'bn';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/cs.ts b/src/locales/cs.ts
new file mode 100644
index 0000000..508e720
--- /dev/null
+++ b/src/locales/cs.ts
@@ -0,0 +1,53 @@
+/**
+ * @file Czech (cs)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: [
+ ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
+ ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince']
+ ],
+ MMM: [
+ ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
+ ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro']
+ ],
+ dddd: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
+ ddd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
+ dd: ['N', 'P', 'Ú', 'S', 'Č', 'P', 'S'],
+ A: ['dop.', 'odp.'],
+ AA: ['dop.', 'odp.'],
+ a: ['dop.', 'odp.'],
+ aa: ['dop.', 'odp.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'cs';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return (options.style === 'long'
+ ? list.MMMM
+ : list.MMM)[options.compiledObj.findIndex(token => /^D+$/.test(token)) < 0 ? 0 : 1];
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/da.ts b/src/locales/da.ts
new file mode 100644
index 0000000..e2a5db5
--- /dev/null
+++ b/src/locales/da.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Danish (da)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
+ MMM: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
+ dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
+ ddd: ['søn.', 'man.', 'tirs.', 'ons.', 'tors.', 'fre.', 'lør.'],
+ dd: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'da';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/de.ts b/src/locales/de.ts
new file mode 100644
index 0000000..40ae7f3
--- /dev/null
+++ b/src/locales/de.ts
@@ -0,0 +1,47 @@
+/**
+ * @file German (de)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
+ MMM: ['Jan.', 'Feb.', 'März', 'Apr.', 'Mai', 'Juni', 'Juli', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'],
+ dddd: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
+ ddd: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
+ dd: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'de';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/el.ts b/src/locales/el.ts
new file mode 100644
index 0000000..071a298
--- /dev/null
+++ b/src/locales/el.ts
@@ -0,0 +1,50 @@
+/**
+ * @file Greek (el)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: [
+ ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
+ ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
+ ],
+ MMM: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαΐ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
+ dddd: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
+ ddd: ['Κυρ', 'Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ'],
+ dd: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
+ A: ['ΠΜ', 'ΜΜ'],
+ AA: ['Π.Μ.', 'Μ.Μ.'],
+ a: ['πμ', 'μμ'],
+ aa: ['π.μ.', 'μ.μ.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'el';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM[options.compiledObj.findIndex(token => /^D+$/.test(token)) < 0 ? 0 : 1]
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/en.ts b/src/locales/en.ts
new file mode 100644
index 0000000..4dbea32
--- /dev/null
+++ b/src/locales/en.ts
@@ -0,0 +1,47 @@
+/**
+ * @file English (en)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ dddd: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+ ddd: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ dd: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'en';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/es.ts b/src/locales/es.ts
new file mode 100644
index 0000000..fec528f
--- /dev/null
+++ b/src/locales/es.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Spanish (es)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
+ MMM: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sept', 'oct', 'nov', 'dic'],
+ dddd: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
+ ddd: ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb'],
+ dd: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'es';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/fa.ts b/src/locales/fa.ts
new file mode 100644
index 0000000..80a413c
--- /dev/null
+++ b/src/locales/fa.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Persian (fa)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['دی', 'بهمن', 'اسفند', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر'],
+ MMM: ['دی', 'بهمن', 'اسفند', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر'],
+ dddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
+ ddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
+ dd: ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
+ A: ['قبلازظهر', 'بعدازظهر'],
+ AA: ['قبلازظهر', 'بعدازظهر'],
+ a: ['قبلازظهر', 'بعدازظهر'],
+ aa: ['قبلازظهر', 'بعدازظهر']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'fa';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/fi.ts b/src/locales/fi.ts
new file mode 100644
index 0000000..a9ee338
--- /dev/null
+++ b/src/locales/fi.ts
@@ -0,0 +1,53 @@
+/**
+ * @file Finnish (fi)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: [
+ ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
+ ['tammikuuta', 'helmikuuta', 'maaliskuuta', 'huhtikuuta', 'toukokuuta', 'kesäkuuta', 'heinäkuuta', 'elokuuta', 'syyskuuta', 'lokakuuta', 'marraskuuta', 'joulukuuta']
+ ],
+ MMM: [
+ ['tammi', 'helmi', 'maalis', 'huhti', 'touko', 'kesä', 'heinä', 'elo', 'syys', 'loka', 'marras', 'joulu'],
+ ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
+ ],
+ dddd: ['sunnuntai', 'maanantaina', 'tiistaina', 'keskiviikkona', 'torstaina', 'perjantaina', 'lauantaina'],
+ ddd: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
+ dd: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
+ A: ['ap.', 'ip.'],
+ AA: ['ap.', 'ip.'],
+ a: ['ap.', 'ip.'],
+ aa: ['ap.', 'ip.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'fi';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return (options.style === 'long'
+ ? list.MMMM
+ : list.MMM)[options.compiledObj.findIndex(token => /^D+$/.test(token)) < 0 ? 0 : 1];
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/fr.ts b/src/locales/fr.ts
new file mode 100644
index 0000000..08d43a0
--- /dev/null
+++ b/src/locales/fr.ts
@@ -0,0 +1,47 @@
+/**
+ * @file French (fr)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
+ MMM: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
+ dddd: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
+ ddd: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
+ dd: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'fr';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/he.ts b/src/locales/he.ts
new file mode 100644
index 0000000..f21a865
--- /dev/null
+++ b/src/locales/he.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Hebrew (he)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
+ MMM: ['ינו׳', 'פבר׳', 'מרץ', 'אפר׳', 'מאי', 'יוני', 'יולי', 'אוג׳', 'ספט׳', 'אוק׳', 'נוב׳', 'דצמ׳'],
+ dddd: ['יום ראשון', 'יום שני', 'יום שלישי', 'יום רביעי', 'יום חמישי', 'יום שישי', 'יום שבת'],
+ ddd: ['יום א׳', 'יום ב׳', 'יום ג׳', 'יום ד׳', 'יום ה׳', 'יום ו׳', 'שבת'],
+ dd: ['א׳', 'ב׳', 'ג׳', 'ד׳', 'ה׳', 'ו׳', 'ש׳'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'he';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/hi.ts b/src/locales/hi.ts
new file mode 100644
index 0000000..1962b14
--- /dev/null
+++ b/src/locales/hi.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Hindi (hi)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्तूबर', 'नवंबर', 'दिसंबर'],
+ MMM: ['जन॰', 'फ़र॰', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुल॰', 'अग॰', 'सित॰', 'अक्तू॰', 'नव॰', 'दिस॰'],
+ dddd: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरुवार', 'शुक्रवार', 'शनिवार'],
+ ddd: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'],
+ dd: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'hi';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/hu.ts b/src/locales/hu.ts
new file mode 100644
index 0000000..ea2f4fb
--- /dev/null
+++ b/src/locales/hu.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Hungarian (hu)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'],
+ MMM: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
+ dddd: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'],
+ ddd: ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'],
+ dd: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
+ A: ['DE', 'DU'],
+ AA: ['DE.', 'DU.'],
+ a: ['de', 'du'],
+ aa: ['de.', 'du.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'hu';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/id.ts b/src/locales/id.ts
new file mode 100644
index 0000000..bb6b5b7
--- /dev/null
+++ b/src/locales/id.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Indonesian (id)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
+ MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'],
+ dddd: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
+ ddd: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
+ dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'id';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/it.ts b/src/locales/it.ts
new file mode 100644
index 0000000..81d9060
--- /dev/null
+++ b/src/locales/it.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Italian (it)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],
+ MMM: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
+ dddd: ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato'],
+ ddd: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
+ dd: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'it';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/ja.ts b/src/locales/ja.ts
new file mode 100644
index 0000000..cdd7f71
--- /dev/null
+++ b/src/locales/ja.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Japanese (ja)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ MMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ dddd: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
+ ddd: ['日', '月', '火', '水', '木', '金', '土'],
+ dd: ['日', '月', '火', '水', '木', '金', '土'],
+ A: ['午前', '午後'],
+ AA: ['午前', '午後'],
+ a: ['午前', '午後'],
+ aa: ['午前', '午後']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'ja';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/ko.ts b/src/locales/ko.ts
new file mode 100644
index 0000000..74cddfa
--- /dev/null
+++ b/src/locales/ko.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Korean (ko)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
+ MMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
+ dddd: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
+ ddd: ['일', '월', '화', '수', '목', '금', '토'],
+ dd: ['일', '월', '화', '수', '목', '금', '토'],
+ A: ['오전', '오후'],
+ AA: ['오전', '오후'],
+ a: ['오전', '오후'],
+ aa: ['오전', '오후']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'ko';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/ms.ts b/src/locales/ms.ts
new file mode 100644
index 0000000..44c92cf
--- /dev/null
+++ b/src/locales/ms.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Malay (ms)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'],
+ MMM: ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ogo', 'Sep', 'Okt', 'Nov', 'Dis'],
+ dddd: ['Ahad', 'Isnin', 'Selasa', 'Rabu', 'Khamis', 'Jumaat', 'Sabtu'],
+ ddd: ['Ahd', 'Isn', 'Sel', 'Rab', 'Kha', 'Jum', 'Sab'],
+ dd: ['Ahd', 'Isn', 'Sel', 'Rab', 'Kha', 'Jum', 'Sab'],
+ A: ['PG', 'PTG'],
+ AA: ['PG', 'PTG'],
+ a: ['PG', 'PTG'],
+ aa: ['PG', 'PTG']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'ms';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/my.ts b/src/locales/my.ts
new file mode 100644
index 0000000..92acc98
--- /dev/null
+++ b/src/locales/my.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Burmese (my)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'ဩဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'],
+ MMM: ['ဇန်', 'ဖေ', 'မတ်', 'ဧ', 'မေ', 'ဇွန်', 'ဇူ', 'ဩ', 'စက်', 'အောက်', 'နို', 'ဒီ'],
+ dddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
+ ddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
+ dd: ['တ', 'တ', 'အ', 'ဗ', 'က', 'သ', 'စ'],
+ A: ['နံနက်', 'ညနေ'],
+ AA: ['နံနက်', 'ညနေ'],
+ a: ['နံနက်', 'ညနေ'],
+ aa: ['နံနက်', 'ညနေ']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'my';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/nl.ts b/src/locales/nl.ts
new file mode 100644
index 0000000..6196465
--- /dev/null
+++ b/src/locales/nl.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Dutch (nl)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
+ MMM: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
+ dddd: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
+ ddd: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
+ dd: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'nl';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/no.ts b/src/locales/no.ts
new file mode 100644
index 0000000..88766a6
--- /dev/null
+++ b/src/locales/no.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Norwegian (no)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'],
+ MMM: ['jan.', 'feb.', 'mars', 'apr.', 'mai', 'juni', 'juli', 'aug.', 'sep.', 'okt.', 'nov.', 'des.'],
+ dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
+ ddd: ['søn.', 'man.', 'tir.', 'ons.', 'tor.', 'fre.', 'lør.'],
+ dd: ['søn.', 'man.', 'tir.', 'ons.', 'tor.', 'fre.', 'lør.'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'no';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/pl.ts b/src/locales/pl.ts
new file mode 100644
index 0000000..25374ae
--- /dev/null
+++ b/src/locales/pl.ts
@@ -0,0 +1,50 @@
+/**
+ * @file Polish (pl)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: [
+ ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'],
+ ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia']
+ ],
+ MMM: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
+ dddd: ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'],
+ ddd: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
+ dd: ['ndz.', 'pn.', 'wt.', 'śr.', 'cz.', 'pt.', 'so.'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'pl';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM[options.compiledObj.findIndex(token => /^D+$/.test(token)) < 0 ? 0 : 1]
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/pt-BR.ts b/src/locales/pt-BR.ts
new file mode 100644
index 0000000..5b768d3
--- /dev/null
+++ b/src/locales/pt-BR.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Brazilian Portuguese (pt-BR)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'],
+ MMM: ['jan.', 'fev.', 'mar.', 'abr.', 'mai.', 'jun.', 'jul.', 'ago.', 'set.', 'out.', 'nov.', 'dez.'],
+ dddd: ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'],
+ ddd: ['dom.', 'seg.', 'ter.', 'qua.', 'qui.', 'sex.', 'sáb.'],
+ dd: ['1ª', '2ª', '3ª', '4ª', '5ª', '6ª', '7ª'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'pt-BR';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/pt-PT.ts b/src/locales/pt-PT.ts
new file mode 100644
index 0000000..7d46b56
--- /dev/null
+++ b/src/locales/pt-PT.ts
@@ -0,0 +1,47 @@
+/**
+ * @file European Portuguese (pt-PT)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'],
+ MMM: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
+ dddd: ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'],
+ ddd: ['domingo', 'segunda', 'terça', 'quarta', 'quinta', 'sexta', 'sábado'],
+ dd: ['Do', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sa'],
+ A: ['da manhã', 'da tarde'],
+ AA: ['da manhã', 'da tarde'],
+ a: ['da manhã', 'da tarde'],
+ aa: ['da manhã', 'da tarde']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'pt-PT';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/ro.ts b/src/locales/ro.ts
new file mode 100644
index 0000000..cfb2743
--- /dev/null
+++ b/src/locales/ro.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Romanian (ro)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'],
+ MMM: ['ian.', 'feb.', 'mar.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'],
+ dddd: ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'],
+ ddd: ['dum.', 'lun.', 'mar.', 'mie.', 'joi', 'vin.', 'sâm.'],
+ dd: ['du', 'lu', 'ma', 'mi', 'jo', 'vi', 'sâ'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'ro';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/ru.ts b/src/locales/ru.ts
new file mode 100644
index 0000000..08eed3d
--- /dev/null
+++ b/src/locales/ru.ts
@@ -0,0 +1,53 @@
+/**
+ * @file Russian (ru)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: [
+ ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'],
+ ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря']
+ ],
+ MMM: [
+ ['янв.', 'февр.', 'март', 'апр.', 'май', 'июнь', 'июль', 'авг.', 'сент.', 'окт.', 'нояб.', 'дек.'],
+ ['янв.', 'февр.', 'мар.', 'апр.', 'мая', 'июн.', 'июл.', 'авг.', 'сент.', 'окт.', 'нояб.', 'дек.']
+ ],
+ dddd: ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота'],
+ ddd: ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
+ dd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'ru';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return (options.style === 'long'
+ ? list.MMMM
+ : list.MMM)[options.compiledObj.findIndex(token => /^D+$/.test(token)) < 0 ? 0 : 1];
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/rw.ts b/src/locales/rw.ts
new file mode 100644
index 0000000..3468e9c
--- /dev/null
+++ b/src/locales/rw.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Kinyarwanda (rw)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'],
+ MMM: ['mut.', 'gas.', 'wer.', 'mat.', 'gic.', 'kam.', 'nya.', 'kan.', 'nze.', 'ukw.', 'ugu.', 'uku.'],
+ dddd: ['Ku cyumweru', 'Kuwa mbere', 'Kuwa kabiri', 'Kuwa gatatu', 'Kuwa kane', 'Kuwa gatanu', 'Kuwa gatandatu'],
+ ddd: ['cyu.', 'mbe.', 'kab.', 'gtu.', 'kan.', 'gnu.', 'gnd.'],
+ dd: ['cyu.', 'mbe.', 'kab.', 'gtu.', 'kan.', 'gnu.', 'gnd.'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'rw';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/sr-Cyrl.ts b/src/locales/sr-Cyrl.ts
new file mode 100644
index 0000000..c70bbc6
--- /dev/null
+++ b/src/locales/sr-Cyrl.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Serbian (sr-Cyrl)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'],
+ MMM: ['јан', 'феб', 'мар', 'апр', 'мај', 'јун', 'јул', 'авг', 'сеп', 'окт', 'нов', 'дец'],
+ dddd: ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'],
+ ddd: ['нед', 'пон', 'уто', 'сре', 'чет', 'пет', 'суб'],
+ dd: ['нед', 'пон', 'уто', 'сре', 'чет', 'пет', 'суб'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'sr-Cyrl';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/sr-Latn.ts b/src/locales/sr-Latn.ts
new file mode 100644
index 0000000..e936fc1
--- /dev/null
+++ b/src/locales/sr-Latn.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Serbian (sr-Latn)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
+ MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
+ dddd: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
+ ddd: ['ned', 'pon', 'uto', 'sre', 'čet', 'pet', 'sub'],
+ dd: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'sr-Latn';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/sv.ts b/src/locales/sv.ts
new file mode 100644
index 0000000..ea510c0
--- /dev/null
+++ b/src/locales/sv.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Swedish (sv)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
+ MMM: ['jan.', 'feb.', 'mars', 'apr.', 'maj', 'juni', 'juli', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
+ dddd: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
+ ddd: ['sön', 'mån', 'tis', 'ons', 'tors', 'fre', 'lör'],
+ dd: ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö'],
+ A: ['fm', 'em'],
+ AA: ['fm', 'em'],
+ a: ['fm', 'em'],
+ aa: ['fm', 'em']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'sv';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/ta.ts b/src/locales/ta.ts
new file mode 100644
index 0000000..cf87f13
--- /dev/null
+++ b/src/locales/ta.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Tamil (ta)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'],
+ MMM: ['ஜன.', 'பிப்.', 'மார்.', 'ஏப்.', 'மே', 'ஜூன்', 'ஜூலை', 'ஆக.', 'செப்.', 'அக்.', 'நவ.', 'டிச.'],
+ dddd: ['ஞாயிறு', 'திங்கள்', 'செவ்வாய்', 'புதன்', 'வியாழன்', 'வெள்ளி', 'சனி'],
+ ddd: ['ஞாயி.', 'திங்.', 'செவ்.', 'புத.', 'வியா.', 'வெள்.', 'சனி'],
+ dd: ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'ta';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/th.ts b/src/locales/th.ts
new file mode 100644
index 0000000..35fc148
--- /dev/null
+++ b/src/locales/th.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Thai (th)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'],
+ MMM: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'],
+ dddd: ['วันอาทิตย์', 'วันจันทร์', 'วันอังคาร', 'วันพุธ', 'วันพฤหัสบดี', 'วันศุกร์', 'วันเสาร์'],
+ ddd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
+ dd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
+ A: ['ก่อนเที่ยง', 'หลังเที่ยง'],
+ AA: ['ก่อนเที่ยง', 'หลังเที่ยง'],
+ a: ['ก่อนเที่ยง', 'หลังเที่ยง'],
+ aa: ['ก่อนเที่ยง', 'หลังเที่ยง']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'th';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/tr.ts b/src/locales/tr.ts
new file mode 100644
index 0000000..dadfd6c
--- /dev/null
+++ b/src/locales/tr.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Turkish (tr)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
+ MMM: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
+ dddd: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
+ ddd: ['Paz', 'Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cmt'],
+ dd: ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'],
+ A: ['ÖÖ', 'ÖS'],
+ AA: ['ÖÖ', 'ÖS'],
+ a: ['ÖÖ', 'ÖS'],
+ aa: ['ÖÖ', 'ÖS']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'tr';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/uk.ts b/src/locales/uk.ts
new file mode 100644
index 0000000..ff535f0
--- /dev/null
+++ b/src/locales/uk.ts
@@ -0,0 +1,50 @@
+/**
+ * @file Ukrainian (uk)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: [
+ ['січень', 'лютий', 'березень', 'квітень', 'травень', 'червень', 'липень', 'серпень', 'вересень', 'жовтень', 'листопад', 'грудень'],
+ ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня']
+ ],
+ MMM: ['січ.', 'лют.', 'бер.', 'квіт.', 'трав.', 'черв.', 'лип.', 'серп.', 'вер.', 'жовт.', 'лист.', 'груд.'],
+ dddd: ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'пʼятниця', 'субота'],
+ ddd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
+ dd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
+ A: ['дп', 'пп'],
+ AA: ['дп', 'пп'],
+ a: ['дп', 'пп'],
+ aa: ['дп', 'пп']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'uk';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM[options.compiledObj.findIndex(token => /^D+$/.test(token)) < 0 ? 0 : 1]
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/uz-Cyrl.ts b/src/locales/uz-Cyrl.ts
new file mode 100644
index 0000000..6030864
--- /dev/null
+++ b/src/locales/uz-Cyrl.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Uzbek (uz-Cyrl)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'],
+ MMM: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'],
+ dddd: ['якшанба', 'душанба', 'сешанба', 'чоршанба', 'пайшанба', 'жума', 'шанба'],
+ ddd: ['якш', 'душ', 'сеш', 'чор', 'пай', 'жум', 'шан'],
+ dd: ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша'],
+ A: ['ТО', 'ТК'],
+ AA: ['ТО', 'ТК'],
+ a: ['ТО', 'ТК'],
+ aa: ['ТО', 'ТК']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'uz-Cyrl';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/uz-Latn.ts b/src/locales/uz-Latn.ts
new file mode 100644
index 0000000..8858194
--- /dev/null
+++ b/src/locales/uz-Latn.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Uzbek (uz-Latn)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avgust', 'sentabr', 'oktabr', 'noyabr', 'dekabr'],
+ MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avg', 'sen', 'okt', 'noy', 'dek'],
+ dddd: ['yakshanba', 'dushanba', 'seshanba', 'chorshanba', 'payshanba', 'juma', 'shanba'],
+ ddd: ['Yak', 'Dush', 'Sesh', 'Chor', 'Pay', 'Jum', 'Shan'],
+ dd: ['Yak', 'Dush', 'Sesh', 'Chor', 'Pay', 'Jum', 'Shan'],
+ A: ['TO', 'TK'],
+ AA: ['TO', 'TK'],
+ a: ['TO', 'TK'],
+ aa: ['TO', 'TK']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'uz-Latn';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/vi.ts b/src/locales/vi.ts
new file mode 100644
index 0000000..626e5a2
--- /dev/null
+++ b/src/locales/vi.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Vietnamese (vi)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'],
+ MMM: ['thg 1', 'thg 2', 'thg 3', 'thg 4', 'thg 5', 'thg 6', 'thg 7', 'thg 8', 'thg 9', 'thg 10', 'thg 11', 'thg 12'],
+ dddd: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],
+ ddd: ['CN', 'Th 2', 'Th 3', 'Th 4', 'Th 5', 'Th 6', 'Th 7'],
+ dd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
+ A: ['SA', 'CH'],
+ AA: ['SA', 'CH'],
+ a: ['SA', 'CH'],
+ aa: ['SA', 'CH']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'vi';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/zh-Hans.ts b/src/locales/zh-Hans.ts
new file mode 100644
index 0000000..faa99c3
--- /dev/null
+++ b/src/locales/zh-Hans.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Chinese (zh-Hans)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ MMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
+ ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
+ dd: ['日', '一', '二', '三', '四', '五', '六'],
+ A: ['上午', '下午'],
+ AA: ['上午', '下午'],
+ a: ['上午', '下午'],
+ aa: ['上午', '下午']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'zh-Hans';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/locales/zh-Hant.ts b/src/locales/zh-Hant.ts
new file mode 100644
index 0000000..63e6a8a
--- /dev/null
+++ b/src/locales/zh-Hant.ts
@@ -0,0 +1,47 @@
+/**
+ * @file Chinese (zh-Hant)
+ */
+
+import type { Locale, LocaleOptions } from '../locale.ts';
+
+const list = {
+ MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ MMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
+ ddd: ['週日', '週一', '週二', '週三', '週四', '週五', '週六'],
+ dd: ['日', '一', '二', '三', '四', '五', '六'],
+ A: ['上午', '下午'],
+ AA: ['上午', '下午'],
+ a: ['上午', '下午'],
+ aa: ['上午', '下午']
+};
+
+export default new class implements Locale {
+ getLocale () {
+ return 'zh-Hant';
+ }
+
+ getMonthList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.MMMM
+ : list.MMM;
+ }
+
+ getDayOfWeekList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? list.dddd
+ : options.style === 'short'
+ ? list.ddd
+ : list.dd;
+ }
+
+ getMeridiemList (options: LocaleOptions) {
+ return options.style === 'long'
+ ? options.case === 'lowercase'
+ ? list.aa
+ : list.AA
+ : options.case === 'lowercase'
+ ? list.a
+ : list.A;
+ }
+}();
diff --git a/src/numeral.ts b/src/numeral.ts
new file mode 100644
index 0000000..036e755
--- /dev/null
+++ b/src/numeral.ts
@@ -0,0 +1,4 @@
+export interface Numeral {
+ encode: (str: string) => string;
+ decode: (str: string) => string;
+}
diff --git a/src/numerals/arab.ts b/src/numerals/arab.ts
new file mode 100644
index 0000000..b3c262e
--- /dev/null
+++ b/src/numerals/arab.ts
@@ -0,0 +1,8 @@
+const numeral = '٠١٢٣٤٥٦٧٨٩';
+const array = numeral.split('');
+const map = Object.fromEntries(array.map((char, index) => [char, '' + index]));
+
+export default {
+ encode: (str: string) => str.replace(/\d/g, char => array[+char]),
+ decode: (str: string) => str.replace(new RegExp(`[${numeral}]`, 'g'), char => map[char])
+};
diff --git a/src/numerals/arabext.ts b/src/numerals/arabext.ts
new file mode 100644
index 0000000..0dc95bc
--- /dev/null
+++ b/src/numerals/arabext.ts
@@ -0,0 +1,8 @@
+const numeral = '۰۱۲۳۴۵۶۷۸۹';
+const array = numeral.split('');
+const map = Object.fromEntries(array.map((char, index) => [char, '' + index]));
+
+export default {
+ encode: (str: string) => str.replace(/\d/g, char => array[+char]),
+ decode: (str: string) => str.replace(new RegExp(`[${numeral}]`, 'g'), char => map[char])
+};
diff --git a/src/numerals/beng.ts b/src/numerals/beng.ts
new file mode 100644
index 0000000..78159d9
--- /dev/null
+++ b/src/numerals/beng.ts
@@ -0,0 +1,8 @@
+const numeral = '০১২৩৪৫৬৭৮৯';
+const array = numeral.split('');
+const map = Object.fromEntries(array.map((char, index) => [char, '' + index]));
+
+export default {
+ encode: (str: string) => str.replace(/\d/g, char => array[+char]),
+ decode: (str: string) => str.replace(new RegExp(`[${numeral}]`, 'g'), char => map[char])
+};
diff --git a/src/numerals/latn.ts b/src/numerals/latn.ts
new file mode 100644
index 0000000..9ad6152
--- /dev/null
+++ b/src/numerals/latn.ts
@@ -0,0 +1,4 @@
+export default {
+ encode: (str: string) => str,
+ decode: (str: string) => str
+};
diff --git a/src/numerals/mymr.ts b/src/numerals/mymr.ts
new file mode 100644
index 0000000..1bdde86
--- /dev/null
+++ b/src/numerals/mymr.ts
@@ -0,0 +1,8 @@
+const numeral = '၀၁၂၃၄၅၆၇၈၉';
+const array = numeral.split('');
+const map = Object.fromEntries(array.map((char, index) => [char, '' + index]));
+
+export default {
+ encode: (str: string) => str.replace(/\d/g, char => array[+char]),
+ decode: (str: string) => str.replace(new RegExp(`[${numeral}]`, 'g'), char => map[char])
+};
diff --git a/src/parse.ts b/src/parse.ts
new file mode 100644
index 0000000..647622c
--- /dev/null
+++ b/src/parse.ts
@@ -0,0 +1,42 @@
+import { isTimeZone, isUTC, getTimezoneOffset } from './timezone.ts';
+import { validatePreparseResult } from './isValid.ts';
+import { preparse } from './preparse.ts';
+import type { CompiledObject } from './compile.ts';
+import type { ParserOptions } from './parser.ts';
+
+/**
+ * Parses a date string according to the specified format.
+ * @param dateString - The date string to parse
+ * @param arg - The format string or compiled object to match against the date string
+ * @param [options] - Optional parser options for customization
+ * @returns The parsed Date object, or an invalid date if parsing fails
+ */
+export function parse(dateString: string, arg: string | CompiledObject, options?: ParserOptions) {
+ const pr = preparse(dateString, arg, options);
+
+ if (!validatePreparseResult(pr, options)) {
+ return new Date(NaN);
+ }
+ // Normalize date components (year, month, day, hour, minute, second, millisecond)
+ pr.Y = pr.Y ? pr.Y - (options?.calendar === 'buddhist' ? 543 : 0) : 1970;
+ pr.M = (pr.M || 1) - (pr.Y < 100 ? 1900 * 12 + 1 : 1);
+ pr.D ||= 1;
+ pr.H = ((pr.H || 0) % 24) || ((pr.A || 0) * 12 + (pr.h || 0) % 12);
+ pr.m ||= 0;
+ pr.s ||= 0;
+ pr.S ||= 0;
+
+ if (isTimeZone(options?.timeZone)) {
+ // Handle timezone-specific calculation
+ const utcTime = Date.UTC(pr.Y, pr.M, pr.D, pr.H, pr.m, pr.s, pr.S);
+ const offset = getTimezoneOffset(utcTime, options.timeZone);
+
+ return new Date(utcTime - offset * 1000);
+ }
+ if (isUTC(options?.timeZone) || 'Z' in pr) {
+ // Handle UTC calculation or when 'Z' token is present
+ return new Date(Date.UTC(pr.Y, pr.M, pr.D, pr.H, pr.m + (pr.Z || 0), pr.s, pr.S));
+ }
+ // Handle local timezone calculation
+ return new Date(pr.Y, pr.M, pr.D, pr.H, pr.m, pr.s, pr.S);
+}
diff --git a/src/parser.ts b/src/parser.ts
new file mode 100644
index 0000000..86855df
--- /dev/null
+++ b/src/parser.ts
@@ -0,0 +1,240 @@
+import type { CompiledObject } from './compile.ts';
+import type { Locale } from './locale.ts';
+import type { Numeral } from './numeral.ts';
+import type { TimeZone } from './timezone.ts';
+
+type ParserToken = 'Y' | 'M' | 'D' | 'H' | 'A' | 'h' | 'm' | 's' | 'S' | 'Z';
+
+export interface ParserPluginOptions {
+ /**
+ * The hour format to use for parsing.
+ * This is used when the hour is in 12-hour format.
+ * It can be 'h11' for 11-hour format or 'h12' for 12-hour format.
+ */
+ hour12: 'h11' | 'h12';
+
+ /**
+ * The hour format to use for parsing.
+ * This is used when the hour is in 24-hour format.
+ * It can be 'h23' for 23-hour format or 'h24' for 24-hour format.
+ */
+ hour24: 'h23' | 'h24';
+
+ /**
+ * The numeral system to use for parsing numbers.
+ * This is an object that provides methods to encode and decode numbers in the specified numeral system.
+ */
+ numeral: Numeral;
+
+ /**
+ * The calendar system to use for parsing dates.
+ * This can be 'buddhist' for Buddhist calendar or 'gregory' for Gregorian calendar.
+ */
+ calendar: 'buddhist' | 'gregory';
+
+ /**
+ * Whether to ignore case when matching strings.
+ * This is useful for matching month names, day names, and meridiems in a case-insensitive manner.
+ * If true, the parser will convert both the input string and the strings in the locale to lowercase before matching.
+ */
+ ignoreCase: boolean;
+
+ /**
+ * The time zone to use for parsing dates and times.
+ * This can be a specific time zone object or 'UTC' to use Coordinated Universal Time.
+ * If not specified, it defaults to undefined, which means the local time zone will be used.
+ */
+ timeZone: TimeZone | 'UTC' | undefined;
+
+ /**
+ * The locale to use for parsing dates and times.
+ * This is an object that provides methods to get localized month names, day names, and meridiems.
+ */
+ locale: Locale;
+}
+
+export interface ParseResult {
+ value: number;
+ length: number;
+ token?: ParserToken;
+}
+
+export abstract class ParserPlugin {
+ [key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult;
+}
+
+export interface ParserOptions extends Partial {
+ plugins?: ParserPlugin[];
+}
+
+/**
+ * Executes a regular expression against a string and returns parsed result.
+ * @param re - The regular expression to execute
+ * @param str - The string to execute the regex against
+ * @param [token] - Optional parser token to associate with the result
+ * @returns ParseResult containing the numeric value, length, and token
+ */
+export const exec = (re: RegExp, str: string, token?: ParserToken) => {
+ const result = re.exec(str)?.[0] || '';
+ return { value: +result, length: result.length, token };
+};
+
+/**
+ * Finds the best matching string from an array based on length and string position.
+ * @param array - Array of strings to search through
+ * @param str - The string to match against
+ * @param [token] - Optional parser token to associate with the result
+ * @returns ParseResult with the index of the longest matching string at the start position
+ */
+export const find = (array: string[], str: string, token?: ParserToken): ParseResult => {
+ return array.reduce((result, item, value) => item.length > result.length && !str.indexOf(item)
+ ? { value, length: item.length, token }
+ : result
+ , { value: -1, length: 0, token });
+};
+
+class DefaultParser extends ParserPlugin {
+ YYYY (str: string) {
+ return exec(/^\d{4}/, str, 'Y');
+ }
+
+ Y (str: string) {
+ return exec(/^\d{1,4}/, str, 'Y');
+ }
+
+ MMMM (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getMonthList({ style: 'long', compiledObj });
+ const locale = options.locale.getLocale();
+ const result = options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale), 'M')
+ : find(array, str, 'M');
+
+ result.value++;
+ return result;
+ }
+
+ MMM (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getMonthList({ style: 'short', compiledObj });
+ const locale = options.locale.getLocale();
+ const result = options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale), 'M')
+ : find(array, str, 'M');
+
+ result.value++;
+ return result;
+ }
+
+ MM (str: string) {
+ return exec(/^\d\d/, str, 'M');
+ }
+
+ M (str: string) {
+ return exec(/^\d\d?/, str, 'M');
+ }
+
+ DD (str: string) {
+ return exec(/^\d\d/, str, 'D');
+ }
+
+ D (str: string) {
+ return exec(/^\d\d?/, str, 'D');
+ }
+
+ HH (str: string) {
+ return exec(/^\d\d/, str, 'H');
+ }
+
+ H (str: string) {
+ return exec(/^\d\d?/, str, 'H');
+ }
+
+ AA (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getMeridiemList({ style: 'long', compiledObj, case: 'uppercase' });
+ const locale = options.locale.getLocale();
+
+ return options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale), 'A')
+ : find(array, str, 'A');
+ }
+
+ A (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getMeridiemList({ style: 'short', compiledObj, case: 'uppercase' });
+ const locale = options.locale.getLocale();
+
+ return options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale), 'A')
+ : find(array, str, 'A');
+ }
+
+ aa (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getMeridiemList({ style: 'long', compiledObj, case: 'lowercase' });
+ const locale = options.locale.getLocale();
+
+ return options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale), 'A')
+ : find(array, str, 'A');
+ }
+
+ a (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getMeridiemList({ style: 'short', compiledObj, case: 'lowercase' });
+ const locale = options.locale.getLocale();
+
+ return options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale), 'A')
+ : find(array, str, 'A');
+ }
+
+ hh (str: string) {
+ return exec(/^\d\d/, str, 'h');
+ }
+
+ h (str: string) {
+ return exec(/^\d\d?/, str, 'h');
+ }
+
+ mm (str: string) {
+ return exec(/^\d\d/, str, 'm');
+ }
+
+ m (str: string) {
+ return exec(/^\d\d?/, str, 'm');
+ }
+
+ ss (str: string) {
+ return exec(/^\d\d/, str, 's');
+ }
+
+ s (str: string) {
+ return exec(/^\d\d?/, str, 's');
+ }
+
+ SSS (str: string) {
+ return exec(/^\d{1,3}/, str, 'S');
+ }
+
+ SS (str: string) {
+ const result = exec(/^\d\d?/, str, 'S');
+ result.value *= 10;
+ return result;
+ }
+
+ S (str: string) {
+ const result = exec(/^\d/, str, 'S');
+ result.value *= 100;
+ return result;
+ }
+
+ Z (str: string) {
+ const result = exec(/^[+-][01]\d[0-5]\d/, str, 'Z');
+ result.value = (result.value / 100 | 0) * -60 - result.value % 100;
+ return result;
+ }
+
+ ZZ (str: string) {
+ const results = /^([+-][01]\d):([0-5]\d)/.exec(str) || ['', '', ''];
+ const value = +(results[1] + results[2]);
+ return { value: (value / 100 | 0) * -60 - value % 100, length: results[0].length, token: 'Z' as ParserToken };
+ }
+}
+
+export const parser = new DefaultParser();
diff --git a/src/plugin.ts b/src/plugin.ts
new file mode 100644
index 0000000..0d9d8f3
--- /dev/null
+++ b/src/plugin.ts
@@ -0,0 +1,9 @@
+export { FormatterPlugin } from './formatter.ts';
+export { ParserPlugin, exec, find } from './parser.ts';
+export type { FormatterPluginOptions } from './formatter.ts';
+export type { ParserPluginOptions, ParseResult } from './parser.ts';
+export type { CompiledObject } from './compile.ts';
+export type { DateLike } from './datetime.ts';
+export type { Locale } from './locale.ts';
+export type { Numeral } from './numeral.ts';
+export type { TimeZone } from './timezone.ts';
diff --git a/src/plugin/day-of-week.js b/src/plugin/day-of-week.js
deleted file mode 100644
index 23fced5..0000000
--- a/src/plugin/day-of-week.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve day-of-week
- */
-
-var plugin = function (date) {
- var name = 'day-of-week';
-
- date.plugin(name, {
- parser: {
- dddd: function (str) { return this.find(this.res.dddd, str); },
- ddd: function (str) { return this.find(this.res.ddd, str); },
- dd: function (str) { return this.find(this.res.dd, str); }
- }
- });
- return name;
-};
-
-export default plugin;
diff --git a/src/plugin/meridiem.js b/src/plugin/meridiem.js
deleted file mode 100644
index d60d5b5..0000000
--- a/src/plugin/meridiem.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve meridiem
- */
-
-var plugin = function (date) {
- var name = 'meridiem';
-
- date.plugin(name, {
- res: {
- AA: ['A.M.', 'P.M.'],
- a: ['am', 'pm'],
- aa: ['a.m.', 'p.m.']
- },
- formatter: {
- AA: function (d) {
- return this.res.AA[d.getHours() > 11 | 0];
- },
- a: function (d) {
- return this.res.a[d.getHours() > 11 | 0];
- },
- aa: function (d) {
- return this.res.aa[d.getHours() > 11 | 0];
- }
- },
- parser: {
- AA: function (str) {
- var result = this.find(this.res.AA, str);
- result.token = 'A';
- return result;
- },
- a: function (str) {
- var result = this.find(this.res.a, str);
- result.token = 'A';
- return result;
- },
- aa: function (str) {
- var result = this.find(this.res.aa, str);
- result.token = 'A';
- return result;
- }
- }
- });
- return name;
-};
-
-export default plugin;
diff --git a/src/plugin/microsecond.js b/src/plugin/microsecond.js
deleted file mode 100644
index 4f9a74a..0000000
--- a/src/plugin/microsecond.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve microsecond
- */
-
-var plugin = function (date) {
- var name = 'microsecond';
-
- date.plugin(name, {
- parser: {
- SSSSSS: function (str) {
- var result = this.exec(/^\d{1,6}/, str);
- result.value = result.value / 1000 | 0;
- return result;
- },
- SSSSS: function (str) {
- var result = this.exec(/^\d{1,5}/, str);
- result.value = result.value / 100 | 0;
- return result;
- },
- SSSS: function (str) {
- var result = this.exec(/^\d{1,4}/, str);
- result.value = result.value / 10 | 0;
- return result;
- }
- }
- });
- return name;
-};
-
-export default plugin;
diff --git a/src/plugin/ordinal.js b/src/plugin/ordinal.js
deleted file mode 100644
index 8dcc926..0000000
--- a/src/plugin/ordinal.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve ordinal
- */
-
-var plugin = function (date) {
- var name = 'ordinal';
-
- date.plugin(name, {
- formatter: {
- DDD: function (d) {
- var day = d.getDate();
-
- switch (day) {
- case 1:
- case 21:
- case 31:
- return day + 'st';
- case 2:
- case 22:
- return day + 'nd';
- case 3:
- case 23:
- return day + 'rd';
- default:
- return day + 'th';
- }
- }
- }
- });
- return name;
-};
-
-export default plugin;
diff --git a/src/plugin/timespan.js b/src/plugin/timespan.js
deleted file mode 100644
index fcb84e4..0000000
--- a/src/plugin/timespan.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve timespan
- */
-
-var plugin = function (date) {
- var timeSpan = function (date1, date2) {
- var milliseconds = function (dt, time) {
- dt.S = time;
- return dt;
- },
- seconds = function (dt, time) {
- dt.s = time / 1000 | 0;
- return milliseconds(dt, Math.abs(time) % 1000);
- },
- minutes = function (dt, time) {
- dt.m = time / 60000 | 0;
- return seconds(dt, Math.abs(time) % 60000);
- },
- hours = function (dt, time) {
- dt.H = time / 3600000 | 0;
- return minutes(dt, Math.abs(time) % 3600000);
- },
- days = function (dt, time) {
- dt.D = time / 86400000 | 0;
- return hours(dt, Math.abs(time) % 86400000);
- },
- format = function (dt, formatString) {
- var pattern = date.compile(formatString);
- var str = '';
-
- for (var i = 1, len = pattern.length, token, value; i < len; i++) {
- token = pattern[i].charAt(0);
- if (token in dt) {
- value = '' + Math.abs(dt[token]);
- while (value.length < pattern[i].length) {
- value = '0' + value;
- }
- if (dt[token] < 0) {
- value = '-' + value;
- }
- str += value;
- } else {
- str += pattern[i].replace(/\[(.*)]/, '$1');
- }
- }
- return str;
- },
- delta = date1.getTime() - date2.getTime();
-
- return {
- toMilliseconds: function (formatString) {
- return format(milliseconds({}, delta), formatString);
- },
- toSeconds: function (formatString) {
- return format(seconds({}, delta), formatString);
- },
- toMinutes: function (formatString) {
- return format(minutes({}, delta), formatString);
- },
- toHours: function (formatString) {
- return format(hours({}, delta), formatString);
- },
- toDays: function (formatString) {
- return format(days({}, delta), formatString);
- }
- };
- };
- var name = 'timespan';
-
- date.plugin(name, { extender: { timeSpan: timeSpan } });
- return name;
-};
-
-export default plugin;
diff --git a/src/plugin/timezone.js b/src/plugin/timezone.js
deleted file mode 100644
index 68b374f..0000000
--- a/src/plugin/timezone.js
+++ /dev/null
@@ -1,724 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve timezone
- */
-
-var plugin = function (proto, date) {
- var timeZones = {
- africa: {
- abidjan: [0, -968],
- accra: [0, -968],
- addis_ababa: [10800, 9900, 9000, 8836],
- algiers: [7200, 3600, 732, 561, 0],
- asmara: [10800, 9900, 9000, 8836],
- bamako: [0, -968],
- bangui: [3600, 1800, 815, 0],
- banjul: [0, -968],
- bissau: [0, -3600, -3740],
- blantyre: [7820, 7200],
- brazzaville: [3600, 1800, 815, 0],
- bujumbura: [7820, 7200],
- cairo: [10800, 7509, 7200],
- casablanca: [3600, 0, -1820],
- ceuta: [7200, 3600, 0, -1276],
- conakry: [0, -968],
- dakar: [0, -968],
- dar_es_salaam: [10800, 9900, 9000, 8836],
- djibouti: [10800, 9900, 9000, 8836],
- douala: [3600, 1800, 815, 0],
- el_aaiun: [3600, 0, -3168, -3600],
- freetown: [0, -968],
- gaborone: [7820, 7200],
- harare: [7820, 7200],
- johannesburg: [10800, 7200, 6720, 5400],
- juba: [10800, 7588, 7200],
- kampala: [10800, 9900, 9000, 8836],
- khartoum: [10800, 7808, 7200],
- kigali: [7820, 7200],
- kinshasa: [3600, 1800, 815, 0],
- lagos: [3600, 1800, 815, 0],
- libreville: [3600, 1800, 815, 0],
- lome: [0, -968],
- luanda: [3600, 1800, 815, 0],
- lubumbashi: [7820, 7200],
- lusaka: [7820, 7200],
- malabo: [3600, 1800, 815, 0],
- maputo: [7820, 7200],
- maseru: [10800, 7200, 6720, 5400],
- mbabane: [10800, 7200, 6720, 5400],
- mogadishu: [10800, 9900, 9000, 8836],
- monrovia: [0, -2588, -2670],
- nairobi: [10800, 9900, 9000, 8836],
- ndjamena: [7200, 3612, 3600],
- niamey: [3600, 1800, 815, 0],
- nouakchott: [0, -968],
- ouagadougou: [0, -968],
- 'porto-novo': [3600, 1800, 815, 0],
- sao_tome: [3600, 1616, 0, -2205],
- tripoli: [7200, 3600, 3164],
- tunis: [7200, 3600, 2444, 561],
- windhoek: [10800, 7200, 5400, 4104, 3600]
- },
- america: {
- adak: [44002, -32400, -36000, -39600, -42398],
- anchorage: [50424, -28800, -32400, -35976, -36000],
- anguilla: [-10800, -14400, -15865],
- antigua: [-10800, -14400, -15865],
- araguaina: [-7200, -10800, -11568],
- argentina: {
- buenos_aires: [-7200, -10800, -14028, -14400, -15408],
- catamarca: [-7200, -10800, -14400, -15408, -15788],
- cordoba: [-7200, -10800, -14400, -15408],
- jujuy: [-7200, -10800, -14400, -15408, -15672],
- la_rioja: [-7200, -10800, -14400, -15408, -16044],
- mendoza: [-7200, -10800, -14400, -15408, -16516],
- rio_gallegos: [-7200, -10800, -14400, -15408, -16612],
- salta: [-7200, -10800, -14400, -15408, -15700],
- san_juan: [-7200, -10800, -14400, -15408, -16444],
- san_luis: [-7200, -10800, -14400, -15408, -15924],
- tucuman: [-7200, -10800, -14400, -15408, -15652],
- ushuaia: [-7200, -10800, -14400, -15408, -16392]
- },
- aruba: [-10800, -14400, -15865],
- asuncion: [-10800, -13840, -14400],
- atikokan: [-18000, -19088, -19176],
- bahia_banderas: [-18000, -21600, -25200, -25260, -28800],
- bahia: [-7200, -9244, -10800],
- barbados: [-10800, -12600, -14309, -14400],
- belem: [-7200, -10800, -11636],
- belize: [-18000, -19800, -21168, -21600],
- 'blanc-sablon': [-10800, -14400, -15865],
- boa_vista: [-10800, -14400, -14560],
- bogota: [-14400, -17776, -18000],
- boise: [-21600, -25200, -27889, -28800],
- cambridge_bay: [0, -18000, -21600, -25200],
- campo_grande: [-10800, -13108, -14400],
- cancun: [-14400, -18000, -20824, -21600],
- caracas: [-14400, -16060, -16064, -16200],
- cayenne: [-10800, -12560, -14400],
- cayman: [-18000, -19088, -19176],
- chicago: [-18000, -21036, -21600],
- chihuahua: [-18000, -21600, -25200, -25460],
- ciudad_juarez: [-18000, -21600, -25200, -25556],
- costa_rica: [-18000, -20173, -21600],
- creston: [-21600, -25200, -26898],
- cuiaba: [-10800, -13460, -14400],
- curacao: [-10800, -14400, -15865],
- danmarkshavn: [0, -4480, -7200, -10800],
- dawson: [-25200, -28800, -32400, -33460],
- dawson_creek: [-25200, -28800, -28856],
- denver: [-21600, -25196, -25200],
- detroit: [-14400, -18000, -19931, -21600],
- dominica: [-10800, -14400, -15865],
- edmonton: [-21600, -25200, -27232],
- eirunepe: [-14400, -16768, -18000],
- el_salvador: [-18000, -21408, -21600],
- fortaleza: [-7200, -9240, -10800],
- fort_nelson: [-25200, -28800, -29447],
- glace_bay: [-10800, -14388, -14400],
- goose_bay: [-7200, -9000, -9052, -10800, -12600, -12652, -14400, -14500],
- grand_turk: [-14400, -17072, -18000, -18430],
- grenada: [-10800, -14400, -15865],
- guadeloupe: [-10800, -14400, -15865],
- guatemala: [-18000, -21600, -21724],
- guayaquil: [-14400, -18000, -18840, -19160],
- guyana: [-10800, -13500, -13959, -14400],
- halifax: [-10800, -14400, -15264],
- havana: [-14400, -18000, -19768, -19776],
- hermosillo: [-21600, -25200, -26632, -28800],
- indiana: {
- indianapolis: [-14400, -18000, -20678, -21600],
- knox: [-18000, -20790, -21600],
- marengo: [-14400, -18000, -20723, -21600],
- petersburg: [-14400, -18000, -20947, -21600],
- tell_city: [-14400, -18000, -20823, -21600],
- vevay: [-14400, -18000, -20416, -21600],
- vincennes: [-14400, -18000, -21007, -21600],
- winamac: [-14400, -18000, -20785, -21600]
- },
- inuvik: [0, -21600, -25200, -28800],
- iqaluit: [0, -14400, -18000, -21600],
- jamaica: [-14400, -18000, -18430],
- juneau: [54139, -25200, -28800, -32261, -32400],
- kentucky: {
- louisville: [-14400, -18000, -20582, -21600],
- monticello: [-14400, -18000, -20364, -21600]
- },
- kralendijk: [-10800, -14400, -15865],
- la_paz: [-12756, -14400, -16356],
- lima: [-14400, -18000, -18492, -18516],
- los_angeles: [-25200, -28378, -28800],
- lower_princes: [-10800, -14400, -15865],
- maceio: [-7200, -8572, -10800],
- managua: [-18000, -20708, -20712, -21600],
- manaus: [-10800, -14400, -14404],
- marigot: [-10800, -14400, -15865],
- martinique: [-10800, -14400, -14660],
- matamoros: [-18000, -21600, -23400],
- mazatlan: [-21600, -25200, -25540, -28800],
- menominee: [-18000, -21027, -21600],
- merida: [-18000, -21508, -21600],
- metlakatla: [54822, -25200, -28800, -31578, -32400],
- mexico_city: [-18000, -21600, -23796, -25200],
- miquelon: [-7200, -10800, -13480, -14400],
- moncton: [-10800, -14400, -15548, -18000],
- monterrey: [-18000, -21600, -24076],
- montevideo: [-5400, -7200, -9000, -10800, -12600, -13491, -14400],
- montserrat: [-10800, -14400, -15865],
- nassau: [-14400, -18000, -19052],
- new_york: [-14400, -17762, -18000],
- nome: [46702, -28800, -32400, -36000, -39600, -39698],
- noronha: [-3600, -7200, -7780],
- north_dakota: {
- beulah: [-18000, -21600, -24427, -25200],
- center: [-18000, -21600, -24312, -25200],
- new_salem: [-18000, -21600, -24339, -25200]
- },
- nuuk: [-3600, -7200, -10800, -12416],
- ojinaga: [-18000, -21600, -25060, -25200],
- panama: [-18000, -19088, -19176],
- paramaribo: [-10800, -12600, -13236, -13240, -13252],
- phoenix: [-21600, -25200, -26898],
- 'port-au-prince': [-14400, -17340, -17360, -18000],
- port_of_spain: [-10800, -14400, -15865],
- porto_velho: [-10800, -14400, -15336],
- puerto_rico: [-10800, -14400, -15865],
- punta_arenas: [-10800, -14400, -16965, -17020, -18000],
- rankin_inlet: [0, -18000, -21600],
- recife: [-7200, -8376, -10800],
- regina: [-21600, -25116, -25200],
- resolute: [0, -18000, -21600],
- rio_branco: [-14400, -16272, -18000],
- santarem: [-10800, -13128, -14400],
- santiago: [-10800, -14400, -16965, -18000],
- santo_domingo: [-14400, -16200, -16776, -16800, -18000],
- sao_paulo: [-7200, -10800, -11188],
- scoresbysund: [0, -3600, -5272, -7200],
- sitka: [53927, -25200, -28800, -32400, -32473],
- st_barthelemy: [-10800, -14400, -15865],
- st_johns: [-5400, -9000, -9052, -12600, -12652],
- st_kitts: [-10800, -14400, -15865],
- st_lucia: [-10800, -14400, -15865],
- st_thomas: [-10800, -14400, -15865],
- st_vincent: [-10800, -14400, -15865],
- swift_current: [-21600, -25200, -25880],
- tegucigalpa: [-18000, -20932, -21600],
- thule: [-10800, -14400, -16508],
- tijuana: [-25200, -28084, -28800],
- toronto: [-14400, -18000, -19052],
- tortola: [-10800, -14400, -15865],
- vancouver: [-25200, -28800, -29548],
- whitehorse: [-25200, -28800, -32400, -32412],
- winnipeg: [-18000, -21600, -23316],
- yakutat: [52865, -28800, -32400, -33535]
- },
- antarctica: {
- casey: [39600, 28800, 0],
- davis: [25200, 18000, 0],
- dumontdurville: [36000, 35320, 35312],
- macquarie: [39600, 36000, 0],
- mawson: [21600, 18000, 0],
- mcmurdo: [46800, 45000, 43200, 41944, 41400],
- palmer: [0, -7200, -10800, -14400],
- rothera: [0, -10800],
- syowa: [11212, 10800],
- troll: [7200, 0],
- vostok: [25200, 18000, 0]
- },
- arctic: { longyearbyen: [10800, 7200, 3600, 3208] },
- asia: {
- aden: [11212, 10800],
- almaty: [25200, 21600, 18468, 18000],
- amman: [10800, 8624, 7200],
- anadyr: [50400, 46800, 43200, 42596, 39600],
- aqtau: [21600, 18000, 14400, 12064],
- aqtobe: [21600, 18000, 14400, 13720],
- ashgabat: [21600, 18000, 14400, 14012],
- atyrau: [21600, 18000, 14400, 12464, 10800],
- baghdad: [14400, 10800, 10660, 10656],
- bahrain: [14400, 12368, 10800],
- baku: [18000, 14400, 11964, 10800],
- bangkok: [25200, 24124],
- barnaul: [28800, 25200, 21600, 20100],
- beirut: [10800, 8520, 7200],
- bishkek: [25200, 21600, 18000, 17904],
- brunei: [32400, 30000, 28800, 27000, 26480],
- chita: [36000, 32400, 28800, 27232],
- choibalsan: [36000, 32400, 28800, 27480, 25200],
- colombo: [23400, 21600, 19800, 19172, 19164],
- damascus: [10800, 8712, 7200],
- dhaka: [25200, 23400, 21700, 21600, 21200, 19800],
- dili: [32400, 30140, 28800],
- dubai: [14400, 13272],
- dushanbe: [25200, 21600, 18000, 16512],
- famagusta: [10800, 8148, 7200],
- gaza: [10800, 8272, 7200],
- hebron: [10800, 8423, 7200],
- ho_chi_minh: [32400, 28800, 25590, 25200],
- hong_kong: [32400, 30600, 28800, 27402],
- hovd: [28800, 25200, 21996, 21600],
- irkutsk: [32400, 28800, 25200, 25025],
- jakarta: [32400, 28800, 27000, 26400, 25632, 25200],
- jayapura: [34200, 33768, 32400],
- jerusalem: [14400, 10800, 8454, 8440, 7200],
- kabul: [16608, 16200, 14400],
- kamchatka: [46800, 43200, 39600, 38076],
- karachi: [23400, 21600, 19800, 18000, 16092],
- kathmandu: [20700, 20476, 19800],
- khandyga: [39600, 36000, 32533, 32400, 28800],
- kolkata: [23400, 21208, 21200, 19800, 19270],
- krasnoyarsk: [28800, 25200, 22286, 21600],
- kuala_lumpur: [32400, 28800, 27000, 26400, 25200, 24925],
- kuching: [32400, 30000, 28800, 27000, 26480],
- kuwait: [11212, 10800],
- macau: [36000, 32400, 28800, 27250],
- magadan: [43200, 39600, 36192, 36000],
- makassar: [32400, 28800, 28656],
- manila: [32400, 29040, 28800, -57360],
- muscat: [14400, 13272],
- nicosia: [10800, 8008, 7200],
- novokuznetsk: [28800, 25200, 21600, 20928],
- novosibirsk: [28800, 25200, 21600, 19900],
- omsk: [25200, 21600, 18000, 17610],
- oral: [21600, 18000, 14400, 12324, 10800],
- phnom_penh: [25200, 24124],
- pontianak: [32400, 28800, 27000, 26240, 25200],
- pyongyang: [32400, 30600, 30180],
- qatar: [14400, 12368, 10800],
- qostanay: [21600, 18000, 15268, 14400],
- qyzylorda: [21600, 18000, 15712, 14400],
- riyadh: [11212, 10800],
- sakhalin: [43200, 39600, 36000, 34248, 32400],
- samarkand: [21600, 18000, 16073, 14400],
- seoul: [36000, 34200, 32400, 30600, 30472],
- shanghai: [32400, 29143, 28800],
- singapore: [32400, 28800, 27000, 26400, 25200, 24925],
- srednekolymsk: [43200, 39600, 36892, 36000],
- taipei: [32400, 29160, 28800],
- tashkent: [25200, 21600, 18000, 16631],
- tbilisi: [18000, 14400, 10800, 10751],
- tehran: [18000, 16200, 14400, 12600, 12344],
- thimphu: [21600, 21516, 19800],
- tokyo: [36000, 33539, 32400],
- tomsk: [28800, 25200, 21600, 20391],
- ulaanbaatar: [32400, 28800, 25652, 25200],
- urumqi: [21600, 21020],
- 'ust-nera': [43200, 39600, 36000, 34374, 32400, 28800],
- vientiane: [25200, 24124],
- vladivostok: [39600, 36000, 32400, 31651],
- yakutsk: [36000, 32400, 31138, 28800],
- yangon: [32400, 23400, 23087],
- yekaterinburg: [21600, 18000, 14553, 14400, 13505],
- yerevan: [18000, 14400, 10800, 10680]
- },
- atlantic: {
- azores: [0, -3600, -6160, -6872, -7200],
- bermuda: [-10800, -11958, -14400, -15558],
- canary: [3600, 0, -3600, -3696],
- cape_verde: [-3600, -5644, -7200],
- faroe: [3600, 0, -1624],
- madeira: [3600, 0, -3600, -4056],
- reykjavik: [0, -968],
- south_georgia: [-7200, -8768],
- stanley: [-7200, -10800, -13884, -14400],
- st_helena: [0, -968]
- },
- australia: {
- adelaide: [37800, 34200, 33260, 32400],
- brisbane: [39600, 36728, 36000],
- broken_hill: [37800, 36000, 34200, 33948, 32400],
- darwin: [37800, 34200, 32400, 31400],
- eucla: [35100, 31500, 30928],
- hobart: [39600, 36000, 35356],
- lindeman: [39600, 36000, 35756],
- lord_howe: [41400, 39600, 38180, 37800, 36000],
- melbourne: [39600, 36000, 34792],
- perth: [32400, 28800, 27804],
- sydney: [39600, 36292, 36000]
- },
- europe: {
- amsterdam: [7200, 3600, 1050, 0],
- andorra: [7200, 3600, 364, 0],
- astrakhan: [18000, 14400, 11532, 10800],
- athens: [10800, 7200, 5692, 3600],
- belgrade: [7200, 4920, 3600],
- berlin: [10800, 7200, 3600, 3208],
- bratislava: [7200, 3600, 3464, 0],
- brussels: [7200, 3600, 1050, 0],
- bucharest: [10800, 7200, 6264],
- budapest: [7200, 4580, 3600],
- busingen: [7200, 3600, 2048, 1786],
- chisinau: [14400, 10800, 7200, 6920, 6900, 6264, 3600],
- copenhagen: [10800, 7200, 3600, 3208],
- dublin: [3600, 2079, 0, -1521],
- gibraltar: [7200, 3600, 0, -1284],
- guernsey: [7200, 3600, 0, -75],
- helsinki: [10800, 7200, 5989],
- isle_of_man: [7200, 3600, 0, -75],
- istanbul: [14400, 10800, 7200, 7016, 6952],
- jersey: [7200, 3600, 0, -75],
- kaliningrad: [14400, 10800, 7200, 4920, 3600],
- kirov: [18000, 14400, 11928, 10800],
- kyiv: [14400, 10800, 7324, 7200, 3600],
- lisbon: [7200, 3600, 0, -2205],
- ljubljana: [7200, 4920, 3600],
- london: [7200, 3600, 0, -75],
- luxembourg: [7200, 3600, 1050, 0],
- madrid: [7200, 3600, 0, -884],
- malta: [7200, 3600, 3484],
- mariehamn: [10800, 7200, 5989],
- minsk: [14400, 10800, 7200, 6616, 6600, 3600],
- monaco: [7200, 3600, 561, 0],
- moscow: [18000, 16279, 14400, 12679, 10800, 9079, 9017, 7200],
- oslo: [10800, 7200, 3600, 3208],
- paris: [7200, 3600, 561, 0],
- podgorica: [7200, 4920, 3600],
- prague: [7200, 3600, 3464, 0],
- riga: [14400, 10800, 9394, 7200, 5794, 3600],
- rome: [7200, 3600, 2996],
- samara: [18000, 14400, 12020, 10800],
- san_marino: [7200, 3600, 2996],
- sarajevo: [7200, 4920, 3600],
- saratov: [18000, 14400, 11058, 10800],
- simferopol: [14400, 10800, 8184, 8160, 7200, 3600],
- skopje: [7200, 4920, 3600],
- sofia: [10800, 7200, 7016, 5596, 3600],
- stockholm: [10800, 7200, 3600, 3208],
- tallinn: [14400, 10800, 7200, 5940, 3600],
- tirane: [7200, 4760, 3600],
- ulyanovsk: [18000, 14400, 11616, 10800, 7200],
- vaduz: [7200, 3600, 2048, 1786],
- vatican: [7200, 3600, 2996],
- vienna: [7200, 3921, 3600],
- vilnius: [14400, 10800, 7200, 6076, 5736, 5040, 3600],
- volgograd: [18000, 14400, 10800, 10660],
- warsaw: [10800, 7200, 5040, 3600],
- zagreb: [7200, 4920, 3600],
- zurich: [7200, 3600, 2048, 1786]
- },
- indian: {
- antananarivo: [10800, 9900, 9000, 8836],
- chagos: [21600, 18000, 17380],
- christmas: [25200, 24124],
- cocos: [32400, 23400, 23087],
- comoro: [10800, 9900, 9000, 8836],
- kerguelen: [18000, 17640],
- mahe: [14400, 13272],
- maldives: [18000, 17640],
- mauritius: [18000, 14400, 13800],
- mayotte: [10800, 9900, 9000, 8836],
- reunion: [14400, 13272]
- },
- pacific: {
- apia: [50400, 46800, 45184, -36000, -39600, -41216, -41400],
- auckland: [46800, 45000, 43200, 41944, 41400],
- bougainville: [39600, 37336, 36000, 35312, 32400],
- chatham: [49500, 45900, 44100, 44028],
- chuuk: [36000, 35320, 35312],
- easter: [-18000, -21600, -25200, -26248],
- efate: [43200, 40396, 39600],
- fakaofo: [46800, -39600, -41096],
- fiji: [46800, 43200, 42944],
- funafuti: [43200, 41524],
- galapagos: [-18000, -21504, -21600],
- gambier: [-32388, -32400],
- guadalcanal: [39600, 38388],
- guam: [39600, 36000, 34740, 32400, -51660],
- honolulu: [-34200, -36000, -37800, -37886],
- kanton: [46800, 0, -39600, -43200],
- kiritimati: [50400, -36000, -37760, -38400],
- kosrae: [43200, 39600, 39116, 36000, 32400, -47284],
- kwajalein: [43200, 40160, 39600, 36000, 32400, -43200],
- majuro: [43200, 41524],
- marquesas: [-33480, -34200],
- midway: [45432, -39600, -40968],
- nauru: [43200, 41400, 40060, 32400],
- niue: [-39600, -40780, -40800],
- norfolk: [45000, 43200, 41400, 40320, 40312, 39600],
- noumea: [43200, 39948, 39600],
- pago_pago: [45432, -39600, -40968],
- palau: [32400, 32276, -54124],
- pitcairn: [-28800, -30600, -31220],
- pohnpei: [39600, 38388],
- port_moresby: [36000, 35320, 35312],
- rarotonga: [48056, -34200, -36000, -37800, -38344],
- saipan: [39600, 36000, 34740, 32400, -51660],
- tahiti: [-35896, -36000],
- tarawa: [43200, 41524],
- tongatapu: [50400, 46800, 44400, 44352],
- wake: [43200, 41524],
- wallis: [43200, 41524]
- }
- };
- var timeZoneNames = {
- 'Acre Standard Time': 'ACT', 'Acre Summer Time': 'ACST', 'Afghanistan Time': 'AFT',
- 'Alaska Daylight Time': 'AKDT', 'Alaska Standard Time': 'AKST', 'Almaty Standard Time': 'ALMT',
- 'Almaty Summer Time': 'ALMST', 'Amazon Standard Time': 'AMT', 'Amazon Summer Time': 'AMST',
- 'Anadyr Standard Time': 'ANAT', 'Anadyr Summer Time': 'ANAST', 'Apia Daylight Time': 'WSDT',
- 'Apia Standard Time': 'WSST', 'Aqtau Standard Time': 'AQTT', 'Aqtau Summer Time': 'AQTST',
- 'Aqtobe Standard Time': 'AQTT', 'Aqtobe Summer Time': 'AQST', 'Arabian Daylight Time': 'ADT',
- 'Arabian Standard Time': 'AST', 'Argentina Standard Time': 'ART', 'Argentina Summer Time': 'ARST',
- 'Armenia Standard Time': 'AMT', 'Armenia Summer Time': 'AMST', 'Atlantic Daylight Time': 'ADT',
- 'Atlantic Standard Time': 'AST', 'Australian Central Daylight Time': 'ACDT', 'Australian Central Standard Time': 'ACST',
- 'Australian Central Western Daylight Time': 'ACWDT', 'Australian Central Western Standard Time': 'ACWST', 'Australian Eastern Daylight Time': 'AEDT',
- 'Australian Eastern Standard Time': 'AEST', 'Australian Western Daylight Time': 'AWDT', 'Australian Western Standard Time': 'AWST',
- 'Azerbaijan Standard Time': 'AZT', 'Azerbaijan Summer Time': 'AZST', 'Azores Standard Time': 'AZOT',
- 'Azores Summer Time': 'AZOST', 'Bangladesh Standard Time': 'BST', 'Bangladesh Summer Time': 'BDST',
- 'Bhutan Time': 'BTT', 'Bolivia Time': 'BOT', 'Brasilia Standard Time': 'BRT',
- 'Brasilia Summer Time': 'BRST', 'British Summer Time': 'BST', 'Brunei Darussalam Time': 'BNT',
- 'Cape Verde Standard Time': 'CVT', 'Casey Time': 'CAST', 'Central Africa Time': 'CAT',
- 'Central Daylight Time': 'CDT', 'Central European Standard Time': 'CET', 'Central European Summer Time': 'CEST',
- 'Central Indonesia Time': 'WITA', 'Central Standard Time': 'CST', 'Chamorro Standard Time': 'ChST',
- 'Chatham Daylight Time': 'CHADT', 'Chatham Standard Time': 'CHAST', 'Chile Standard Time': 'CLT',
- 'Chile Summer Time': 'CLST', 'China Daylight Time': 'CDT', 'China Standard Time': 'CST',
- 'Christmas Island Time': 'CXT', 'Chuuk Time': 'CHUT', 'Cocos Islands Time': 'CCT',
- 'Colombia Standard Time': 'COT', 'Colombia Summer Time': 'COST', 'Cook Islands Half Summer Time': 'CKHST',
- 'Cook Islands Standard Time': 'CKT', 'Coordinated Universal Time': 'UTC', 'Cuba Daylight Time': 'CDT',
- 'Cuba Standard Time': 'CST', 'Davis Time': 'DAVT', 'Dumont-d’Urville Time': 'DDUT',
- 'East Africa Time': 'EAT', 'East Greenland Standard Time': 'EGT', 'East Greenland Summer Time': 'EGST',
- 'East Kazakhstan Time': 'ALMT', 'East Timor Time': 'TLT', 'Easter Island Standard Time': 'EAST',
- 'Easter Island Summer Time': 'EASST', 'Eastern Daylight Time': 'EDT', 'Eastern European Standard Time': 'EET',
- 'Eastern European Summer Time': 'EEST', 'Eastern Indonesia Time': 'WIT', 'Eastern Standard Time': 'EST',
- 'Ecuador Time': 'ECT', 'Falkland Islands Standard Time': 'FKST', 'Falkland Islands Summer Time': 'FKDT',
- 'Fernando de Noronha Standard Time': 'FNT', 'Fernando de Noronha Summer Time': 'FNST', 'Fiji Standard Time': 'FJT',
- 'Fiji Summer Time': 'FJST', 'French Guiana Time': 'GFT', 'French Southern & Antarctic Time': 'TFT',
- 'Further-eastern European Time': 'FET', 'Galapagos Time': 'GALT', 'Gambier Time': 'GAMT',
- 'Georgia Standard Time': 'GET', 'Georgia Summer Time': 'GEST', 'Gilbert Islands Time': 'GILT',
- 'Greenwich Mean Time': 'GMT', 'Guam Standard Time': 'ChST', 'Gulf Standard Time': 'GST',
- 'Guyana Time': 'GYT', 'Hawaii-Aleutian Daylight Time': 'HADT', 'Hawaii-Aleutian Standard Time': 'HAST',
- 'Hong Kong Standard Time': 'HKT', 'Hong Kong Summer Time': 'HKST', 'Hovd Standard Time': 'HOVT',
- 'Hovd Summer Time': 'HOVST', 'India Standard Time': 'IST', 'Indian Ocean Time': 'IOT',
- 'Indochina Time': 'ICT', 'Iran Daylight Time': 'IRDT', 'Iran Standard Time': 'IRST',
- 'Irish Standard Time': 'IST', 'Irkutsk Standard Time': 'IRKT', 'Irkutsk Summer Time': 'IRKST',
- 'Israel Daylight Time': 'IDT', 'Israel Standard Time': 'IST', 'Japan Standard Time': 'JST',
- 'Korean Daylight Time': 'KDT', 'Korean Standard Time': 'KST', 'Kosrae Time': 'KOST',
- 'Krasnoyarsk Standard Time': 'KRAT', 'Krasnoyarsk Summer Time': 'KRAST', 'Kyrgyzstan Time': 'KGT',
- 'Lanka Time': 'LKT', 'Line Islands Time': 'LINT', 'Lord Howe Daylight Time': 'LHDT',
- 'Lord Howe Standard Time': 'LHST', 'Macao Standard Time': 'CST', 'Macao Summer Time': 'CDT',
- 'Magadan Standard Time': 'MAGT', 'Magadan Summer Time': 'MAGST', 'Malaysia Time': 'MYT',
- 'Maldives Time': 'MVT', 'Marquesas Time': 'MART', 'Marshall Islands Time': 'MHT',
- 'Mauritius Standard Time': 'MUT', 'Mauritius Summer Time': 'MUST', 'Mawson Time': 'MAWT',
- 'Mexican Pacific Daylight Time': 'PDT', 'Mexican Pacific Standard Time': 'PST', 'Moscow Standard Time': 'MSK',
- 'Moscow Summer Time': 'MSD', 'Mountain Daylight Time': 'MDT', 'Mountain Standard Time': 'MST',
- 'Myanmar Time': 'MMT', 'Nauru Time': 'NRT', 'Nepal Time': 'NPT',
- 'New Caledonia Standard Time': 'NCT', 'New Caledonia Summer Time': 'NCST', 'New Zealand Daylight Time': 'NZDT',
- 'New Zealand Standard Time': 'NZST', 'Newfoundland Daylight Time': 'NDT', 'Newfoundland Standard Time': 'NST',
- 'Niue Time': 'NUT', 'Norfolk Island Daylight Time': 'NFDT', 'Norfolk Island Standard Time': 'NFT',
- 'North Mariana Islands Time': 'ChST', 'Novosibirsk Standard Time': 'NOVT', 'Novosibirsk Summer Time': 'NOVST',
- 'Omsk Standard Time': 'OMST', 'Omsk Summer Time': 'OMSST', 'Pacific Daylight Time': 'PDT',
- 'Pacific Standard Time': 'PST', 'Pakistan Standard Time': 'PKT', 'Pakistan Summer Time': 'PKST',
- 'Palau Time': 'PWT', 'Papua New Guinea Time': 'PGT', 'Paraguay Standard Time': 'PYT',
- 'Paraguay Summer Time': 'PYST', 'Peru Standard Time': 'PET', 'Peru Summer Time': 'PEST',
- 'Petropavlovsk-Kamchatski Standard Time': 'PETT', 'Petropavlovsk-Kamchatski Summer Time': 'PETST', 'Philippine Standard Time': 'PST',
- 'Philippine Summer Time': 'PHST', 'Phoenix Islands Time': 'PHOT', 'Pitcairn Time': 'PIT',
- 'Ponape Time': 'PONT', 'Pyongyang Time': 'KST', 'Qyzylorda Standard Time': 'QYZT',
- 'Qyzylorda Summer Time': 'QYZST', 'Rothera Time': 'ROOTT', 'Réunion Time': 'RET',
- 'Sakhalin Standard Time': 'SAKT', 'Sakhalin Summer Time': 'SAKST', 'Samara Standard Time': 'SAMT',
- 'Samara Summer Time': 'SAMST', 'Samoa Standard Time': 'SST', 'Seychelles Time': 'SCT',
- 'Singapore Standard Time': 'SGT', 'Solomon Islands Time': 'SBT', 'South Africa Standard Time': 'SAST',
- 'South Georgia Time': 'GST', 'St. Pierre & Miquelon Daylight Time': 'PMDT', 'St. Pierre & Miquelon Standard Time': 'PMST',
- 'Suriname Time': 'SRT', 'Syowa Time': 'SYOT', 'Tahiti Time': 'TAHT',
- 'Taipei Daylight Time': 'CDT', 'Taipei Standard Time': 'CST', 'Tajikistan Time': 'TJT',
- 'Tokelau Time': 'TKT', 'Tonga Standard Time': 'TOT', 'Tonga Summer Time': 'TOST',
- 'Turkmenistan Standard Time': 'TMT', 'Tuvalu Time': 'TVT', 'Ulaanbaatar Standard Time': 'ULAT',
- 'Ulaanbaatar Summer Time': 'ULAST', 'Uruguay Standard Time': 'UYT', 'Uruguay Summer Time': 'UYST',
- 'Uzbekistan Standard Time': 'UZT', 'Uzbekistan Summer Time': 'UZST', 'Vanuatu Standard Time': 'VUT',
- 'Vanuatu Summer Time': 'VUST', 'Venezuela Time': 'VET', 'Vladivostok Standard Time': 'VLAT',
- 'Vladivostok Summer Time': 'VLAST', 'Volgograd Standard Time': 'VOLT', 'Volgograd Summer Time': 'VOLST',
- 'Vostok Time': 'VOST', 'Wake Island Time': 'WAKT', 'Wallis & Futuna Time': 'WFT',
- 'West Africa Standard Time': 'WAT', 'West Africa Summer Time': 'WAST', 'West Greenland Standard Time': 'WGST',
- 'West Greenland Summer Time': 'WGST', 'West Kazakhstan Time': 'AQTT', 'Western Argentina Standard Time': 'ART',
- 'Western Argentina Summer Time': 'ARST', 'Western European Standard Time': 'WET', 'Western European Summer Time': 'WEST',
- 'Western Indonesia Time': 'WIB', 'Yakutsk Standard Time': 'YAKT', 'Yakutsk Summer Time': 'YAKST',
- 'Yekaterinburg Standard Time': 'YEKT', 'Yekaterinburg Summer Time': 'YEKST', 'Yukon Time': 'YT'
- };
- var options = {
- hour12: false, weekday: 'short', year: 'numeric', month: 'numeric', day: 'numeric',
- hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3,
- timeZone: 'UTC'
- };
- var cache = {
- utc: new Intl.DateTimeFormat('en-US', options)
- };
- var getDateTimeFormat = function (timeZone) {
- if (timeZone) {
- var tz = timeZone.toLowerCase();
-
- if (!cache[tz]) {
- options.timeZone = timeZone;
- cache[tz] = new Intl.DateTimeFormat('en-US', options);
- }
- return cache[tz];
- }
- options.timeZone = undefined;
- return new Intl.DateTimeFormat('en-US', options);
- };
- var formatToParts = function (dateTimeFormat, dateObjOrTime) {
- var array = dateTimeFormat.formatToParts(dateObjOrTime),
- values = {};
-
- for (var i = 0, len = array.length; i < len; i++) {
- var type = array[i].type,
- value = array[i].value;
-
- switch (type) {
- case 'weekday':
- values[type] = 'SunMonTueWedThuFriSat'.indexOf(value) / 3;
- break;
- case 'hour':
- values[type] = value % 24;
- break;
- case 'year':
- case 'month':
- case 'day':
- case 'minute':
- case 'second':
- case 'fractionalSecond':
- values[type] = value | 0;
- }
- }
- return values;
- };
- var getTimeFromParts = function (parts) {
- return Date.UTC(
- parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day,
- parts.hour, parts.minute, parts.second, parts.fractionalSecond
- );
- };
- var formatTZ = function (dateObj, arg, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- return date.format({
- getFullYear: function () { return parts.year; },
- getMonth: function () { return parts.month - 1; },
- getDate: function () { return parts.day; },
- getHours: function () { return parts.hour; },
- getMinutes: function () { return parts.minute; },
- getSeconds: function () { return parts.second; },
- getMilliseconds: function () { return parts.fractionalSecond; },
- getDay: function () { return parts.weekday; },
- getTime: function () { return dateObj.getTime(); },
- getTimezoneOffset: function () {
- return (dateObj.getTime() - getTimeFromParts(parts)) / 60000 | 0;
- },
- getTimezoneName: function () { return timeZone || undefined; }
- }, arg);
- };
- var parseTZ = function (arg1, arg2, timeZone) {
- var pattern = typeof arg2 === 'string' ? date.compile(arg2) : arg2;
- var time = typeof arg1 === 'string' ? date.parse(arg1, pattern, !!timeZone).getTime() : arg1;
- var hasZ = function (array) {
- for (var i = 1, len = array.length; i < len; i++) {
- if (!array[i].indexOf('Z')) {
- return true;
- }
- }
- return false;
- };
-
- if (!timeZone || hasZ(pattern) || timeZone.toUpperCase() === 'UTC' || isNaN(time)) {
- return new Date(time);
- }
-
- var getOffset = function (timeZoneName) {
- var keys = (timeZoneName || '').toLowerCase().split('/');
- var value = timeZones[keys[0]] || {};
-
- for (var i = 1, len = keys.length; i < len; i++) {
- value = value[keys[i]] || {};
- }
- return Array.isArray(value) ? value : [];
- };
-
- var utc = getDateTimeFormat('UTC');
- var tz = getDateTimeFormat(timeZone);
- var offset = getOffset(timeZone);
-
- for (var i = 0; i < 2; i++) {
- var targetString = utc.format(time - i * 24 * 60 * 60 * 1000);
-
- for (var j = 0, len = offset.length; j < len; j++) {
- if (tz.format(time - (offset[j] + i * 24 * 60 * 60) * 1000) === targetString) {
- return new Date(time - offset[j] * 1000);
- }
- }
- }
- return new Date(NaN);
- };
- var transformTZ = function (dateString, arg1, arg2, timeZone) {
- return formatTZ(date.parse(dateString, arg1), arg2, timeZone);
- };
- var normalizeDateParts = function (parts, adjustEOM) {
- var d = new Date(Date.UTC(
- parts.year, parts.month - (parts.year < 100 ? 1900 * 12 + 1 : 1), parts.day
- ));
-
- if (adjustEOM && d.getUTCDate() < parts.day) {
- d.setUTCDate(0);
- }
- parts.year = d.getUTCFullYear();
- parts.month = d.getUTCMonth() + 1;
- parts.day = d.getUTCDate();
-
- return parts;
- };
- var addYearsTZ = function (dateObj, years, timeZone) {
- return addMonthsTZ(dateObj, years * 12, timeZone);
- };
- var addMonthsTZ = function (dateObj, months, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- parts.month += months;
- var dateObj2 = parseTZ(getTimeFromParts(normalizeDateParts(parts, true)), [], timeZone);
-
- return isNaN(dateObj2.getTime()) ? date.addMonths(dateObj, months, true) : dateObj2;
- };
- var addDaysTZ = function (dateObj, days, timeZone) {
- var parts = formatToParts(getDateTimeFormat(timeZone), dateObj);
-
- parts.day += days;
- var dateObj2 = parseTZ(getTimeFromParts(normalizeDateParts(parts, false)), [], timeZone);
-
- return isNaN(dateObj2.getTime()) ? date.addDays(dateObj, days, true) : dateObj2;
- };
-
- var name = 'timezone';
-
- var getName = function (d) {
- var parts = new Intl.DateTimeFormat('en-US', {
- timeZone: typeof d.getTimezoneName === 'function' ? d.getTimezoneName() : undefined,
- timeZoneName: 'long'
- }).formatToParts(d.getTime());
-
- for (var i = 0, len = parts.length; i < len; i++) {
- if (parts[i].type === 'timeZoneName') {
- return parts[i].value;
- }
- }
- return '';
- };
-
- proto.plugin(name, {
- formatter: {
- z: function (d) {
- var name = getName(d);
- return timeZoneNames[name] || '';
- },
- zz: function (d) {
- var name = getName(d);
- return /^GMT[+-].+$/.test(name) ? '' : name;
- }
- },
- extender: {
- formatTZ: formatTZ,
- parseTZ: parseTZ,
- transformTZ: transformTZ,
- addYearsTZ: addYearsTZ,
- addMonthsTZ: addMonthsTZ,
- addDaysTZ: addDaysTZ
- }
- });
- return name;
-};
-
-export default plugin;
diff --git a/src/plugin/two-digit-year.js b/src/plugin/two-digit-year.js
deleted file mode 100644
index 8c196b6..0000000
--- a/src/plugin/two-digit-year.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * @preserve date-and-time.js plugin
- * @preserve two-digit-year
- */
-
-var plugin = function (date) {
- var name = 'two-digit-year';
-
- date.plugin(name, {
- parser: {
- YY: function (str) {
- var result = this.exec(/^\d\d/, str);
- result.value += result.value < 70 ? 2000 : 1900;
- return result;
- }
- }
- });
- return name;
-};
-
-export default plugin;
diff --git a/src/plugins/day-of-week.ts b/src/plugins/day-of-week.ts
new file mode 100644
index 0000000..9ec7ecb
--- /dev/null
+++ b/src/plugins/day-of-week.ts
@@ -0,0 +1,32 @@
+import { ParserPlugin, ParserPluginOptions, CompiledObject, find } from '../plugin.ts';
+
+class Parser extends ParserPlugin {
+ dddd (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getDayOfWeekList({ style: 'long', compiledObj });
+ const locale = options.locale.getLocale();
+
+ return options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale))
+ : find(array, str);
+ }
+
+ ddd (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getDayOfWeekList({ style: 'short', compiledObj });
+ const locale = options.locale.getLocale();
+
+ return options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale))
+ : find(array, str);
+ }
+
+ dd (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) {
+ const array = options.locale.getDayOfWeekList({ style: 'narrow', compiledObj });
+ const locale = options.locale.getLocale();
+
+ return options.ignoreCase
+ ? find(array.map(s => s.toLocaleLowerCase(locale)), str.toLocaleLowerCase(locale))
+ : find(array, str);
+ }
+}
+
+export const parser = new Parser();
diff --git a/src/plugins/microsecond.ts b/src/plugins/microsecond.ts
new file mode 100644
index 0000000..6e94d87
--- /dev/null
+++ b/src/plugins/microsecond.ts
@@ -0,0 +1,38 @@
+import { ParserPlugin, exec } from '../plugin.ts';
+
+class Parser extends ParserPlugin {
+ SSSS (str: string) {
+ const result = exec(/^\d{1,4}/, str, 'S');
+
+ result.value = Math.trunc(result.value / 10);
+ return result;
+ }
+
+ SSSSS (str: string) {
+ const result = exec(/^\d{1,5}/, str, 'S');
+
+ result.value = Math.trunc(result.value / 100);
+ return result;
+ }
+
+ SSSSSS (str: string) {
+ const result = exec(/^\d{1,6}/, str, 'S');
+
+ result.value = Math.trunc(result.value / 1000);
+ return result;
+ }
+
+ f (str: string) {
+ return exec(/^\d/, str);
+ }
+
+ ff (str: string) {
+ return exec(/^\d\d?/, str);
+ }
+
+ fff (str: string) {
+ return exec(/^\d{1,3}/, str);
+ }
+}
+
+export const parser = new Parser();
diff --git a/src/plugins/nanosecond.ts b/src/plugins/nanosecond.ts
new file mode 100644
index 0000000..450d211
--- /dev/null
+++ b/src/plugins/nanosecond.ts
@@ -0,0 +1,38 @@
+import { ParserPlugin, exec } from '../plugin.ts';
+
+class Parser extends ParserPlugin {
+ SSSSSSS (str: string) {
+ const result = exec(/^\d{1,7}/, str, 'S');
+
+ result.value = Math.trunc(result.value / 10000);
+ return result;
+ }
+
+ SSSSSSSS (str: string) {
+ const result = exec(/^\d{1,8}/, str, 'S');
+
+ result.value = Math.trunc(result.value / 100000);
+ return result;
+ }
+
+ SSSSSSSSS (str: string) {
+ const result = exec(/^\d{1,9}/, str, 'S');
+
+ result.value = Math.trunc(result.value / 1000000);
+ return result;
+ }
+
+ F (str: string) {
+ return exec(/^\d/, str);
+ }
+
+ FF (str: string) {
+ return exec(/^\d\d?/, str);
+ }
+
+ FFF (str: string) {
+ return exec(/^\d{1,3}/, str);
+ }
+}
+
+export const parser = new Parser();
diff --git a/src/plugins/ordinal.ts b/src/plugins/ordinal.ts
new file mode 100644
index 0000000..e012aff
--- /dev/null
+++ b/src/plugins/ordinal.ts
@@ -0,0 +1,38 @@
+import { FormatterPlugin, ParserPlugin, ParserPluginOptions, exec } from '../plugin.ts';
+import type { DateLike } from '../plugin.ts';
+
+class Formatter extends FormatterPlugin {
+ DDD (d: DateLike) {
+ const day = d.getDate();
+
+ switch (day) {
+ case 1:
+ case 21:
+ case 31:
+ return `${day}st`;
+ case 2:
+ case 22:
+ return `${day}nd`;
+ case 3:
+ case 23:
+ return `${day}rd`;
+ default:
+ return `${day}th`;
+ }
+ }
+}
+
+class Parser extends ParserPlugin {
+ DDD (str: string, options: ParserPluginOptions) {
+ const result = exec(/^\d\d?(?=st|nd|rd|th)/, options.ignoreCase ? str.toLowerCase() : str, 'D');
+
+ if (result.length > 0) {
+ result.length += 2;
+ }
+ return result;
+ }
+}
+
+export const formatter = new Formatter();
+
+export const parser = new Parser();
diff --git a/src/plugins/two-digit-year.ts b/src/plugins/two-digit-year.ts
new file mode 100644
index 0000000..0fdc45e
--- /dev/null
+++ b/src/plugins/two-digit-year.ts
@@ -0,0 +1,19 @@
+import { ParserPlugin, exec } from '../plugin.ts';
+import type { ParserPluginOptions } from '../plugin.ts';
+
+class Parser extends ParserPlugin {
+ YY (str: string, options: ParserPluginOptions) {
+ const result = exec(/^\d\d/, str, 'Y');
+
+ switch (options.calendar) {
+ case 'buddhist':
+ result.value += result.value < 13 ? 2600 : 2500;
+ break;
+ default:
+ result.value += result.value < 70 ? 2000 : 1900;
+ }
+ return result;
+ }
+}
+
+export const parser = new Parser();
diff --git a/src/plugins/zonename.ts b/src/plugins/zonename.ts
new file mode 100644
index 0000000..9411d8a
--- /dev/null
+++ b/src/plugins/zonename.ts
@@ -0,0 +1,29 @@
+import timeZoneNames from '../zonenames.ts';
+import { FormatterPlugin } from '../plugin.ts';
+import type { FormatterPluginOptions, DateLike } from '../plugin.ts';
+
+const getLongTimezoneName = (time: number, zoneName?: string) => {
+ const parts = new Intl.DateTimeFormat('en-US', {
+ timeZone: zoneName || undefined, timeZoneName: 'long'
+ }).formatToParts(time);
+
+ return parts.find(part => part.type === 'timeZoneName')?.value.replace(/^GMT[+-].+$/, '') || '';
+};
+
+const getShortTimezoneName = (time: number, zoneName?: string) => {
+ return timeZoneNames[getLongTimezoneName(time, zoneName) as keyof typeof timeZoneNames] || '';
+};
+
+class Formatter extends FormatterPlugin {
+ z (d: DateLike, options: FormatterPluginOptions) {
+ const zoneName = options.timeZone === 'UTC' ? 'UTC' : options.timeZone?.zone_name;
+ return getShortTimezoneName(d.getTime(), zoneName);
+ }
+
+ zz (d: DateLike, options: FormatterPluginOptions) {
+ const zoneName = options.timeZone === 'UTC' ? 'UTC' : options.timeZone?.zone_name;
+ return getLongTimezoneName(d.getTime(), zoneName);
+ }
+}
+
+export const formatter = new Formatter();
diff --git a/src/preparse.ts b/src/preparse.ts
new file mode 100644
index 0000000..9dc235f
--- /dev/null
+++ b/src/preparse.ts
@@ -0,0 +1,142 @@
+import { compile } from './compile.ts';
+import { isTimeZone, isUTC } from './timezone.ts';
+import { parser as defaultParser } from './parser.ts';
+import en from './locales/en.ts';
+import latn from './numerals/latn.ts';
+import type { CompiledObject } from './compile.ts';
+import type { ParserOptions } from './parser.ts';
+
+export interface PreparseResult {
+ /**
+ * Year component
+ */
+ Y?: number;
+
+ /**
+ * Month component (1-12)
+ */
+ M?: number;
+
+ /**
+ * Day component
+ */
+ D?: number;
+
+ /**
+ * Hour in 24-hour format
+ */
+ H?: number;
+
+ /**
+ * Meridiem indicator (0:AM/1:PM)
+ */
+ A?: number;
+
+ /**
+ * Hour in 12-hour format
+ */
+ h?: number;
+
+ /**
+ * Minute component
+ */
+ m?: number;
+
+ /**
+ * Second component
+ */
+ s?: number;
+
+ /**
+ * Millisecond component
+ */
+ S?: number;
+
+ /**
+ * Timezone offset in minutes
+ */
+ Z?: number;
+
+ /**
+ * Current parsing position
+ */
+ _index: number;
+
+ /**
+ * Total length of date string
+ */
+ _length: number;
+
+ /**
+ * Number of matched tokens
+ */
+ _match: number;
+}
+
+const wildcard = ' ';
+const comment = /^\[(.*)\]$/;
+const ellipsis = '...';
+
+/**
+ * Preparses a date string according to the specified pattern.
+ * @param dateString - The date string to preparse
+ * @param arg - The pattern string or compiled object to match against the date string
+ * @param [options] - Optional parser options
+ * @returns PreparseResult containing parsed date components and metadata
+ */
+export function preparse(dateString: string, arg: string | CompiledObject, options?: ParserOptions) {
+ const pattern = (typeof arg === 'string' ? compile(arg) : arg).slice(1);
+ const parserOptions = {
+ hour12: options?.hour12 || 'h12',
+ hour24: options?.hour24 || 'h23',
+ numeral: options?.numeral || latn,
+ calendar: options?.calendar || 'gregory',
+ ignoreCase: options?.ignoreCase || false,
+ timeZone: isTimeZone(options?.timeZone) || isUTC(options?.timeZone) ? options.timeZone : undefined,
+ locale: options?.locale || en
+ };
+ const pr: PreparseResult = {
+ _index: 0,
+ _length: 0,
+ _match: 0
+ };
+ const parsers = [...options?.plugins || [], defaultParser];
+ const resolveToken = (token: string, str: string) => {
+ for (const parser of parsers) {
+ if (parser[token]) {
+ return parser[token](str, parserOptions, pattern);
+ }
+ }
+ return undefined;
+ };
+
+ dateString = parserOptions.numeral.decode(dateString);
+
+ for (const token of pattern) {
+ const str = dateString.substring(pr._index);
+ const result = resolveToken(token, str);
+
+ if (result) {
+ if (!result.length) {
+ break;
+ }
+ if (result.token) {
+ pr[result.token] = result.value + 0;
+ }
+ pr._index += result.length;
+ pr._match++;
+ } else if (token === str[0] || token === wildcard) {
+ pr._index++;
+ } else if (comment.test(token) && !str.indexOf(token.replace(comment, '$1'))) {
+ pr._index += token.length - 2;
+ } else if (token === ellipsis) {
+ pr._index = dateString.length;
+ break;
+ } else {
+ break;
+ }
+ }
+ pr._length = dateString.length;
+ // Breaking change: 12-hour to 24-hour conversion is no longer performed here; values are preserved as read.
+ return pr;
+}
diff --git a/src/subtract.ts b/src/subtract.ts
new file mode 100644
index 0000000..5c5736d
--- /dev/null
+++ b/src/subtract.ts
@@ -0,0 +1,11 @@
+import { Duration } from './duration.ts';
+
+/**
+ * Calculates the difference between two dates.
+ * @param from - The first Date object
+ * @param to - The second Date object
+ * @returns A Duration instance with methods to get the difference in various units
+ */
+export const subtract = (from: Date, to: Date) => {
+ return new Duration(to.getTime() - from.getTime());
+};
diff --git a/src/timezone.ts b/src/timezone.ts
new file mode 100644
index 0000000..65a383b
--- /dev/null
+++ b/src/timezone.ts
@@ -0,0 +1,31 @@
+import { getDateTimeFormat } from './dtf.ts';
+
+export interface TimeZone {
+ zone_name: string,
+ gmt_offset: number[]
+}
+
+export const isTimeZone = (timeZone?: TimeZone | 'UTC'): timeZone is TimeZone => {
+ return typeof timeZone === 'object' && 'zone_name' in timeZone && 'gmt_offset' in timeZone;
+};
+
+export const isUTC = (timeZone?: TimeZone | 'UTC'): timeZone is 'UTC' => {
+ return timeZone === 'UTC';
+};
+
+export const getTimezoneOffset = (utcTime: number, timeZone: TimeZone): number => {
+ const utc = getDateTimeFormat('UTC');
+ const tz = getDateTimeFormat(timeZone.zone_name);
+ const offset = timeZone.gmt_offset;
+
+ for (let i = 0; i < 2; i++) {
+ const targetString = utc.format(utcTime - i * 86400 * 1000);
+
+ for (let j = 0, len = offset.length; j < len; j++) {
+ if (tz.format(utcTime - (offset[j] + i * 86400) * 1000) === targetString) {
+ return offset[j];
+ }
+ }
+ }
+ return NaN;
+};
diff --git a/src/timezones/Africa/Abidjan.ts b/src/timezones/Africa/Abidjan.ts
new file mode 100644
index 0000000..27962ff
--- /dev/null
+++ b/src/timezones/Africa/Abidjan.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Abidjan',
+ gmt_offset: [0, -968]
+};
diff --git a/src/timezones/Africa/Accra.ts b/src/timezones/Africa/Accra.ts
new file mode 100644
index 0000000..da7f18b
--- /dev/null
+++ b/src/timezones/Africa/Accra.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Accra',
+ gmt_offset: [1800, 1200, 0, -52]
+};
diff --git a/src/timezones/Africa/Addis_Ababa.ts b/src/timezones/Africa/Addis_Ababa.ts
new file mode 100644
index 0000000..a3c6976
--- /dev/null
+++ b/src/timezones/Africa/Addis_Ababa.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Addis_Ababa',
+ gmt_offset: [10800, 9320, 9288]
+};
diff --git a/src/timezones/Africa/Algiers.ts b/src/timezones/Africa/Algiers.ts
new file mode 100644
index 0000000..2ae71e8
--- /dev/null
+++ b/src/timezones/Africa/Algiers.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Algiers',
+ gmt_offset: [7200, 3600, 732, 561, 0]
+};
diff --git a/src/timezones/Africa/Asmara.ts b/src/timezones/Africa/Asmara.ts
new file mode 100644
index 0000000..aac7790
--- /dev/null
+++ b/src/timezones/Africa/Asmara.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Asmara',
+ gmt_offset: [10800, 9332, 9320]
+};
diff --git a/src/timezones/Africa/Bamako.ts b/src/timezones/Africa/Bamako.ts
new file mode 100644
index 0000000..7279503
--- /dev/null
+++ b/src/timezones/Africa/Bamako.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Bamako',
+ gmt_offset: [0, -1920, -3600]
+};
diff --git a/src/timezones/Africa/Bangui.ts b/src/timezones/Africa/Bangui.ts
new file mode 100644
index 0000000..96725d8
--- /dev/null
+++ b/src/timezones/Africa/Bangui.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Bangui',
+ gmt_offset: [4460, 3600]
+};
diff --git a/src/timezones/Africa/Banjul.ts b/src/timezones/Africa/Banjul.ts
new file mode 100644
index 0000000..fc83066
--- /dev/null
+++ b/src/timezones/Africa/Banjul.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Banjul',
+ gmt_offset: [0, -3600, -3996]
+};
diff --git a/src/timezones/Africa/Bissau.ts b/src/timezones/Africa/Bissau.ts
new file mode 100644
index 0000000..0c7af83
--- /dev/null
+++ b/src/timezones/Africa/Bissau.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Bissau',
+ gmt_offset: [0, -3600, -3740]
+};
diff --git a/src/timezones/Africa/Blantyre.ts b/src/timezones/Africa/Blantyre.ts
new file mode 100644
index 0000000..73bc029
--- /dev/null
+++ b/src/timezones/Africa/Blantyre.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Blantyre',
+ gmt_offset: [8470, 8460, 8400, 7200]
+};
diff --git a/src/timezones/Africa/Brazzaville.ts b/src/timezones/Africa/Brazzaville.ts
new file mode 100644
index 0000000..4804221
--- /dev/null
+++ b/src/timezones/Africa/Brazzaville.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Brazzaville',
+ gmt_offset: [3668, 3600]
+};
diff --git a/src/timezones/Africa/Bujumbura.ts b/src/timezones/Africa/Bujumbura.ts
new file mode 100644
index 0000000..d9de034
--- /dev/null
+++ b/src/timezones/Africa/Bujumbura.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Bujumbura',
+ gmt_offset: [7200, 7048]
+};
diff --git a/src/timezones/Africa/Cairo.ts b/src/timezones/Africa/Cairo.ts
new file mode 100644
index 0000000..dbaa6d2
--- /dev/null
+++ b/src/timezones/Africa/Cairo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Cairo',
+ gmt_offset: [10800, 7509, 7200]
+};
diff --git a/src/timezones/Africa/Casablanca.ts b/src/timezones/Africa/Casablanca.ts
new file mode 100644
index 0000000..9d2b532
--- /dev/null
+++ b/src/timezones/Africa/Casablanca.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Casablanca',
+ gmt_offset: [3600, 0, -1820]
+};
diff --git a/src/timezones/Africa/Ceuta.ts b/src/timezones/Africa/Ceuta.ts
new file mode 100644
index 0000000..ec8103e
--- /dev/null
+++ b/src/timezones/Africa/Ceuta.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Ceuta',
+ gmt_offset: [7200, 3600, 0, -1276]
+};
diff --git a/src/timezones/Africa/Conakry.ts b/src/timezones/Africa/Conakry.ts
new file mode 100644
index 0000000..2cde786
--- /dev/null
+++ b/src/timezones/Africa/Conakry.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Conakry',
+ gmt_offset: [0, -3292, -3600]
+};
diff --git a/src/timezones/Africa/Dakar.ts b/src/timezones/Africa/Dakar.ts
new file mode 100644
index 0000000..c6e5749
--- /dev/null
+++ b/src/timezones/Africa/Dakar.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Dakar',
+ gmt_offset: [0, -3600, -4184]
+};
diff --git a/src/timezones/Africa/Dar_es_Salaam.ts b/src/timezones/Africa/Dar_es_Salaam.ts
new file mode 100644
index 0000000..84c330e
--- /dev/null
+++ b/src/timezones/Africa/Dar_es_Salaam.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Dar_es_Salaam',
+ gmt_offset: [10800, 9900, 9428]
+};
diff --git a/src/timezones/Africa/Djibouti.ts b/src/timezones/Africa/Djibouti.ts
new file mode 100644
index 0000000..f49aacc
--- /dev/null
+++ b/src/timezones/Africa/Djibouti.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Djibouti',
+ gmt_offset: [10800, 10356]
+};
diff --git a/src/timezones/Africa/Douala.ts b/src/timezones/Africa/Douala.ts
new file mode 100644
index 0000000..1ca7fae
--- /dev/null
+++ b/src/timezones/Africa/Douala.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Douala',
+ gmt_offset: [3600, 2328]
+};
diff --git a/src/timezones/Africa/El_Aaiun.ts b/src/timezones/Africa/El_Aaiun.ts
new file mode 100644
index 0000000..900d8fb
--- /dev/null
+++ b/src/timezones/Africa/El_Aaiun.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/El_Aaiun',
+ gmt_offset: [3600, 0, -3168, -3600]
+};
diff --git a/src/timezones/Africa/Freetown.ts b/src/timezones/Africa/Freetown.ts
new file mode 100644
index 0000000..879e37b
--- /dev/null
+++ b/src/timezones/Africa/Freetown.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Freetown',
+ gmt_offset: [0, -2400, -3180, -3600]
+};
diff --git a/src/timezones/Africa/Gaborone.ts b/src/timezones/Africa/Gaborone.ts
new file mode 100644
index 0000000..1d8e419
--- /dev/null
+++ b/src/timezones/Africa/Gaborone.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Gaborone',
+ gmt_offset: [10800, 7200, 6220, 5400]
+};
diff --git a/src/timezones/Africa/Harare.ts b/src/timezones/Africa/Harare.ts
new file mode 100644
index 0000000..f9f7bf7
--- /dev/null
+++ b/src/timezones/Africa/Harare.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Harare',
+ gmt_offset: [7452, 7200]
+};
diff --git a/src/timezones/Africa/Johannesburg.ts b/src/timezones/Africa/Johannesburg.ts
new file mode 100644
index 0000000..329652c
--- /dev/null
+++ b/src/timezones/Africa/Johannesburg.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Johannesburg',
+ gmt_offset: [10800, 7200, 6720, 5400]
+};
diff --git a/src/timezones/Africa/Juba.ts b/src/timezones/Africa/Juba.ts
new file mode 100644
index 0000000..0cb7c46
--- /dev/null
+++ b/src/timezones/Africa/Juba.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Juba',
+ gmt_offset: [10800, 7588, 7200]
+};
diff --git a/src/timezones/Africa/Kampala.ts b/src/timezones/Africa/Kampala.ts
new file mode 100644
index 0000000..a79a02f
--- /dev/null
+++ b/src/timezones/Africa/Kampala.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Kampala',
+ gmt_offset: [10800, 9900, 9000, 7780]
+};
diff --git a/src/timezones/Africa/Khartoum.ts b/src/timezones/Africa/Khartoum.ts
new file mode 100644
index 0000000..a6ecd39
--- /dev/null
+++ b/src/timezones/Africa/Khartoum.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Khartoum',
+ gmt_offset: [10800, 7808, 7200]
+};
diff --git a/src/timezones/Africa/Kigali.ts b/src/timezones/Africa/Kigali.ts
new file mode 100644
index 0000000..9995384
--- /dev/null
+++ b/src/timezones/Africa/Kigali.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Kigali',
+ gmt_offset: [7216, 7200]
+};
diff --git a/src/timezones/Africa/Kinshasa.ts b/src/timezones/Africa/Kinshasa.ts
new file mode 100644
index 0000000..f9e6422
--- /dev/null
+++ b/src/timezones/Africa/Kinshasa.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Kinshasa',
+ gmt_offset: [3672, 3600]
+};
diff --git a/src/timezones/Africa/Lagos.ts b/src/timezones/Africa/Lagos.ts
new file mode 100644
index 0000000..cf37a38
--- /dev/null
+++ b/src/timezones/Africa/Lagos.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Lagos',
+ gmt_offset: [3600, 1800, 815, 0]
+};
diff --git a/src/timezones/Africa/Libreville.ts b/src/timezones/Africa/Libreville.ts
new file mode 100644
index 0000000..8020c0d
--- /dev/null
+++ b/src/timezones/Africa/Libreville.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Libreville',
+ gmt_offset: [3600, 2268]
+};
diff --git a/src/timezones/Africa/Lome.ts b/src/timezones/Africa/Lome.ts
new file mode 100644
index 0000000..5803330
--- /dev/null
+++ b/src/timezones/Africa/Lome.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Lome',
+ gmt_offset: [292, 0]
+};
diff --git a/src/timezones/Africa/Luanda.ts b/src/timezones/Africa/Luanda.ts
new file mode 100644
index 0000000..6713ddb
--- /dev/null
+++ b/src/timezones/Africa/Luanda.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Luanda',
+ gmt_offset: [3600, 3176, 3124]
+};
diff --git a/src/timezones/Africa/Lubumbashi.ts b/src/timezones/Africa/Lubumbashi.ts
new file mode 100644
index 0000000..f094250
--- /dev/null
+++ b/src/timezones/Africa/Lubumbashi.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Lubumbashi',
+ gmt_offset: [7200, 6592, 3600]
+};
diff --git a/src/timezones/Africa/Lusaka.ts b/src/timezones/Africa/Lusaka.ts
new file mode 100644
index 0000000..a1c5bf8
--- /dev/null
+++ b/src/timezones/Africa/Lusaka.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Lusaka',
+ gmt_offset: [7200, 6788]
+};
diff --git a/src/timezones/Africa/Malabo.ts b/src/timezones/Africa/Malabo.ts
new file mode 100644
index 0000000..5e594df
--- /dev/null
+++ b/src/timezones/Africa/Malabo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Malabo',
+ gmt_offset: [3600, 2108, 0]
+};
diff --git a/src/timezones/Africa/Maputo.ts b/src/timezones/Africa/Maputo.ts
new file mode 100644
index 0000000..30f34c9
--- /dev/null
+++ b/src/timezones/Africa/Maputo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Maputo',
+ gmt_offset: [7818, 7200]
+};
diff --git a/src/timezones/Africa/Maseru.ts b/src/timezones/Africa/Maseru.ts
new file mode 100644
index 0000000..564b24a
--- /dev/null
+++ b/src/timezones/Africa/Maseru.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Maseru',
+ gmt_offset: [10800, 7200, 6600]
+};
diff --git a/src/timezones/Africa/Mbabane.ts b/src/timezones/Africa/Mbabane.ts
new file mode 100644
index 0000000..fcb572b
--- /dev/null
+++ b/src/timezones/Africa/Mbabane.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Mbabane',
+ gmt_offset: [7464, 7200]
+};
diff --git a/src/timezones/Africa/Mogadishu.ts b/src/timezones/Africa/Mogadishu.ts
new file mode 100644
index 0000000..083d36f
--- /dev/null
+++ b/src/timezones/Africa/Mogadishu.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Mogadishu',
+ gmt_offset: [10888, 10800, 9000]
+};
diff --git a/src/timezones/Africa/Monrovia.ts b/src/timezones/Africa/Monrovia.ts
new file mode 100644
index 0000000..7aae099
--- /dev/null
+++ b/src/timezones/Africa/Monrovia.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Monrovia',
+ gmt_offset: [0, -2588, -2670]
+};
diff --git a/src/timezones/Africa/Nairobi.ts b/src/timezones/Africa/Nairobi.ts
new file mode 100644
index 0000000..f3a21c9
--- /dev/null
+++ b/src/timezones/Africa/Nairobi.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Nairobi',
+ gmt_offset: [10800, 9900, 9000, 8836]
+};
diff --git a/src/timezones/Africa/Ndjamena.ts b/src/timezones/Africa/Ndjamena.ts
new file mode 100644
index 0000000..15bdb6a
--- /dev/null
+++ b/src/timezones/Africa/Ndjamena.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Ndjamena',
+ gmt_offset: [7200, 3612, 3600]
+};
diff --git a/src/timezones/Africa/Niamey.ts b/src/timezones/Africa/Niamey.ts
new file mode 100644
index 0000000..3d1df8f
--- /dev/null
+++ b/src/timezones/Africa/Niamey.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Niamey',
+ gmt_offset: [3600, 508, 0, -3600]
+};
diff --git a/src/timezones/Africa/Nouakchott.ts b/src/timezones/Africa/Nouakchott.ts
new file mode 100644
index 0000000..7728dcd
--- /dev/null
+++ b/src/timezones/Africa/Nouakchott.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Nouakchott',
+ gmt_offset: [0, -3600, -3828]
+};
diff --git a/src/timezones/Africa/Ouagadougou.ts b/src/timezones/Africa/Ouagadougou.ts
new file mode 100644
index 0000000..5074704
--- /dev/null
+++ b/src/timezones/Africa/Ouagadougou.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Ouagadougou',
+ gmt_offset: [0, -364]
+};
diff --git a/src/timezones/Africa/Porto-Novo.ts b/src/timezones/Africa/Porto-Novo.ts
new file mode 100644
index 0000000..57274d7
--- /dev/null
+++ b/src/timezones/Africa/Porto-Novo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Porto-Novo',
+ gmt_offset: [3600, 628, 0]
+};
diff --git a/src/timezones/Africa/Sao_Tome.ts b/src/timezones/Africa/Sao_Tome.ts
new file mode 100644
index 0000000..0eb13d8
--- /dev/null
+++ b/src/timezones/Africa/Sao_Tome.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Sao_Tome',
+ gmt_offset: [3600, 1616, 0, -2205]
+};
diff --git a/src/timezones/Africa/Tripoli.ts b/src/timezones/Africa/Tripoli.ts
new file mode 100644
index 0000000..9c33422
--- /dev/null
+++ b/src/timezones/Africa/Tripoli.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Tripoli',
+ gmt_offset: [7200, 3600, 3164]
+};
diff --git a/src/timezones/Africa/Tunis.ts b/src/timezones/Africa/Tunis.ts
new file mode 100644
index 0000000..f9a6dfb
--- /dev/null
+++ b/src/timezones/Africa/Tunis.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Tunis',
+ gmt_offset: [7200, 3600, 2444, 561]
+};
diff --git a/src/timezones/Africa/Windhoek.ts b/src/timezones/Africa/Windhoek.ts
new file mode 100644
index 0000000..69c3cdd
--- /dev/null
+++ b/src/timezones/Africa/Windhoek.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Africa/Windhoek',
+ gmt_offset: [10800, 7200, 5400, 4104, 3600]
+};
diff --git a/src/timezones/America/Adak.ts b/src/timezones/America/Adak.ts
new file mode 100644
index 0000000..030530c
--- /dev/null
+++ b/src/timezones/America/Adak.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Adak',
+ gmt_offset: [44002, -32400, -36000, -39600, -42398]
+};
diff --git a/src/timezones/America/Anchorage.ts b/src/timezones/America/Anchorage.ts
new file mode 100644
index 0000000..bce3fcb
--- /dev/null
+++ b/src/timezones/America/Anchorage.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Anchorage',
+ gmt_offset: [50424, -28800, -32400, -35976, -36000]
+};
diff --git a/src/timezones/America/Anguilla.ts b/src/timezones/America/Anguilla.ts
new file mode 100644
index 0000000..67432f8
--- /dev/null
+++ b/src/timezones/America/Anguilla.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Anguilla',
+ gmt_offset: [-14400, -15136]
+};
diff --git a/src/timezones/America/Antigua.ts b/src/timezones/America/Antigua.ts
new file mode 100644
index 0000000..eb133c3
--- /dev/null
+++ b/src/timezones/America/Antigua.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Antigua',
+ gmt_offset: [-14400, -14832, -18000]
+};
diff --git a/src/timezones/America/Araguaina.ts b/src/timezones/America/Araguaina.ts
new file mode 100644
index 0000000..fb3b4f8
--- /dev/null
+++ b/src/timezones/America/Araguaina.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Araguaina',
+ gmt_offset: [-7200, -10800, -11568]
+};
diff --git a/src/timezones/America/Argentina/Buenos_Aires.ts b/src/timezones/America/Argentina/Buenos_Aires.ts
new file mode 100644
index 0000000..6c8befe
--- /dev/null
+++ b/src/timezones/America/Argentina/Buenos_Aires.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Buenos_Aires',
+ gmt_offset: [-7200, -10800, -14028, -14400, -15408]
+};
diff --git a/src/timezones/America/Argentina/Catamarca.ts b/src/timezones/America/Argentina/Catamarca.ts
new file mode 100644
index 0000000..4091df8
--- /dev/null
+++ b/src/timezones/America/Argentina/Catamarca.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Catamarca',
+ gmt_offset: [-7200, -10800, -14400, -15408, -15788]
+};
diff --git a/src/timezones/America/Argentina/Cordoba.ts b/src/timezones/America/Argentina/Cordoba.ts
new file mode 100644
index 0000000..d8dd892
--- /dev/null
+++ b/src/timezones/America/Argentina/Cordoba.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Cordoba',
+ gmt_offset: [-7200, -10800, -14400, -15408]
+};
diff --git a/src/timezones/America/Argentina/Jujuy.ts b/src/timezones/America/Argentina/Jujuy.ts
new file mode 100644
index 0000000..c3e65e8
--- /dev/null
+++ b/src/timezones/America/Argentina/Jujuy.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Jujuy',
+ gmt_offset: [-7200, -10800, -14400, -15408, -15672]
+};
diff --git a/src/timezones/America/Argentina/La_Rioja.ts b/src/timezones/America/Argentina/La_Rioja.ts
new file mode 100644
index 0000000..17f6068
--- /dev/null
+++ b/src/timezones/America/Argentina/La_Rioja.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/La_Rioja',
+ gmt_offset: [-7200, -10800, -14400, -15408, -16044]
+};
diff --git a/src/timezones/America/Argentina/Mendoza.ts b/src/timezones/America/Argentina/Mendoza.ts
new file mode 100644
index 0000000..8df155a
--- /dev/null
+++ b/src/timezones/America/Argentina/Mendoza.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Mendoza',
+ gmt_offset: [-7200, -10800, -14400, -15408, -16516]
+};
diff --git a/src/timezones/America/Argentina/Rio_Gallegos.ts b/src/timezones/America/Argentina/Rio_Gallegos.ts
new file mode 100644
index 0000000..84b2352
--- /dev/null
+++ b/src/timezones/America/Argentina/Rio_Gallegos.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Rio_Gallegos',
+ gmt_offset: [-7200, -10800, -14400, -15408, -16612]
+};
diff --git a/src/timezones/America/Argentina/Salta.ts b/src/timezones/America/Argentina/Salta.ts
new file mode 100644
index 0000000..21b47b2
--- /dev/null
+++ b/src/timezones/America/Argentina/Salta.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Salta',
+ gmt_offset: [-7200, -10800, -14400, -15408, -15700]
+};
diff --git a/src/timezones/America/Argentina/San_Juan.ts b/src/timezones/America/Argentina/San_Juan.ts
new file mode 100644
index 0000000..85a71d6
--- /dev/null
+++ b/src/timezones/America/Argentina/San_Juan.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/San_Juan',
+ gmt_offset: [-7200, -10800, -14400, -15408, -16444]
+};
diff --git a/src/timezones/America/Argentina/San_Luis.ts b/src/timezones/America/Argentina/San_Luis.ts
new file mode 100644
index 0000000..b6c6749
--- /dev/null
+++ b/src/timezones/America/Argentina/San_Luis.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/San_Luis',
+ gmt_offset: [-7200, -10800, -14400, -15408, -15924]
+};
diff --git a/src/timezones/America/Argentina/Tucuman.ts b/src/timezones/America/Argentina/Tucuman.ts
new file mode 100644
index 0000000..5979702
--- /dev/null
+++ b/src/timezones/America/Argentina/Tucuman.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Tucuman',
+ gmt_offset: [-7200, -10800, -14400, -15408, -15652]
+};
diff --git a/src/timezones/America/Argentina/Ushuaia.ts b/src/timezones/America/Argentina/Ushuaia.ts
new file mode 100644
index 0000000..0ffa529
--- /dev/null
+++ b/src/timezones/America/Argentina/Ushuaia.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Argentina/Ushuaia',
+ gmt_offset: [-7200, -10800, -14400, -15408, -16392]
+};
diff --git a/src/timezones/America/Aruba.ts b/src/timezones/America/Aruba.ts
new file mode 100644
index 0000000..35fdc0d
--- /dev/null
+++ b/src/timezones/America/Aruba.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Aruba',
+ gmt_offset: [-14400, -16200, -16824]
+};
diff --git a/src/timezones/America/Asuncion.ts b/src/timezones/America/Asuncion.ts
new file mode 100644
index 0000000..86141b7
--- /dev/null
+++ b/src/timezones/America/Asuncion.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Asuncion',
+ gmt_offset: [-10800, -13840, -14400]
+};
diff --git a/src/timezones/America/Atikokan.ts b/src/timezones/America/Atikokan.ts
new file mode 100644
index 0000000..9a6c8a9
--- /dev/null
+++ b/src/timezones/America/Atikokan.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Atikokan',
+ gmt_offset: [-18000, -21600, -21988]
+};
diff --git a/src/timezones/America/Bahia.ts b/src/timezones/America/Bahia.ts
new file mode 100644
index 0000000..9c0182f
--- /dev/null
+++ b/src/timezones/America/Bahia.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Bahia',
+ gmt_offset: [-7200, -9244, -10800]
+};
diff --git a/src/timezones/America/Bahia_Banderas.ts b/src/timezones/America/Bahia_Banderas.ts
new file mode 100644
index 0000000..ba07316
--- /dev/null
+++ b/src/timezones/America/Bahia_Banderas.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Bahia_Banderas',
+ gmt_offset: [-18000, -21600, -25200, -25260]
+};
diff --git a/src/timezones/America/Barbados.ts b/src/timezones/America/Barbados.ts
new file mode 100644
index 0000000..0ab5af4
--- /dev/null
+++ b/src/timezones/America/Barbados.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Barbados',
+ gmt_offset: [-10800, -12600, -14309, -14400]
+};
diff --git a/src/timezones/America/Belem.ts b/src/timezones/America/Belem.ts
new file mode 100644
index 0000000..8477bff
--- /dev/null
+++ b/src/timezones/America/Belem.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Belem',
+ gmt_offset: [-7200, -10800, -11636]
+};
diff --git a/src/timezones/America/Belize.ts b/src/timezones/America/Belize.ts
new file mode 100644
index 0000000..67ca0ac
--- /dev/null
+++ b/src/timezones/America/Belize.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Belize',
+ gmt_offset: [-18000, -19800, -21168, -21600]
+};
diff --git a/src/timezones/America/Blanc-Sablon.ts b/src/timezones/America/Blanc-Sablon.ts
new file mode 100644
index 0000000..21f1a33
--- /dev/null
+++ b/src/timezones/America/Blanc-Sablon.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Blanc-Sablon',
+ gmt_offset: [-10800, -13708, -14400]
+};
diff --git a/src/timezones/America/Boa_Vista.ts b/src/timezones/America/Boa_Vista.ts
new file mode 100644
index 0000000..f509fc7
--- /dev/null
+++ b/src/timezones/America/Boa_Vista.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Boa_Vista',
+ gmt_offset: [-10800, -14400, -14560]
+};
diff --git a/src/timezones/America/Bogota.ts b/src/timezones/America/Bogota.ts
new file mode 100644
index 0000000..9182bd0
--- /dev/null
+++ b/src/timezones/America/Bogota.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Bogota',
+ gmt_offset: [-14400, -17776, -18000]
+};
diff --git a/src/timezones/America/Boise.ts b/src/timezones/America/Boise.ts
new file mode 100644
index 0000000..47bb1c5
--- /dev/null
+++ b/src/timezones/America/Boise.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Boise',
+ gmt_offset: [-21600, -25200, -27889, -28800]
+};
diff --git a/src/timezones/America/Cambridge_Bay.ts b/src/timezones/America/Cambridge_Bay.ts
new file mode 100644
index 0000000..89fc19b
--- /dev/null
+++ b/src/timezones/America/Cambridge_Bay.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Cambridge_Bay',
+ gmt_offset: [0, -18000, -21600, -25200]
+};
diff --git a/src/timezones/America/Campo_Grande.ts b/src/timezones/America/Campo_Grande.ts
new file mode 100644
index 0000000..83826b1
--- /dev/null
+++ b/src/timezones/America/Campo_Grande.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Campo_Grande',
+ gmt_offset: [-10800, -13108, -14400]
+};
diff --git a/src/timezones/America/Cancun.ts b/src/timezones/America/Cancun.ts
new file mode 100644
index 0000000..6cabc7e
--- /dev/null
+++ b/src/timezones/America/Cancun.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Cancun',
+ gmt_offset: [-14400, -18000, -20824, -21600]
+};
diff --git a/src/timezones/America/Caracas.ts b/src/timezones/America/Caracas.ts
new file mode 100644
index 0000000..cf16b41
--- /dev/null
+++ b/src/timezones/America/Caracas.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Caracas',
+ gmt_offset: [-14400, -16060, -16064, -16200]
+};
diff --git a/src/timezones/America/Cayenne.ts b/src/timezones/America/Cayenne.ts
new file mode 100644
index 0000000..c2a72b1
--- /dev/null
+++ b/src/timezones/America/Cayenne.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Cayenne',
+ gmt_offset: [-10800, -12560, -14400]
+};
diff --git a/src/timezones/America/Cayman.ts b/src/timezones/America/Cayman.ts
new file mode 100644
index 0000000..ac1f5e8
--- /dev/null
+++ b/src/timezones/America/Cayman.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Cayman',
+ gmt_offset: [-18000, -18430, -19532]
+};
diff --git a/src/timezones/America/Chicago.ts b/src/timezones/America/Chicago.ts
new file mode 100644
index 0000000..875b5fe
--- /dev/null
+++ b/src/timezones/America/Chicago.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Chicago',
+ gmt_offset: [-18000, -21036, -21600]
+};
diff --git a/src/timezones/America/Chihuahua.ts b/src/timezones/America/Chihuahua.ts
new file mode 100644
index 0000000..c080236
--- /dev/null
+++ b/src/timezones/America/Chihuahua.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Chihuahua',
+ gmt_offset: [-18000, -21600, -25200, -25460]
+};
diff --git a/src/timezones/America/Ciudad_Juarez.ts b/src/timezones/America/Ciudad_Juarez.ts
new file mode 100644
index 0000000..126aad6
--- /dev/null
+++ b/src/timezones/America/Ciudad_Juarez.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Ciudad_Juarez',
+ gmt_offset: [-18000, -21600, -25200, -25556]
+};
diff --git a/src/timezones/America/Costa_Rica.ts b/src/timezones/America/Costa_Rica.ts
new file mode 100644
index 0000000..114b536
--- /dev/null
+++ b/src/timezones/America/Costa_Rica.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Costa_Rica',
+ gmt_offset: [-18000, -20173, -21600]
+};
diff --git a/src/timezones/America/Coyhaique.ts b/src/timezones/America/Coyhaique.ts
new file mode 100644
index 0000000..d976bb7
--- /dev/null
+++ b/src/timezones/America/Coyhaique.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Coyhaique',
+ gmt_offset: [-10800, -14400, -16965, -17296, -18000]
+};
diff --git a/src/timezones/America/Creston.ts b/src/timezones/America/Creston.ts
new file mode 100644
index 0000000..bf21158
--- /dev/null
+++ b/src/timezones/America/Creston.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Creston',
+ gmt_offset: [-25200, -27964, -28800]
+};
diff --git a/src/timezones/America/Cuiaba.ts b/src/timezones/America/Cuiaba.ts
new file mode 100644
index 0000000..52b35f8
--- /dev/null
+++ b/src/timezones/America/Cuiaba.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Cuiaba',
+ gmt_offset: [-10800, -13460, -14400]
+};
diff --git a/src/timezones/America/Curacao.ts b/src/timezones/America/Curacao.ts
new file mode 100644
index 0000000..65c2aca
--- /dev/null
+++ b/src/timezones/America/Curacao.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Curacao',
+ gmt_offset: [-14400, -16200, -16547]
+};
diff --git a/src/timezones/America/Danmarkshavn.ts b/src/timezones/America/Danmarkshavn.ts
new file mode 100644
index 0000000..5f5bfa7
--- /dev/null
+++ b/src/timezones/America/Danmarkshavn.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Danmarkshavn',
+ gmt_offset: [0, -4480, -7200, -10800]
+};
diff --git a/src/timezones/America/Dawson.ts b/src/timezones/America/Dawson.ts
new file mode 100644
index 0000000..37dc80a
--- /dev/null
+++ b/src/timezones/America/Dawson.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Dawson',
+ gmt_offset: [-25200, -28800, -32400, -33460]
+};
diff --git a/src/timezones/America/Dawson_Creek.ts b/src/timezones/America/Dawson_Creek.ts
new file mode 100644
index 0000000..6687c2b
--- /dev/null
+++ b/src/timezones/America/Dawson_Creek.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Dawson_Creek',
+ gmt_offset: [-25200, -28800, -28856]
+};
diff --git a/src/timezones/America/Denver.ts b/src/timezones/America/Denver.ts
new file mode 100644
index 0000000..e24de56
--- /dev/null
+++ b/src/timezones/America/Denver.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Denver',
+ gmt_offset: [-21600, -25196, -25200]
+};
diff --git a/src/timezones/America/Detroit.ts b/src/timezones/America/Detroit.ts
new file mode 100644
index 0000000..f26fb07
--- /dev/null
+++ b/src/timezones/America/Detroit.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Detroit',
+ gmt_offset: [-14400, -18000, -19931, -21600]
+};
diff --git a/src/timezones/America/Dominica.ts b/src/timezones/America/Dominica.ts
new file mode 100644
index 0000000..50b8a48
--- /dev/null
+++ b/src/timezones/America/Dominica.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Dominica',
+ gmt_offset: [-14400, -14736]
+};
diff --git a/src/timezones/America/Edmonton.ts b/src/timezones/America/Edmonton.ts
new file mode 100644
index 0000000..3211721
--- /dev/null
+++ b/src/timezones/America/Edmonton.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Edmonton',
+ gmt_offset: [-21600, -25200, -27232]
+};
diff --git a/src/timezones/America/Eirunepe.ts b/src/timezones/America/Eirunepe.ts
new file mode 100644
index 0000000..6850bd5
--- /dev/null
+++ b/src/timezones/America/Eirunepe.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Eirunepe',
+ gmt_offset: [-14400, -16768, -18000]
+};
diff --git a/src/timezones/America/El_Salvador.ts b/src/timezones/America/El_Salvador.ts
new file mode 100644
index 0000000..3fdfb57
--- /dev/null
+++ b/src/timezones/America/El_Salvador.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/El_Salvador',
+ gmt_offset: [-18000, -21408, -21600]
+};
diff --git a/src/timezones/America/Fort_Nelson.ts b/src/timezones/America/Fort_Nelson.ts
new file mode 100644
index 0000000..6479125
--- /dev/null
+++ b/src/timezones/America/Fort_Nelson.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Fort_Nelson',
+ gmt_offset: [-25200, -28800, -29447]
+};
diff --git a/src/timezones/America/Fortaleza.ts b/src/timezones/America/Fortaleza.ts
new file mode 100644
index 0000000..aba5ce6
--- /dev/null
+++ b/src/timezones/America/Fortaleza.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Fortaleza',
+ gmt_offset: [-7200, -9240, -10800]
+};
diff --git a/src/timezones/America/Glace_Bay.ts b/src/timezones/America/Glace_Bay.ts
new file mode 100644
index 0000000..6c2a861
--- /dev/null
+++ b/src/timezones/America/Glace_Bay.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Glace_Bay',
+ gmt_offset: [-10800, -14388, -14400]
+};
diff --git a/src/timezones/America/Goose_Bay.ts b/src/timezones/America/Goose_Bay.ts
new file mode 100644
index 0000000..c947120
--- /dev/null
+++ b/src/timezones/America/Goose_Bay.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Goose_Bay',
+ gmt_offset: [-7200, -9000, -9052, -10800, -12600, -12652, -14400, -14500]
+};
diff --git a/src/timezones/America/Grand_Turk.ts b/src/timezones/America/Grand_Turk.ts
new file mode 100644
index 0000000..b49159b
--- /dev/null
+++ b/src/timezones/America/Grand_Turk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Grand_Turk',
+ gmt_offset: [-14400, -17072, -18000, -18430]
+};
diff --git a/src/timezones/America/Grenada.ts b/src/timezones/America/Grenada.ts
new file mode 100644
index 0000000..04d4aba
--- /dev/null
+++ b/src/timezones/America/Grenada.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Grenada',
+ gmt_offset: [-14400, -14820]
+};
diff --git a/src/timezones/America/Guadeloupe.ts b/src/timezones/America/Guadeloupe.ts
new file mode 100644
index 0000000..6c22fe6
--- /dev/null
+++ b/src/timezones/America/Guadeloupe.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Guadeloupe',
+ gmt_offset: [-14400, -14768]
+};
diff --git a/src/timezones/America/Guatemala.ts b/src/timezones/America/Guatemala.ts
new file mode 100644
index 0000000..aae9061
--- /dev/null
+++ b/src/timezones/America/Guatemala.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Guatemala',
+ gmt_offset: [-18000, -21600, -21724]
+};
diff --git a/src/timezones/America/Guayaquil.ts b/src/timezones/America/Guayaquil.ts
new file mode 100644
index 0000000..527f91e
--- /dev/null
+++ b/src/timezones/America/Guayaquil.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Guayaquil',
+ gmt_offset: [-14400, -18000, -18840, -19160]
+};
diff --git a/src/timezones/America/Guyana.ts b/src/timezones/America/Guyana.ts
new file mode 100644
index 0000000..ab59dd3
--- /dev/null
+++ b/src/timezones/America/Guyana.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Guyana',
+ gmt_offset: [-10800, -13500, -13959, -14400]
+};
diff --git a/src/timezones/America/Halifax.ts b/src/timezones/America/Halifax.ts
new file mode 100644
index 0000000..dac2942
--- /dev/null
+++ b/src/timezones/America/Halifax.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Halifax',
+ gmt_offset: [-10800, -14400, -15264]
+};
diff --git a/src/timezones/America/Havana.ts b/src/timezones/America/Havana.ts
new file mode 100644
index 0000000..12eaf06
--- /dev/null
+++ b/src/timezones/America/Havana.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Havana',
+ gmt_offset: [-14400, -18000, -19768, -19776]
+};
diff --git a/src/timezones/America/Hermosillo.ts b/src/timezones/America/Hermosillo.ts
new file mode 100644
index 0000000..6a7983f
--- /dev/null
+++ b/src/timezones/America/Hermosillo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Hermosillo',
+ gmt_offset: [-21600, -25200, -26632]
+};
diff --git a/src/timezones/America/Indiana/Indianapolis.ts b/src/timezones/America/Indiana/Indianapolis.ts
new file mode 100644
index 0000000..8aba017
--- /dev/null
+++ b/src/timezones/America/Indiana/Indianapolis.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Indiana/Indianapolis',
+ gmt_offset: [-14400, -18000, -20678, -21600]
+};
diff --git a/src/timezones/America/Indiana/Knox.ts b/src/timezones/America/Indiana/Knox.ts
new file mode 100644
index 0000000..9341060
--- /dev/null
+++ b/src/timezones/America/Indiana/Knox.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Indiana/Knox',
+ gmt_offset: [-18000, -20790, -21600]
+};
diff --git a/src/timezones/America/Indiana/Marengo.ts b/src/timezones/America/Indiana/Marengo.ts
new file mode 100644
index 0000000..ca99813
--- /dev/null
+++ b/src/timezones/America/Indiana/Marengo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Indiana/Marengo',
+ gmt_offset: [-14400, -18000, -20723, -21600]
+};
diff --git a/src/timezones/America/Indiana/Petersburg.ts b/src/timezones/America/Indiana/Petersburg.ts
new file mode 100644
index 0000000..11c9b09
--- /dev/null
+++ b/src/timezones/America/Indiana/Petersburg.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Indiana/Petersburg',
+ gmt_offset: [-14400, -18000, -20947, -21600]
+};
diff --git a/src/timezones/America/Indiana/Tell_City.ts b/src/timezones/America/Indiana/Tell_City.ts
new file mode 100644
index 0000000..ae43ead
--- /dev/null
+++ b/src/timezones/America/Indiana/Tell_City.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Indiana/Tell_City',
+ gmt_offset: [-14400, -18000, -20823, -21600]
+};
diff --git a/src/timezones/America/Indiana/Vevay.ts b/src/timezones/America/Indiana/Vevay.ts
new file mode 100644
index 0000000..bcf0dd1
--- /dev/null
+++ b/src/timezones/America/Indiana/Vevay.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Indiana/Vevay',
+ gmt_offset: [-14400, -18000, -20416, -21600]
+};
diff --git a/src/timezones/America/Indiana/Vincennes.ts b/src/timezones/America/Indiana/Vincennes.ts
new file mode 100644
index 0000000..de002b5
--- /dev/null
+++ b/src/timezones/America/Indiana/Vincennes.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Indiana/Vincennes',
+ gmt_offset: [-14400, -18000, -21007, -21600]
+};
diff --git a/src/timezones/America/Indiana/Winamac.ts b/src/timezones/America/Indiana/Winamac.ts
new file mode 100644
index 0000000..2cfac95
--- /dev/null
+++ b/src/timezones/America/Indiana/Winamac.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Indiana/Winamac',
+ gmt_offset: [-14400, -18000, -20785, -21600]
+};
diff --git a/src/timezones/America/Inuvik.ts b/src/timezones/America/Inuvik.ts
new file mode 100644
index 0000000..414d935
--- /dev/null
+++ b/src/timezones/America/Inuvik.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Inuvik',
+ gmt_offset: [0, -21600, -25200, -28800]
+};
diff --git a/src/timezones/America/Iqaluit.ts b/src/timezones/America/Iqaluit.ts
new file mode 100644
index 0000000..f6a7d90
--- /dev/null
+++ b/src/timezones/America/Iqaluit.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Iqaluit',
+ gmt_offset: [0, -14400, -18000, -21600]
+};
diff --git a/src/timezones/America/Jamaica.ts b/src/timezones/America/Jamaica.ts
new file mode 100644
index 0000000..a6a8d52
--- /dev/null
+++ b/src/timezones/America/Jamaica.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Jamaica',
+ gmt_offset: [-14400, -18000, -18430]
+};
diff --git a/src/timezones/America/Juneau.ts b/src/timezones/America/Juneau.ts
new file mode 100644
index 0000000..f226114
--- /dev/null
+++ b/src/timezones/America/Juneau.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Juneau',
+ gmt_offset: [54139, -25200, -28800, -32261, -32400]
+};
diff --git a/src/timezones/America/Kentucky/Louisville.ts b/src/timezones/America/Kentucky/Louisville.ts
new file mode 100644
index 0000000..477d173
--- /dev/null
+++ b/src/timezones/America/Kentucky/Louisville.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Kentucky/Louisville',
+ gmt_offset: [-14400, -18000, -20582, -21600]
+};
diff --git a/src/timezones/America/Kentucky/Monticello.ts b/src/timezones/America/Kentucky/Monticello.ts
new file mode 100644
index 0000000..29aff2a
--- /dev/null
+++ b/src/timezones/America/Kentucky/Monticello.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Kentucky/Monticello',
+ gmt_offset: [-14400, -18000, -20364, -21600]
+};
diff --git a/src/timezones/America/Kralendijk.ts b/src/timezones/America/Kralendijk.ts
new file mode 100644
index 0000000..95956ae
--- /dev/null
+++ b/src/timezones/America/Kralendijk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Kralendijk',
+ gmt_offset: [-10800, -14400, -15865]
+};
diff --git a/src/timezones/America/La_Paz.ts b/src/timezones/America/La_Paz.ts
new file mode 100644
index 0000000..f563af4
--- /dev/null
+++ b/src/timezones/America/La_Paz.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/La_Paz',
+ gmt_offset: [-12756, -14400, -16356]
+};
diff --git a/src/timezones/America/Lima.ts b/src/timezones/America/Lima.ts
new file mode 100644
index 0000000..4a41754
--- /dev/null
+++ b/src/timezones/America/Lima.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Lima',
+ gmt_offset: [-14400, -18000, -18492, -18516]
+};
diff --git a/src/timezones/America/Los_Angeles.ts b/src/timezones/America/Los_Angeles.ts
new file mode 100644
index 0000000..df7bcc6
--- /dev/null
+++ b/src/timezones/America/Los_Angeles.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Los_Angeles',
+ gmt_offset: [-25200, -28378, -28800]
+};
diff --git a/src/timezones/America/Lower_Princes.ts b/src/timezones/America/Lower_Princes.ts
new file mode 100644
index 0000000..0514fa7
--- /dev/null
+++ b/src/timezones/America/Lower_Princes.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Lower_Princes',
+ gmt_offset: [-10800, -14400, -15865]
+};
diff --git a/src/timezones/America/Maceio.ts b/src/timezones/America/Maceio.ts
new file mode 100644
index 0000000..f95e10d
--- /dev/null
+++ b/src/timezones/America/Maceio.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Maceio',
+ gmt_offset: [-7200, -8572, -10800]
+};
diff --git a/src/timezones/America/Managua.ts b/src/timezones/America/Managua.ts
new file mode 100644
index 0000000..a08b2eb
--- /dev/null
+++ b/src/timezones/America/Managua.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Managua',
+ gmt_offset: [-18000, -20708, -20712, -21600]
+};
diff --git a/src/timezones/America/Manaus.ts b/src/timezones/America/Manaus.ts
new file mode 100644
index 0000000..cf6ec6b
--- /dev/null
+++ b/src/timezones/America/Manaus.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Manaus',
+ gmt_offset: [-10800, -14400, -14404]
+};
diff --git a/src/timezones/America/Marigot.ts b/src/timezones/America/Marigot.ts
new file mode 100644
index 0000000..e1c68bb
--- /dev/null
+++ b/src/timezones/America/Marigot.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Marigot',
+ gmt_offset: [-10800, -14400, -15865]
+};
diff --git a/src/timezones/America/Martinique.ts b/src/timezones/America/Martinique.ts
new file mode 100644
index 0000000..277fd16
--- /dev/null
+++ b/src/timezones/America/Martinique.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Martinique',
+ gmt_offset: [-10800, -14400, -14660]
+};
diff --git a/src/timezones/America/Matamoros.ts b/src/timezones/America/Matamoros.ts
new file mode 100644
index 0000000..10d3c1c
--- /dev/null
+++ b/src/timezones/America/Matamoros.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Matamoros',
+ gmt_offset: [-18000, -21600, -23400]
+};
diff --git a/src/timezones/America/Mazatlan.ts b/src/timezones/America/Mazatlan.ts
new file mode 100644
index 0000000..36c3897
--- /dev/null
+++ b/src/timezones/America/Mazatlan.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Mazatlan',
+ gmt_offset: [-21600, -25200, -25540]
+};
diff --git a/src/timezones/America/Menominee.ts b/src/timezones/America/Menominee.ts
new file mode 100644
index 0000000..c514437
--- /dev/null
+++ b/src/timezones/America/Menominee.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Menominee',
+ gmt_offset: [-18000, -21027, -21600]
+};
diff --git a/src/timezones/America/Merida.ts b/src/timezones/America/Merida.ts
new file mode 100644
index 0000000..87e59b3
--- /dev/null
+++ b/src/timezones/America/Merida.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Merida',
+ gmt_offset: [-18000, -21508, -21600]
+};
diff --git a/src/timezones/America/Metlakatla.ts b/src/timezones/America/Metlakatla.ts
new file mode 100644
index 0000000..148b31b
--- /dev/null
+++ b/src/timezones/America/Metlakatla.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Metlakatla',
+ gmt_offset: [54822, -25200, -28800, -31578, -32400]
+};
diff --git a/src/timezones/America/Mexico_City.ts b/src/timezones/America/Mexico_City.ts
new file mode 100644
index 0000000..8c2afea
--- /dev/null
+++ b/src/timezones/America/Mexico_City.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Mexico_City',
+ gmt_offset: [-18000, -21600, -23796, -25200]
+};
diff --git a/src/timezones/America/Miquelon.ts b/src/timezones/America/Miquelon.ts
new file mode 100644
index 0000000..a337aef
--- /dev/null
+++ b/src/timezones/America/Miquelon.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Miquelon',
+ gmt_offset: [-7200, -10800, -13480, -14400]
+};
diff --git a/src/timezones/America/Moncton.ts b/src/timezones/America/Moncton.ts
new file mode 100644
index 0000000..ff6b049
--- /dev/null
+++ b/src/timezones/America/Moncton.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Moncton',
+ gmt_offset: [-10800, -14400, -15548, -18000]
+};
diff --git a/src/timezones/America/Monterrey.ts b/src/timezones/America/Monterrey.ts
new file mode 100644
index 0000000..0ba17c0
--- /dev/null
+++ b/src/timezones/America/Monterrey.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Monterrey',
+ gmt_offset: [-18000, -21600, -24076, -25200]
+};
diff --git a/src/timezones/America/Montevideo.ts b/src/timezones/America/Montevideo.ts
new file mode 100644
index 0000000..1e730f9
--- /dev/null
+++ b/src/timezones/America/Montevideo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Montevideo',
+ gmt_offset: [-5400, -7200, -9000, -10800, -12600, -13491, -14400]
+};
diff --git a/src/timezones/America/Montserrat.ts b/src/timezones/America/Montserrat.ts
new file mode 100644
index 0000000..5b79f5a
--- /dev/null
+++ b/src/timezones/America/Montserrat.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Montserrat',
+ gmt_offset: [-14400, -14932]
+};
diff --git a/src/timezones/America/Nassau.ts b/src/timezones/America/Nassau.ts
new file mode 100644
index 0000000..a1c4f86
--- /dev/null
+++ b/src/timezones/America/Nassau.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Nassau',
+ gmt_offset: [-14400, -18000, -18570]
+};
diff --git a/src/timezones/America/New_York.ts b/src/timezones/America/New_York.ts
new file mode 100644
index 0000000..ad28e99
--- /dev/null
+++ b/src/timezones/America/New_York.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/New_York',
+ gmt_offset: [-14400, -17762, -18000]
+};
diff --git a/src/timezones/America/Nome.ts b/src/timezones/America/Nome.ts
new file mode 100644
index 0000000..804d2ac
--- /dev/null
+++ b/src/timezones/America/Nome.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Nome',
+ gmt_offset: [46702, -28800, -32400, -36000, -39600, -39698]
+};
diff --git a/src/timezones/America/Noronha.ts b/src/timezones/America/Noronha.ts
new file mode 100644
index 0000000..d288529
--- /dev/null
+++ b/src/timezones/America/Noronha.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Noronha',
+ gmt_offset: [-3600, -7200, -7780]
+};
diff --git a/src/timezones/America/North_Dakota/Beulah.ts b/src/timezones/America/North_Dakota/Beulah.ts
new file mode 100644
index 0000000..146db10
--- /dev/null
+++ b/src/timezones/America/North_Dakota/Beulah.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/North_Dakota/Beulah',
+ gmt_offset: [-18000, -21600, -24427, -25200]
+};
diff --git a/src/timezones/America/North_Dakota/Center.ts b/src/timezones/America/North_Dakota/Center.ts
new file mode 100644
index 0000000..dde4f84
--- /dev/null
+++ b/src/timezones/America/North_Dakota/Center.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/North_Dakota/Center',
+ gmt_offset: [-18000, -21600, -24312, -25200]
+};
diff --git a/src/timezones/America/North_Dakota/New_Salem.ts b/src/timezones/America/North_Dakota/New_Salem.ts
new file mode 100644
index 0000000..802fc59
--- /dev/null
+++ b/src/timezones/America/North_Dakota/New_Salem.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/North_Dakota/New_Salem',
+ gmt_offset: [-18000, -21600, -24339, -25200]
+};
diff --git a/src/timezones/America/Nuuk.ts b/src/timezones/America/Nuuk.ts
new file mode 100644
index 0000000..0c1bf08
--- /dev/null
+++ b/src/timezones/America/Nuuk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Nuuk',
+ gmt_offset: [-3600, -7200, -10800, -12416]
+};
diff --git a/src/timezones/America/Ojinaga.ts b/src/timezones/America/Ojinaga.ts
new file mode 100644
index 0000000..cae6a50
--- /dev/null
+++ b/src/timezones/America/Ojinaga.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Ojinaga',
+ gmt_offset: [-18000, -21600, -25060, -25200]
+};
diff --git a/src/timezones/America/Panama.ts b/src/timezones/America/Panama.ts
new file mode 100644
index 0000000..79e1619
--- /dev/null
+++ b/src/timezones/America/Panama.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Panama',
+ gmt_offset: [-18000, -19088, -19176]
+};
diff --git a/src/timezones/America/Paramaribo.ts b/src/timezones/America/Paramaribo.ts
new file mode 100644
index 0000000..1aa5fc2
--- /dev/null
+++ b/src/timezones/America/Paramaribo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Paramaribo',
+ gmt_offset: [-10800, -12600, -13236, -13240, -13252]
+};
diff --git a/src/timezones/America/Phoenix.ts b/src/timezones/America/Phoenix.ts
new file mode 100644
index 0000000..c55a93f
--- /dev/null
+++ b/src/timezones/America/Phoenix.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Phoenix',
+ gmt_offset: [-21600, -25200, -26898]
+};
diff --git a/src/timezones/America/Port-au-Prince.ts b/src/timezones/America/Port-au-Prince.ts
new file mode 100644
index 0000000..f8d84bc
--- /dev/null
+++ b/src/timezones/America/Port-au-Prince.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Port-au-Prince',
+ gmt_offset: [-14400, -17340, -17360, -18000]
+};
diff --git a/src/timezones/America/Port_of_Spain.ts b/src/timezones/America/Port_of_Spain.ts
new file mode 100644
index 0000000..295064d
--- /dev/null
+++ b/src/timezones/America/Port_of_Spain.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Port_of_Spain',
+ gmt_offset: [-14400, -14764]
+};
diff --git a/src/timezones/America/Porto_Velho.ts b/src/timezones/America/Porto_Velho.ts
new file mode 100644
index 0000000..102dcd8
--- /dev/null
+++ b/src/timezones/America/Porto_Velho.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Porto_Velho',
+ gmt_offset: [-10800, -14400, -15336]
+};
diff --git a/src/timezones/America/Puerto_Rico.ts b/src/timezones/America/Puerto_Rico.ts
new file mode 100644
index 0000000..aad34dd
--- /dev/null
+++ b/src/timezones/America/Puerto_Rico.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Puerto_Rico',
+ gmt_offset: [-10800, -14400, -15865]
+};
diff --git a/src/timezones/America/Punta_Arenas.ts b/src/timezones/America/Punta_Arenas.ts
new file mode 100644
index 0000000..ccff195
--- /dev/null
+++ b/src/timezones/America/Punta_Arenas.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Punta_Arenas',
+ gmt_offset: [-10800, -14400, -16965, -17020, -18000]
+};
diff --git a/src/timezones/America/Rankin_Inlet.ts b/src/timezones/America/Rankin_Inlet.ts
new file mode 100644
index 0000000..a463487
--- /dev/null
+++ b/src/timezones/America/Rankin_Inlet.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Rankin_Inlet',
+ gmt_offset: [0, -18000, -21600]
+};
diff --git a/src/timezones/America/Recife.ts b/src/timezones/America/Recife.ts
new file mode 100644
index 0000000..f4dfc21
--- /dev/null
+++ b/src/timezones/America/Recife.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Recife',
+ gmt_offset: [-7200, -8376, -10800]
+};
diff --git a/src/timezones/America/Regina.ts b/src/timezones/America/Regina.ts
new file mode 100644
index 0000000..eb20cc2
--- /dev/null
+++ b/src/timezones/America/Regina.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Regina',
+ gmt_offset: [-21600, -25116, -25200]
+};
diff --git a/src/timezones/America/Resolute.ts b/src/timezones/America/Resolute.ts
new file mode 100644
index 0000000..9c1f49f
--- /dev/null
+++ b/src/timezones/America/Resolute.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Resolute',
+ gmt_offset: [0, -18000, -21600]
+};
diff --git a/src/timezones/America/Rio_Branco.ts b/src/timezones/America/Rio_Branco.ts
new file mode 100644
index 0000000..4d0f698
--- /dev/null
+++ b/src/timezones/America/Rio_Branco.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Rio_Branco',
+ gmt_offset: [-14400, -16272, -18000]
+};
diff --git a/src/timezones/America/Santarem.ts b/src/timezones/America/Santarem.ts
new file mode 100644
index 0000000..8d33ff2
--- /dev/null
+++ b/src/timezones/America/Santarem.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Santarem',
+ gmt_offset: [-10800, -13128, -14400]
+};
diff --git a/src/timezones/America/Santiago.ts b/src/timezones/America/Santiago.ts
new file mode 100644
index 0000000..f928ab8
--- /dev/null
+++ b/src/timezones/America/Santiago.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Santiago',
+ gmt_offset: [-10800, -14400, -16965, -18000]
+};
diff --git a/src/timezones/America/Santo_Domingo.ts b/src/timezones/America/Santo_Domingo.ts
new file mode 100644
index 0000000..84e3b91
--- /dev/null
+++ b/src/timezones/America/Santo_Domingo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Santo_Domingo',
+ gmt_offset: [-14400, -16200, -16776, -16800, -18000]
+};
diff --git a/src/timezones/America/Sao_Paulo.ts b/src/timezones/America/Sao_Paulo.ts
new file mode 100644
index 0000000..2e97f70
--- /dev/null
+++ b/src/timezones/America/Sao_Paulo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Sao_Paulo',
+ gmt_offset: [-7200, -10800, -11188]
+};
diff --git a/src/timezones/America/Scoresbysund.ts b/src/timezones/America/Scoresbysund.ts
new file mode 100644
index 0000000..46e73a9
--- /dev/null
+++ b/src/timezones/America/Scoresbysund.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Scoresbysund',
+ gmt_offset: [0, -3600, -5272, -7200]
+};
diff --git a/src/timezones/America/Sitka.ts b/src/timezones/America/Sitka.ts
new file mode 100644
index 0000000..a31c702
--- /dev/null
+++ b/src/timezones/America/Sitka.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Sitka',
+ gmt_offset: [53927, -25200, -28800, -32400, -32473]
+};
diff --git a/src/timezones/America/St_Barthelemy.ts b/src/timezones/America/St_Barthelemy.ts
new file mode 100644
index 0000000..caedacb
--- /dev/null
+++ b/src/timezones/America/St_Barthelemy.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/St_Barthelemy',
+ gmt_offset: [-10800, -14400, -15865]
+};
diff --git a/src/timezones/America/St_Johns.ts b/src/timezones/America/St_Johns.ts
new file mode 100644
index 0000000..21ed6cb
--- /dev/null
+++ b/src/timezones/America/St_Johns.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/St_Johns',
+ gmt_offset: [-5400, -9000, -9052, -12600, -12652]
+};
diff --git a/src/timezones/America/St_Kitts.ts b/src/timezones/America/St_Kitts.ts
new file mode 100644
index 0000000..3fca9ba
--- /dev/null
+++ b/src/timezones/America/St_Kitts.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/St_Kitts',
+ gmt_offset: [-14400, -15052]
+};
diff --git a/src/timezones/America/St_Lucia.ts b/src/timezones/America/St_Lucia.ts
new file mode 100644
index 0000000..68cd083
--- /dev/null
+++ b/src/timezones/America/St_Lucia.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/St_Lucia',
+ gmt_offset: [-14400, -14640]
+};
diff --git a/src/timezones/America/St_Thomas.ts b/src/timezones/America/St_Thomas.ts
new file mode 100644
index 0000000..7747f4a
--- /dev/null
+++ b/src/timezones/America/St_Thomas.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/St_Thomas',
+ gmt_offset: [-14400, -15584]
+};
diff --git a/src/timezones/America/St_Vincent.ts b/src/timezones/America/St_Vincent.ts
new file mode 100644
index 0000000..42dd7e1
--- /dev/null
+++ b/src/timezones/America/St_Vincent.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/St_Vincent',
+ gmt_offset: [-14400, -14696]
+};
diff --git a/src/timezones/America/Swift_Current.ts b/src/timezones/America/Swift_Current.ts
new file mode 100644
index 0000000..198682d
--- /dev/null
+++ b/src/timezones/America/Swift_Current.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Swift_Current',
+ gmt_offset: [-21600, -25200, -25880]
+};
diff --git a/src/timezones/America/Tegucigalpa.ts b/src/timezones/America/Tegucigalpa.ts
new file mode 100644
index 0000000..70e0873
--- /dev/null
+++ b/src/timezones/America/Tegucigalpa.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Tegucigalpa',
+ gmt_offset: [-18000, -20932, -21600]
+};
diff --git a/src/timezones/America/Thule.ts b/src/timezones/America/Thule.ts
new file mode 100644
index 0000000..a3ab3ff
--- /dev/null
+++ b/src/timezones/America/Thule.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Thule',
+ gmt_offset: [-10800, -14400, -16508]
+};
diff --git a/src/timezones/America/Tijuana.ts b/src/timezones/America/Tijuana.ts
new file mode 100644
index 0000000..cca2f37
--- /dev/null
+++ b/src/timezones/America/Tijuana.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Tijuana',
+ gmt_offset: [-25200, -28084, -28800]
+};
diff --git a/src/timezones/America/Toronto.ts b/src/timezones/America/Toronto.ts
new file mode 100644
index 0000000..a1e7bc1
--- /dev/null
+++ b/src/timezones/America/Toronto.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Toronto',
+ gmt_offset: [-14400, -18000, -19052]
+};
diff --git a/src/timezones/America/Tortola.ts b/src/timezones/America/Tortola.ts
new file mode 100644
index 0000000..29a2b0f
--- /dev/null
+++ b/src/timezones/America/Tortola.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Tortola',
+ gmt_offset: [-14400, -15508]
+};
diff --git a/src/timezones/America/Vancouver.ts b/src/timezones/America/Vancouver.ts
new file mode 100644
index 0000000..82edcc4
--- /dev/null
+++ b/src/timezones/America/Vancouver.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Vancouver',
+ gmt_offset: [-25200, -28800, -29548]
+};
diff --git a/src/timezones/America/Whitehorse.ts b/src/timezones/America/Whitehorse.ts
new file mode 100644
index 0000000..93cd32a
--- /dev/null
+++ b/src/timezones/America/Whitehorse.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Whitehorse',
+ gmt_offset: [-25200, -28800, -32400, -32412]
+};
diff --git a/src/timezones/America/Winnipeg.ts b/src/timezones/America/Winnipeg.ts
new file mode 100644
index 0000000..21dc79a
--- /dev/null
+++ b/src/timezones/America/Winnipeg.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Winnipeg',
+ gmt_offset: [-18000, -21600, -23316]
+};
diff --git a/src/timezones/America/Yakutat.ts b/src/timezones/America/Yakutat.ts
new file mode 100644
index 0000000..1db0dcd
--- /dev/null
+++ b/src/timezones/America/Yakutat.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'America/Yakutat',
+ gmt_offset: [52865, -28800, -32400, -33535]
+};
diff --git a/src/timezones/Antarctica/Casey.ts b/src/timezones/Antarctica/Casey.ts
new file mode 100644
index 0000000..f2c94d6
--- /dev/null
+++ b/src/timezones/Antarctica/Casey.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Casey',
+ gmt_offset: [39600, 28800, 0]
+};
diff --git a/src/timezones/Antarctica/Davis.ts b/src/timezones/Antarctica/Davis.ts
new file mode 100644
index 0000000..24db81f
--- /dev/null
+++ b/src/timezones/Antarctica/Davis.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Davis',
+ gmt_offset: [25200, 18000, 0]
+};
diff --git a/src/timezones/Antarctica/DumontDUrville.ts b/src/timezones/Antarctica/DumontDUrville.ts
new file mode 100644
index 0000000..0121a8c
--- /dev/null
+++ b/src/timezones/Antarctica/DumontDUrville.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/DumontDUrville',
+ gmt_offset: [36000, 0]
+};
diff --git a/src/timezones/Antarctica/Macquarie.ts b/src/timezones/Antarctica/Macquarie.ts
new file mode 100644
index 0000000..e5d00e1
--- /dev/null
+++ b/src/timezones/Antarctica/Macquarie.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Macquarie',
+ gmt_offset: [39600, 36000, 0]
+};
diff --git a/src/timezones/Antarctica/Mawson.ts b/src/timezones/Antarctica/Mawson.ts
new file mode 100644
index 0000000..aa50c6b
--- /dev/null
+++ b/src/timezones/Antarctica/Mawson.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Mawson',
+ gmt_offset: [21600, 18000, 0]
+};
diff --git a/src/timezones/Antarctica/McMurdo.ts b/src/timezones/Antarctica/McMurdo.ts
new file mode 100644
index 0000000..83136ba
--- /dev/null
+++ b/src/timezones/Antarctica/McMurdo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/McMurdo',
+ gmt_offset: [46800, 43200]
+};
diff --git a/src/timezones/Antarctica/Palmer.ts b/src/timezones/Antarctica/Palmer.ts
new file mode 100644
index 0000000..9866474
--- /dev/null
+++ b/src/timezones/Antarctica/Palmer.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Palmer',
+ gmt_offset: [0, -7200, -10800, -14400]
+};
diff --git a/src/timezones/Antarctica/Rothera.ts b/src/timezones/Antarctica/Rothera.ts
new file mode 100644
index 0000000..8c03461
--- /dev/null
+++ b/src/timezones/Antarctica/Rothera.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Rothera',
+ gmt_offset: [0, -10800]
+};
diff --git a/src/timezones/Antarctica/Syowa.ts b/src/timezones/Antarctica/Syowa.ts
new file mode 100644
index 0000000..c8e04e3
--- /dev/null
+++ b/src/timezones/Antarctica/Syowa.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Syowa',
+ gmt_offset: [10800, 0]
+};
diff --git a/src/timezones/Antarctica/Troll.ts b/src/timezones/Antarctica/Troll.ts
new file mode 100644
index 0000000..67cefea
--- /dev/null
+++ b/src/timezones/Antarctica/Troll.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Troll',
+ gmt_offset: [7200, 0]
+};
diff --git a/src/timezones/Antarctica/Vostok.ts b/src/timezones/Antarctica/Vostok.ts
new file mode 100644
index 0000000..adefd32
--- /dev/null
+++ b/src/timezones/Antarctica/Vostok.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Antarctica/Vostok',
+ gmt_offset: [25200, 18000, 0]
+};
diff --git a/src/timezones/Arctic/Longyearbyen.ts b/src/timezones/Arctic/Longyearbyen.ts
new file mode 100644
index 0000000..b885cd4
--- /dev/null
+++ b/src/timezones/Arctic/Longyearbyen.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Arctic/Longyearbyen',
+ gmt_offset: [10800, 7200, 3600, 3208]
+};
diff --git a/src/timezones/Asia/Aden.ts b/src/timezones/Asia/Aden.ts
new file mode 100644
index 0000000..fb157b1
--- /dev/null
+++ b/src/timezones/Asia/Aden.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Aden',
+ gmt_offset: [10800, 10794]
+};
diff --git a/src/timezones/Asia/Almaty.ts b/src/timezones/Asia/Almaty.ts
new file mode 100644
index 0000000..ae3601a
--- /dev/null
+++ b/src/timezones/Asia/Almaty.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Almaty',
+ gmt_offset: [25200, 21600, 18468, 18000]
+};
diff --git a/src/timezones/Asia/Amman.ts b/src/timezones/Asia/Amman.ts
new file mode 100644
index 0000000..faf6383
--- /dev/null
+++ b/src/timezones/Asia/Amman.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Amman',
+ gmt_offset: [10800, 8624, 7200]
+};
diff --git a/src/timezones/Asia/Anadyr.ts b/src/timezones/Asia/Anadyr.ts
new file mode 100644
index 0000000..f308aa0
--- /dev/null
+++ b/src/timezones/Asia/Anadyr.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Anadyr',
+ gmt_offset: [50400, 46800, 43200, 42596, 39600]
+};
diff --git a/src/timezones/Asia/Aqtau.ts b/src/timezones/Asia/Aqtau.ts
new file mode 100644
index 0000000..fcb8e34
--- /dev/null
+++ b/src/timezones/Asia/Aqtau.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Aqtau',
+ gmt_offset: [21600, 18000, 14400, 12064]
+};
diff --git a/src/timezones/Asia/Aqtobe.ts b/src/timezones/Asia/Aqtobe.ts
new file mode 100644
index 0000000..ceecfa5
--- /dev/null
+++ b/src/timezones/Asia/Aqtobe.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Aqtobe',
+ gmt_offset: [21600, 18000, 14400, 13720]
+};
diff --git a/src/timezones/Asia/Ashgabat.ts b/src/timezones/Asia/Ashgabat.ts
new file mode 100644
index 0000000..a284001
--- /dev/null
+++ b/src/timezones/Asia/Ashgabat.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Ashgabat',
+ gmt_offset: [21600, 18000, 14400, 14012]
+};
diff --git a/src/timezones/Asia/Atyrau.ts b/src/timezones/Asia/Atyrau.ts
new file mode 100644
index 0000000..853d429
--- /dev/null
+++ b/src/timezones/Asia/Atyrau.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Atyrau',
+ gmt_offset: [21600, 18000, 14400, 12464, 10800]
+};
diff --git a/src/timezones/Asia/Baghdad.ts b/src/timezones/Asia/Baghdad.ts
new file mode 100644
index 0000000..65dddb5
--- /dev/null
+++ b/src/timezones/Asia/Baghdad.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Baghdad',
+ gmt_offset: [14400, 10800, 10660, 10656]
+};
diff --git a/src/timezones/Asia/Bahrain.ts b/src/timezones/Asia/Bahrain.ts
new file mode 100644
index 0000000..ebe7041
--- /dev/null
+++ b/src/timezones/Asia/Bahrain.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Bahrain',
+ gmt_offset: [14400, 12600, 12140, 10800]
+};
diff --git a/src/timezones/Asia/Baku.ts b/src/timezones/Asia/Baku.ts
new file mode 100644
index 0000000..b0ff347
--- /dev/null
+++ b/src/timezones/Asia/Baku.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Baku',
+ gmt_offset: [18000, 14400, 11964, 10800]
+};
diff --git a/src/timezones/Asia/Bangkok.ts b/src/timezones/Asia/Bangkok.ts
new file mode 100644
index 0000000..c7b819d
--- /dev/null
+++ b/src/timezones/Asia/Bangkok.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Bangkok',
+ gmt_offset: [25200, 24124]
+};
diff --git a/src/timezones/Asia/Barnaul.ts b/src/timezones/Asia/Barnaul.ts
new file mode 100644
index 0000000..7b61499
--- /dev/null
+++ b/src/timezones/Asia/Barnaul.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Barnaul',
+ gmt_offset: [28800, 25200, 21600, 20100]
+};
diff --git a/src/timezones/Asia/Beirut.ts b/src/timezones/Asia/Beirut.ts
new file mode 100644
index 0000000..87aef36
--- /dev/null
+++ b/src/timezones/Asia/Beirut.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Beirut',
+ gmt_offset: [10800, 8520, 7200]
+};
diff --git a/src/timezones/Asia/Bishkek.ts b/src/timezones/Asia/Bishkek.ts
new file mode 100644
index 0000000..475fa15
--- /dev/null
+++ b/src/timezones/Asia/Bishkek.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Bishkek',
+ gmt_offset: [25200, 21600, 18000, 17904]
+};
diff --git a/src/timezones/Asia/Brunei.ts b/src/timezones/Asia/Brunei.ts
new file mode 100644
index 0000000..d6d129c
--- /dev/null
+++ b/src/timezones/Asia/Brunei.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Brunei',
+ gmt_offset: [28800, 27580, 27000]
+};
diff --git a/src/timezones/Asia/Chita.ts b/src/timezones/Asia/Chita.ts
new file mode 100644
index 0000000..d2386a8
--- /dev/null
+++ b/src/timezones/Asia/Chita.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Chita',
+ gmt_offset: [36000, 32400, 28800, 27232]
+};
diff --git a/src/timezones/Asia/Colombo.ts b/src/timezones/Asia/Colombo.ts
new file mode 100644
index 0000000..826cf4e
--- /dev/null
+++ b/src/timezones/Asia/Colombo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Colombo',
+ gmt_offset: [23400, 21600, 19800, 19172, 19164]
+};
diff --git a/src/timezones/Asia/Damascus.ts b/src/timezones/Asia/Damascus.ts
new file mode 100644
index 0000000..7e64273
--- /dev/null
+++ b/src/timezones/Asia/Damascus.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Damascus',
+ gmt_offset: [10800, 8712, 7200]
+};
diff --git a/src/timezones/Asia/Dhaka.ts b/src/timezones/Asia/Dhaka.ts
new file mode 100644
index 0000000..c143c89
--- /dev/null
+++ b/src/timezones/Asia/Dhaka.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Dhaka',
+ gmt_offset: [25200, 23400, 21700, 21600, 21200, 19800]
+};
diff --git a/src/timezones/Asia/Dili.ts b/src/timezones/Asia/Dili.ts
new file mode 100644
index 0000000..f34c90f
--- /dev/null
+++ b/src/timezones/Asia/Dili.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Dili',
+ gmt_offset: [32400, 30140, 28800]
+};
diff --git a/src/timezones/Asia/Dubai.ts b/src/timezones/Asia/Dubai.ts
new file mode 100644
index 0000000..bb11802
--- /dev/null
+++ b/src/timezones/Asia/Dubai.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Dubai',
+ gmt_offset: [14400, 13272]
+};
diff --git a/src/timezones/Asia/Dushanbe.ts b/src/timezones/Asia/Dushanbe.ts
new file mode 100644
index 0000000..91c3d8d
--- /dev/null
+++ b/src/timezones/Asia/Dushanbe.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Dushanbe',
+ gmt_offset: [25200, 21600, 18000, 16512]
+};
diff --git a/src/timezones/Asia/Famagusta.ts b/src/timezones/Asia/Famagusta.ts
new file mode 100644
index 0000000..cc0eebc
--- /dev/null
+++ b/src/timezones/Asia/Famagusta.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Famagusta',
+ gmt_offset: [10800, 8148, 7200]
+};
diff --git a/src/timezones/Asia/Gaza.ts b/src/timezones/Asia/Gaza.ts
new file mode 100644
index 0000000..1110e07
--- /dev/null
+++ b/src/timezones/Asia/Gaza.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Gaza',
+ gmt_offset: [10800, 8272, 7200]
+};
diff --git a/src/timezones/Asia/Hebron.ts b/src/timezones/Asia/Hebron.ts
new file mode 100644
index 0000000..67bbf10
--- /dev/null
+++ b/src/timezones/Asia/Hebron.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Hebron',
+ gmt_offset: [10800, 8423, 7200]
+};
diff --git a/src/timezones/Asia/Ho_Chi_Minh.ts b/src/timezones/Asia/Ho_Chi_Minh.ts
new file mode 100644
index 0000000..58f5b1a
--- /dev/null
+++ b/src/timezones/Asia/Ho_Chi_Minh.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Ho_Chi_Minh',
+ gmt_offset: [32400, 28800, 25590, 25200]
+};
diff --git a/src/timezones/Asia/Hong_Kong.ts b/src/timezones/Asia/Hong_Kong.ts
new file mode 100644
index 0000000..1ece91c
--- /dev/null
+++ b/src/timezones/Asia/Hong_Kong.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Hong_Kong',
+ gmt_offset: [32400, 30600, 28800, 27402]
+};
diff --git a/src/timezones/Asia/Hovd.ts b/src/timezones/Asia/Hovd.ts
new file mode 100644
index 0000000..0def4bb
--- /dev/null
+++ b/src/timezones/Asia/Hovd.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Hovd',
+ gmt_offset: [28800, 25200, 21996, 21600]
+};
diff --git a/src/timezones/Asia/Irkutsk.ts b/src/timezones/Asia/Irkutsk.ts
new file mode 100644
index 0000000..4dcd3bb
--- /dev/null
+++ b/src/timezones/Asia/Irkutsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Irkutsk',
+ gmt_offset: [32400, 28800, 25200, 25025]
+};
diff --git a/src/timezones/Asia/Jakarta.ts b/src/timezones/Asia/Jakarta.ts
new file mode 100644
index 0000000..72654e3
--- /dev/null
+++ b/src/timezones/Asia/Jakarta.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Jakarta',
+ gmt_offset: [32400, 28800, 27000, 26400, 25632, 25200]
+};
diff --git a/src/timezones/Asia/Jayapura.ts b/src/timezones/Asia/Jayapura.ts
new file mode 100644
index 0000000..f85d6e4
--- /dev/null
+++ b/src/timezones/Asia/Jayapura.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Jayapura',
+ gmt_offset: [34200, 33768, 32400]
+};
diff --git a/src/timezones/Asia/Jerusalem.ts b/src/timezones/Asia/Jerusalem.ts
new file mode 100644
index 0000000..90893a2
--- /dev/null
+++ b/src/timezones/Asia/Jerusalem.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Jerusalem',
+ gmt_offset: [14400, 10800, 8454, 8440, 7200]
+};
diff --git a/src/timezones/Asia/Kabul.ts b/src/timezones/Asia/Kabul.ts
new file mode 100644
index 0000000..156c276
--- /dev/null
+++ b/src/timezones/Asia/Kabul.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Kabul',
+ gmt_offset: [16608, 16200, 14400]
+};
diff --git a/src/timezones/Asia/Kamchatka.ts b/src/timezones/Asia/Kamchatka.ts
new file mode 100644
index 0000000..c604d93
--- /dev/null
+++ b/src/timezones/Asia/Kamchatka.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Kamchatka',
+ gmt_offset: [46800, 43200, 39600, 38076]
+};
diff --git a/src/timezones/Asia/Karachi.ts b/src/timezones/Asia/Karachi.ts
new file mode 100644
index 0000000..7ea0ea5
--- /dev/null
+++ b/src/timezones/Asia/Karachi.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Karachi',
+ gmt_offset: [23400, 21600, 19800, 18000, 16092]
+};
diff --git a/src/timezones/Asia/Kathmandu.ts b/src/timezones/Asia/Kathmandu.ts
new file mode 100644
index 0000000..829ec1c
--- /dev/null
+++ b/src/timezones/Asia/Kathmandu.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Kathmandu',
+ gmt_offset: [20700, 20476, 19800]
+};
diff --git a/src/timezones/Asia/Khandyga.ts b/src/timezones/Asia/Khandyga.ts
new file mode 100644
index 0000000..516f2e9
--- /dev/null
+++ b/src/timezones/Asia/Khandyga.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Khandyga',
+ gmt_offset: [39600, 36000, 32533, 32400, 28800]
+};
diff --git a/src/timezones/Asia/Kolkata.ts b/src/timezones/Asia/Kolkata.ts
new file mode 100644
index 0000000..65ab094
--- /dev/null
+++ b/src/timezones/Asia/Kolkata.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Kolkata',
+ gmt_offset: [23400, 21208, 21200, 19800, 19270]
+};
diff --git a/src/timezones/Asia/Krasnoyarsk.ts b/src/timezones/Asia/Krasnoyarsk.ts
new file mode 100644
index 0000000..6bf17c2
--- /dev/null
+++ b/src/timezones/Asia/Krasnoyarsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Krasnoyarsk',
+ gmt_offset: [28800, 25200, 22286, 21600]
+};
diff --git a/src/timezones/Asia/Kuala_Lumpur.ts b/src/timezones/Asia/Kuala_Lumpur.ts
new file mode 100644
index 0000000..c113de2
--- /dev/null
+++ b/src/timezones/Asia/Kuala_Lumpur.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Kuala_Lumpur',
+ gmt_offset: [32400, 28800, 27000, 26400, 25200, 24925, 24406]
+};
diff --git a/src/timezones/Asia/Kuching.ts b/src/timezones/Asia/Kuching.ts
new file mode 100644
index 0000000..e50f6a4
--- /dev/null
+++ b/src/timezones/Asia/Kuching.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Kuching',
+ gmt_offset: [32400, 30000, 28800, 27000, 26480]
+};
diff --git a/src/timezones/Asia/Kuwait.ts b/src/timezones/Asia/Kuwait.ts
new file mode 100644
index 0000000..6dc054e
--- /dev/null
+++ b/src/timezones/Asia/Kuwait.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Kuwait',
+ gmt_offset: [11516, 10800]
+};
diff --git a/src/timezones/Asia/Macau.ts b/src/timezones/Asia/Macau.ts
new file mode 100644
index 0000000..2fe205f
--- /dev/null
+++ b/src/timezones/Asia/Macau.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Macau',
+ gmt_offset: [36000, 32400, 28800, 27250]
+};
diff --git a/src/timezones/Asia/Magadan.ts b/src/timezones/Asia/Magadan.ts
new file mode 100644
index 0000000..77465d0
--- /dev/null
+++ b/src/timezones/Asia/Magadan.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Magadan',
+ gmt_offset: [43200, 39600, 36192, 36000]
+};
diff --git a/src/timezones/Asia/Makassar.ts b/src/timezones/Asia/Makassar.ts
new file mode 100644
index 0000000..58af6f9
--- /dev/null
+++ b/src/timezones/Asia/Makassar.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Makassar',
+ gmt_offset: [32400, 28800, 28656]
+};
diff --git a/src/timezones/Asia/Manila.ts b/src/timezones/Asia/Manila.ts
new file mode 100644
index 0000000..ac3f8ec
--- /dev/null
+++ b/src/timezones/Asia/Manila.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Manila',
+ gmt_offset: [32400, 29032, 28800, -57368]
+};
diff --git a/src/timezones/Asia/Muscat.ts b/src/timezones/Asia/Muscat.ts
new file mode 100644
index 0000000..a638fda
--- /dev/null
+++ b/src/timezones/Asia/Muscat.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Muscat',
+ gmt_offset: [14400, 14064]
+};
diff --git a/src/timezones/Asia/Nicosia.ts b/src/timezones/Asia/Nicosia.ts
new file mode 100644
index 0000000..6b3f617
--- /dev/null
+++ b/src/timezones/Asia/Nicosia.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Nicosia',
+ gmt_offset: [10800, 8008, 7200]
+};
diff --git a/src/timezones/Asia/Novokuznetsk.ts b/src/timezones/Asia/Novokuznetsk.ts
new file mode 100644
index 0000000..dcc3f52
--- /dev/null
+++ b/src/timezones/Asia/Novokuznetsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Novokuznetsk',
+ gmt_offset: [28800, 25200, 21600, 20928]
+};
diff --git a/src/timezones/Asia/Novosibirsk.ts b/src/timezones/Asia/Novosibirsk.ts
new file mode 100644
index 0000000..69085ac
--- /dev/null
+++ b/src/timezones/Asia/Novosibirsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Novosibirsk',
+ gmt_offset: [28800, 25200, 21600, 19900]
+};
diff --git a/src/timezones/Asia/Omsk.ts b/src/timezones/Asia/Omsk.ts
new file mode 100644
index 0000000..2632cf2
--- /dev/null
+++ b/src/timezones/Asia/Omsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Omsk',
+ gmt_offset: [25200, 21600, 18000, 17610]
+};
diff --git a/src/timezones/Asia/Oral.ts b/src/timezones/Asia/Oral.ts
new file mode 100644
index 0000000..1c9a601
--- /dev/null
+++ b/src/timezones/Asia/Oral.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Oral',
+ gmt_offset: [21600, 18000, 14400, 12324, 10800]
+};
diff --git a/src/timezones/Asia/Phnom_Penh.ts b/src/timezones/Asia/Phnom_Penh.ts
new file mode 100644
index 0000000..d9e88c1
--- /dev/null
+++ b/src/timezones/Asia/Phnom_Penh.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Phnom_Penh',
+ gmt_offset: [32400, 28800, 25590, 25200, 25180]
+};
diff --git a/src/timezones/Asia/Pontianak.ts b/src/timezones/Asia/Pontianak.ts
new file mode 100644
index 0000000..a3c8964
--- /dev/null
+++ b/src/timezones/Asia/Pontianak.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Pontianak',
+ gmt_offset: [32400, 28800, 27000, 26240, 25200]
+};
diff --git a/src/timezones/Asia/Pyongyang.ts b/src/timezones/Asia/Pyongyang.ts
new file mode 100644
index 0000000..87fbdd0
--- /dev/null
+++ b/src/timezones/Asia/Pyongyang.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Pyongyang',
+ gmt_offset: [32400, 30600, 30180]
+};
diff --git a/src/timezones/Asia/Qatar.ts b/src/timezones/Asia/Qatar.ts
new file mode 100644
index 0000000..fc62853
--- /dev/null
+++ b/src/timezones/Asia/Qatar.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Qatar',
+ gmt_offset: [14400, 12368, 10800]
+};
diff --git a/src/timezones/Asia/Qostanay.ts b/src/timezones/Asia/Qostanay.ts
new file mode 100644
index 0000000..e9dfdc3
--- /dev/null
+++ b/src/timezones/Asia/Qostanay.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Qostanay',
+ gmt_offset: [21600, 18000, 15268, 14400]
+};
diff --git a/src/timezones/Asia/Qyzylorda.ts b/src/timezones/Asia/Qyzylorda.ts
new file mode 100644
index 0000000..a46679d
--- /dev/null
+++ b/src/timezones/Asia/Qyzylorda.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Qyzylorda',
+ gmt_offset: [21600, 18000, 15712, 14400]
+};
diff --git a/src/timezones/Asia/Riyadh.ts b/src/timezones/Asia/Riyadh.ts
new file mode 100644
index 0000000..f7d54fa
--- /dev/null
+++ b/src/timezones/Asia/Riyadh.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Riyadh',
+ gmt_offset: [11212, 10800]
+};
diff --git a/src/timezones/Asia/Sakhalin.ts b/src/timezones/Asia/Sakhalin.ts
new file mode 100644
index 0000000..7a767a2
--- /dev/null
+++ b/src/timezones/Asia/Sakhalin.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Sakhalin',
+ gmt_offset: [43200, 39600, 36000, 34248, 32400]
+};
diff --git a/src/timezones/Asia/Samarkand.ts b/src/timezones/Asia/Samarkand.ts
new file mode 100644
index 0000000..f60a3ad
--- /dev/null
+++ b/src/timezones/Asia/Samarkand.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Samarkand',
+ gmt_offset: [21600, 18000, 16073, 14400]
+};
diff --git a/src/timezones/Asia/Seoul.ts b/src/timezones/Asia/Seoul.ts
new file mode 100644
index 0000000..99d0ef3
--- /dev/null
+++ b/src/timezones/Asia/Seoul.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Seoul',
+ gmt_offset: [36000, 34200, 32400, 30600, 30472]
+};
diff --git a/src/timezones/Asia/Shanghai.ts b/src/timezones/Asia/Shanghai.ts
new file mode 100644
index 0000000..4374512
--- /dev/null
+++ b/src/timezones/Asia/Shanghai.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Shanghai',
+ gmt_offset: [32400, 29143, 28800]
+};
diff --git a/src/timezones/Asia/Singapore.ts b/src/timezones/Asia/Singapore.ts
new file mode 100644
index 0000000..55a69e8
--- /dev/null
+++ b/src/timezones/Asia/Singapore.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Singapore',
+ gmt_offset: [32400, 28800, 27000, 26400, 25200, 24925]
+};
diff --git a/src/timezones/Asia/Srednekolymsk.ts b/src/timezones/Asia/Srednekolymsk.ts
new file mode 100644
index 0000000..1fcad55
--- /dev/null
+++ b/src/timezones/Asia/Srednekolymsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Srednekolymsk',
+ gmt_offset: [43200, 39600, 36892, 36000]
+};
diff --git a/src/timezones/Asia/Taipei.ts b/src/timezones/Asia/Taipei.ts
new file mode 100644
index 0000000..5fad0e4
--- /dev/null
+++ b/src/timezones/Asia/Taipei.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Taipei',
+ gmt_offset: [32400, 29160, 28800]
+};
diff --git a/src/timezones/Asia/Tashkent.ts b/src/timezones/Asia/Tashkent.ts
new file mode 100644
index 0000000..dcaa423
--- /dev/null
+++ b/src/timezones/Asia/Tashkent.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Tashkent',
+ gmt_offset: [25200, 21600, 18000, 16631]
+};
diff --git a/src/timezones/Asia/Tbilisi.ts b/src/timezones/Asia/Tbilisi.ts
new file mode 100644
index 0000000..d4e94a1
--- /dev/null
+++ b/src/timezones/Asia/Tbilisi.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Tbilisi',
+ gmt_offset: [18000, 14400, 10800, 10751]
+};
diff --git a/src/timezones/Asia/Tehran.ts b/src/timezones/Asia/Tehran.ts
new file mode 100644
index 0000000..5b69ee3
--- /dev/null
+++ b/src/timezones/Asia/Tehran.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Tehran',
+ gmt_offset: [18000, 16200, 14400, 12600, 12344]
+};
diff --git a/src/timezones/Asia/Thimphu.ts b/src/timezones/Asia/Thimphu.ts
new file mode 100644
index 0000000..85d9827
--- /dev/null
+++ b/src/timezones/Asia/Thimphu.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Thimphu',
+ gmt_offset: [21600, 21516, 19800]
+};
diff --git a/src/timezones/Asia/Tokyo.ts b/src/timezones/Asia/Tokyo.ts
new file mode 100644
index 0000000..a719cf2
--- /dev/null
+++ b/src/timezones/Asia/Tokyo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Tokyo',
+ gmt_offset: [36000, 33539, 32400]
+};
diff --git a/src/timezones/Asia/Tomsk.ts b/src/timezones/Asia/Tomsk.ts
new file mode 100644
index 0000000..3aac8bf
--- /dev/null
+++ b/src/timezones/Asia/Tomsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Tomsk',
+ gmt_offset: [28800, 25200, 21600, 20391]
+};
diff --git a/src/timezones/Asia/Ulaanbaatar.ts b/src/timezones/Asia/Ulaanbaatar.ts
new file mode 100644
index 0000000..465cefc
--- /dev/null
+++ b/src/timezones/Asia/Ulaanbaatar.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Ulaanbaatar',
+ gmt_offset: [32400, 28800, 25652, 25200]
+};
diff --git a/src/timezones/Asia/Urumqi.ts b/src/timezones/Asia/Urumqi.ts
new file mode 100644
index 0000000..86ad74e
--- /dev/null
+++ b/src/timezones/Asia/Urumqi.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Urumqi',
+ gmt_offset: [21600, 21020]
+};
diff --git a/src/timezones/Asia/Ust-Nera.ts b/src/timezones/Asia/Ust-Nera.ts
new file mode 100644
index 0000000..f02d21e
--- /dev/null
+++ b/src/timezones/Asia/Ust-Nera.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Ust-Nera',
+ gmt_offset: [43200, 39600, 36000, 34374, 32400, 28800]
+};
diff --git a/src/timezones/Asia/Vientiane.ts b/src/timezones/Asia/Vientiane.ts
new file mode 100644
index 0000000..30e306e
--- /dev/null
+++ b/src/timezones/Asia/Vientiane.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Vientiane',
+ gmt_offset: [32400, 28800, 25590, 25200, 24624]
+};
diff --git a/src/timezones/Asia/Vladivostok.ts b/src/timezones/Asia/Vladivostok.ts
new file mode 100644
index 0000000..36fca0d
--- /dev/null
+++ b/src/timezones/Asia/Vladivostok.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Vladivostok',
+ gmt_offset: [39600, 36000, 32400, 31651]
+};
diff --git a/src/timezones/Asia/Yakutsk.ts b/src/timezones/Asia/Yakutsk.ts
new file mode 100644
index 0000000..0065092
--- /dev/null
+++ b/src/timezones/Asia/Yakutsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Yakutsk',
+ gmt_offset: [36000, 32400, 31138, 28800]
+};
diff --git a/src/timezones/Asia/Yangon.ts b/src/timezones/Asia/Yangon.ts
new file mode 100644
index 0000000..b53229a
--- /dev/null
+++ b/src/timezones/Asia/Yangon.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Yangon',
+ gmt_offset: [32400, 23400, 23087]
+};
diff --git a/src/timezones/Asia/Yekaterinburg.ts b/src/timezones/Asia/Yekaterinburg.ts
new file mode 100644
index 0000000..4340874
--- /dev/null
+++ b/src/timezones/Asia/Yekaterinburg.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Yekaterinburg',
+ gmt_offset: [21600, 18000, 14553, 14400, 13505]
+};
diff --git a/src/timezones/Asia/Yerevan.ts b/src/timezones/Asia/Yerevan.ts
new file mode 100644
index 0000000..7dca0f3
--- /dev/null
+++ b/src/timezones/Asia/Yerevan.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Asia/Yerevan',
+ gmt_offset: [18000, 14400, 10800, 10680]
+};
diff --git a/src/timezones/Atlantic/Azores.ts b/src/timezones/Atlantic/Azores.ts
new file mode 100644
index 0000000..f4bd927
--- /dev/null
+++ b/src/timezones/Atlantic/Azores.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/Azores',
+ gmt_offset: [3600, 0, -3600, -6160, -6872, -7200]
+};
diff --git a/src/timezones/Atlantic/Bermuda.ts b/src/timezones/Atlantic/Bermuda.ts
new file mode 100644
index 0000000..b99ae9d
--- /dev/null
+++ b/src/timezones/Atlantic/Bermuda.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/Bermuda',
+ gmt_offset: [-10800, -11958, -14400, -15558]
+};
diff --git a/src/timezones/Atlantic/Canary.ts b/src/timezones/Atlantic/Canary.ts
new file mode 100644
index 0000000..de77b6e
--- /dev/null
+++ b/src/timezones/Atlantic/Canary.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/Canary',
+ gmt_offset: [3600, 0, -3600, -3696]
+};
diff --git a/src/timezones/Atlantic/Cape_Verde.ts b/src/timezones/Atlantic/Cape_Verde.ts
new file mode 100644
index 0000000..f1e0bdc
--- /dev/null
+++ b/src/timezones/Atlantic/Cape_Verde.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/Cape_Verde',
+ gmt_offset: [-3600, -5644, -7200]
+};
diff --git a/src/timezones/Atlantic/Faroe.ts b/src/timezones/Atlantic/Faroe.ts
new file mode 100644
index 0000000..40a4fa1
--- /dev/null
+++ b/src/timezones/Atlantic/Faroe.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/Faroe',
+ gmt_offset: [3600, 0, -1624]
+};
diff --git a/src/timezones/Atlantic/Madeira.ts b/src/timezones/Atlantic/Madeira.ts
new file mode 100644
index 0000000..814b8be
--- /dev/null
+++ b/src/timezones/Atlantic/Madeira.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/Madeira',
+ gmt_offset: [3600, 0, -3600, -4056]
+};
diff --git a/src/timezones/Atlantic/Reykjavik.ts b/src/timezones/Atlantic/Reykjavik.ts
new file mode 100644
index 0000000..2905266
--- /dev/null
+++ b/src/timezones/Atlantic/Reykjavik.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/Reykjavik',
+ gmt_offset: [0, -3600, -5280]
+};
diff --git a/src/timezones/Atlantic/South_Georgia.ts b/src/timezones/Atlantic/South_Georgia.ts
new file mode 100644
index 0000000..73623f9
--- /dev/null
+++ b/src/timezones/Atlantic/South_Georgia.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/South_Georgia',
+ gmt_offset: [-7200, -8768]
+};
diff --git a/src/timezones/Atlantic/St_Helena.ts b/src/timezones/Atlantic/St_Helena.ts
new file mode 100644
index 0000000..136446f
--- /dev/null
+++ b/src/timezones/Atlantic/St_Helena.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/St_Helena',
+ gmt_offset: [0, -1368]
+};
diff --git a/src/timezones/Atlantic/Stanley.ts b/src/timezones/Atlantic/Stanley.ts
new file mode 100644
index 0000000..d96b0d6
--- /dev/null
+++ b/src/timezones/Atlantic/Stanley.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Atlantic/Stanley',
+ gmt_offset: [-7200, -10800, -13884, -14400]
+};
diff --git a/src/timezones/Australia/Adelaide.ts b/src/timezones/Australia/Adelaide.ts
new file mode 100644
index 0000000..69174dd
--- /dev/null
+++ b/src/timezones/Australia/Adelaide.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Adelaide',
+ gmt_offset: [37800, 34200, 33260, 32400]
+};
diff --git a/src/timezones/Australia/Brisbane.ts b/src/timezones/Australia/Brisbane.ts
new file mode 100644
index 0000000..4ffb701
--- /dev/null
+++ b/src/timezones/Australia/Brisbane.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Brisbane',
+ gmt_offset: [39600, 36728, 36000]
+};
diff --git a/src/timezones/Australia/Broken_Hill.ts b/src/timezones/Australia/Broken_Hill.ts
new file mode 100644
index 0000000..314abfc
--- /dev/null
+++ b/src/timezones/Australia/Broken_Hill.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Broken_Hill',
+ gmt_offset: [37800, 36000, 34200, 33948, 32400]
+};
diff --git a/src/timezones/Australia/Darwin.ts b/src/timezones/Australia/Darwin.ts
new file mode 100644
index 0000000..1c0669f
--- /dev/null
+++ b/src/timezones/Australia/Darwin.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Darwin',
+ gmt_offset: [37800, 34200, 32400, 31400]
+};
diff --git a/src/timezones/Australia/Eucla.ts b/src/timezones/Australia/Eucla.ts
new file mode 100644
index 0000000..4a3751e
--- /dev/null
+++ b/src/timezones/Australia/Eucla.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Eucla',
+ gmt_offset: [35100, 31500, 30928]
+};
diff --git a/src/timezones/Australia/Hobart.ts b/src/timezones/Australia/Hobart.ts
new file mode 100644
index 0000000..c6760e9
--- /dev/null
+++ b/src/timezones/Australia/Hobart.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Hobart',
+ gmt_offset: [39600, 36000, 35356]
+};
diff --git a/src/timezones/Australia/Lindeman.ts b/src/timezones/Australia/Lindeman.ts
new file mode 100644
index 0000000..663911c
--- /dev/null
+++ b/src/timezones/Australia/Lindeman.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Lindeman',
+ gmt_offset: [39600, 36000, 35756]
+};
diff --git a/src/timezones/Australia/Lord_Howe.ts b/src/timezones/Australia/Lord_Howe.ts
new file mode 100644
index 0000000..a0abb5a
--- /dev/null
+++ b/src/timezones/Australia/Lord_Howe.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Lord_Howe',
+ gmt_offset: [41400, 39600, 38180, 37800, 36000]
+};
diff --git a/src/timezones/Australia/Melbourne.ts b/src/timezones/Australia/Melbourne.ts
new file mode 100644
index 0000000..ed83bb6
--- /dev/null
+++ b/src/timezones/Australia/Melbourne.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Melbourne',
+ gmt_offset: [39600, 36000, 34792]
+};
diff --git a/src/timezones/Australia/Perth.ts b/src/timezones/Australia/Perth.ts
new file mode 100644
index 0000000..c6b2e7a
--- /dev/null
+++ b/src/timezones/Australia/Perth.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Perth',
+ gmt_offset: [32400, 28800, 27804]
+};
diff --git a/src/timezones/Australia/Sydney.ts b/src/timezones/Australia/Sydney.ts
new file mode 100644
index 0000000..024ef8d
--- /dev/null
+++ b/src/timezones/Australia/Sydney.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Australia/Sydney',
+ gmt_offset: [39600, 36292, 36000]
+};
diff --git a/src/timezones/Europe/Amsterdam.ts b/src/timezones/Europe/Amsterdam.ts
new file mode 100644
index 0000000..6e5c34d
--- /dev/null
+++ b/src/timezones/Europe/Amsterdam.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Amsterdam',
+ gmt_offset: [7200, 4800, 4772, 3600, 1200, 1172]
+};
diff --git a/src/timezones/Europe/Andorra.ts b/src/timezones/Europe/Andorra.ts
new file mode 100644
index 0000000..ca82677
--- /dev/null
+++ b/src/timezones/Europe/Andorra.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Andorra',
+ gmt_offset: [7200, 3600, 364, 0]
+};
diff --git a/src/timezones/Europe/Astrakhan.ts b/src/timezones/Europe/Astrakhan.ts
new file mode 100644
index 0000000..22eabdc
--- /dev/null
+++ b/src/timezones/Europe/Astrakhan.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Astrakhan',
+ gmt_offset: [18000, 14400, 11532, 10800]
+};
diff --git a/src/timezones/Europe/Athens.ts b/src/timezones/Europe/Athens.ts
new file mode 100644
index 0000000..a17aa41
--- /dev/null
+++ b/src/timezones/Europe/Athens.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Athens',
+ gmt_offset: [10800, 7200, 5692, 3600]
+};
diff --git a/src/timezones/Europe/Belgrade.ts b/src/timezones/Europe/Belgrade.ts
new file mode 100644
index 0000000..2040ff0
--- /dev/null
+++ b/src/timezones/Europe/Belgrade.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Belgrade',
+ gmt_offset: [7200, 4920, 3600]
+};
diff --git a/src/timezones/Europe/Berlin.ts b/src/timezones/Europe/Berlin.ts
new file mode 100644
index 0000000..4d9ec8b
--- /dev/null
+++ b/src/timezones/Europe/Berlin.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Berlin',
+ gmt_offset: [10800, 7200, 3600, 3208]
+};
diff --git a/src/timezones/Europe/Bratislava.ts b/src/timezones/Europe/Bratislava.ts
new file mode 100644
index 0000000..025dc0e
--- /dev/null
+++ b/src/timezones/Europe/Bratislava.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Bratislava',
+ gmt_offset: [7200, 3600, 3464, 0]
+};
diff --git a/src/timezones/Europe/Brussels.ts b/src/timezones/Europe/Brussels.ts
new file mode 100644
index 0000000..64b1bed
--- /dev/null
+++ b/src/timezones/Europe/Brussels.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Brussels',
+ gmt_offset: [7200, 3600, 1050, 0]
+};
diff --git a/src/timezones/Europe/Bucharest.ts b/src/timezones/Europe/Bucharest.ts
new file mode 100644
index 0000000..e04b827
--- /dev/null
+++ b/src/timezones/Europe/Bucharest.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Bucharest',
+ gmt_offset: [10800, 7200, 6264]
+};
diff --git a/src/timezones/Europe/Budapest.ts b/src/timezones/Europe/Budapest.ts
new file mode 100644
index 0000000..3d598f7
--- /dev/null
+++ b/src/timezones/Europe/Budapest.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Budapest',
+ gmt_offset: [7200, 4580, 3600]
+};
diff --git a/src/timezones/Europe/Busingen.ts b/src/timezones/Europe/Busingen.ts
new file mode 100644
index 0000000..81e7270
--- /dev/null
+++ b/src/timezones/Europe/Busingen.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Busingen',
+ gmt_offset: [7200, 3600, 2048, 1786]
+};
diff --git a/src/timezones/Europe/Chisinau.ts b/src/timezones/Europe/Chisinau.ts
new file mode 100644
index 0000000..1c10989
--- /dev/null
+++ b/src/timezones/Europe/Chisinau.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Chisinau',
+ gmt_offset: [14400, 10800, 7200, 6920, 6900, 6264, 3600]
+};
diff --git a/src/timezones/Europe/Copenhagen.ts b/src/timezones/Europe/Copenhagen.ts
new file mode 100644
index 0000000..3ca1926
--- /dev/null
+++ b/src/timezones/Europe/Copenhagen.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Copenhagen',
+ gmt_offset: [7200, 3600, 3020]
+};
diff --git a/src/timezones/Europe/Dublin.ts b/src/timezones/Europe/Dublin.ts
new file mode 100644
index 0000000..2ccc9a9
--- /dev/null
+++ b/src/timezones/Europe/Dublin.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Dublin',
+ gmt_offset: [3600, 2079, 0, -1521]
+};
diff --git a/src/timezones/Europe/Gibraltar.ts b/src/timezones/Europe/Gibraltar.ts
new file mode 100644
index 0000000..e97af73
--- /dev/null
+++ b/src/timezones/Europe/Gibraltar.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Gibraltar',
+ gmt_offset: [7200, 3600, 0, -1284]
+};
diff --git a/src/timezones/Europe/Guernsey.ts b/src/timezones/Europe/Guernsey.ts
new file mode 100644
index 0000000..50ae677
--- /dev/null
+++ b/src/timezones/Europe/Guernsey.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Guernsey',
+ gmt_offset: [7200, 3600, 0, -609]
+};
diff --git a/src/timezones/Europe/Helsinki.ts b/src/timezones/Europe/Helsinki.ts
new file mode 100644
index 0000000..4e46a60
--- /dev/null
+++ b/src/timezones/Europe/Helsinki.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Helsinki',
+ gmt_offset: [10800, 7200, 5989]
+};
diff --git a/src/timezones/Europe/Isle_of_Man.ts b/src/timezones/Europe/Isle_of_Man.ts
new file mode 100644
index 0000000..ff21a89
--- /dev/null
+++ b/src/timezones/Europe/Isle_of_Man.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Isle_of_Man',
+ gmt_offset: [7200, 3600, 0, -1075]
+};
diff --git a/src/timezones/Europe/Istanbul.ts b/src/timezones/Europe/Istanbul.ts
new file mode 100644
index 0000000..cc09a3f
--- /dev/null
+++ b/src/timezones/Europe/Istanbul.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Istanbul',
+ gmt_offset: [14400, 10800, 7200, 7016, 6952]
+};
diff --git a/src/timezones/Europe/Jersey.ts b/src/timezones/Europe/Jersey.ts
new file mode 100644
index 0000000..4bda6ac
--- /dev/null
+++ b/src/timezones/Europe/Jersey.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Jersey',
+ gmt_offset: [7200, 3600, 0, -506]
+};
diff --git a/src/timezones/Europe/Kaliningrad.ts b/src/timezones/Europe/Kaliningrad.ts
new file mode 100644
index 0000000..a221474
--- /dev/null
+++ b/src/timezones/Europe/Kaliningrad.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Kaliningrad',
+ gmt_offset: [14400, 10800, 7200, 4920, 3600]
+};
diff --git a/src/timezones/Europe/Kirov.ts b/src/timezones/Europe/Kirov.ts
new file mode 100644
index 0000000..1fda8c8
--- /dev/null
+++ b/src/timezones/Europe/Kirov.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Kirov',
+ gmt_offset: [18000, 14400, 11928, 10800]
+};
diff --git a/src/timezones/Europe/Kyiv.ts b/src/timezones/Europe/Kyiv.ts
new file mode 100644
index 0000000..4a5f546
--- /dev/null
+++ b/src/timezones/Europe/Kyiv.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Kyiv',
+ gmt_offset: [14400, 10800, 7324, 7200, 3600]
+};
diff --git a/src/timezones/Europe/Lisbon.ts b/src/timezones/Europe/Lisbon.ts
new file mode 100644
index 0000000..97921c1
--- /dev/null
+++ b/src/timezones/Europe/Lisbon.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Lisbon',
+ gmt_offset: [7200, 3600, 0, -2205]
+};
diff --git a/src/timezones/Europe/Ljubljana.ts b/src/timezones/Europe/Ljubljana.ts
new file mode 100644
index 0000000..4865e72
--- /dev/null
+++ b/src/timezones/Europe/Ljubljana.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Ljubljana',
+ gmt_offset: [7200, 3600, 3484]
+};
diff --git a/src/timezones/Europe/London.ts b/src/timezones/Europe/London.ts
new file mode 100644
index 0000000..851d692
--- /dev/null
+++ b/src/timezones/Europe/London.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/London',
+ gmt_offset: [7200, 3600, 0, -75]
+};
diff --git a/src/timezones/Europe/Luxembourg.ts b/src/timezones/Europe/Luxembourg.ts
new file mode 100644
index 0000000..cd8348b
--- /dev/null
+++ b/src/timezones/Europe/Luxembourg.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Luxembourg',
+ gmt_offset: [7200, 3600, 1476, 0]
+};
diff --git a/src/timezones/Europe/Madrid.ts b/src/timezones/Europe/Madrid.ts
new file mode 100644
index 0000000..76cd45d
--- /dev/null
+++ b/src/timezones/Europe/Madrid.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Madrid',
+ gmt_offset: [7200, 3600, 0, -884]
+};
diff --git a/src/timezones/Europe/Malta.ts b/src/timezones/Europe/Malta.ts
new file mode 100644
index 0000000..5367fae
--- /dev/null
+++ b/src/timezones/Europe/Malta.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Malta',
+ gmt_offset: [7200, 3600, 3484]
+};
diff --git a/src/timezones/Europe/Mariehamn.ts b/src/timezones/Europe/Mariehamn.ts
new file mode 100644
index 0000000..670da8a
--- /dev/null
+++ b/src/timezones/Europe/Mariehamn.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Mariehamn',
+ gmt_offset: [10800, 7200, 5989]
+};
diff --git a/src/timezones/Europe/Minsk.ts b/src/timezones/Europe/Minsk.ts
new file mode 100644
index 0000000..373c6bb
--- /dev/null
+++ b/src/timezones/Europe/Minsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Minsk',
+ gmt_offset: [14400, 10800, 7200, 6616, 6600, 3600]
+};
diff --git a/src/timezones/Europe/Monaco.ts b/src/timezones/Europe/Monaco.ts
new file mode 100644
index 0000000..66bbccd
--- /dev/null
+++ b/src/timezones/Europe/Monaco.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Monaco',
+ gmt_offset: [7200, 3600, 1772, 561, 0]
+};
diff --git a/src/timezones/Europe/Moscow.ts b/src/timezones/Europe/Moscow.ts
new file mode 100644
index 0000000..43bab7a
--- /dev/null
+++ b/src/timezones/Europe/Moscow.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Moscow',
+ gmt_offset: [18000, 16279, 14400, 12679, 10800, 9079, 9017, 7200]
+};
diff --git a/src/timezones/Europe/Oslo.ts b/src/timezones/Europe/Oslo.ts
new file mode 100644
index 0000000..96c4b83
--- /dev/null
+++ b/src/timezones/Europe/Oslo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Oslo',
+ gmt_offset: [7200, 3600, 2580]
+};
diff --git a/src/timezones/Europe/Paris.ts b/src/timezones/Europe/Paris.ts
new file mode 100644
index 0000000..466156d
--- /dev/null
+++ b/src/timezones/Europe/Paris.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Paris',
+ gmt_offset: [7200, 3600, 561, 0]
+};
diff --git a/src/timezones/Europe/Podgorica.ts b/src/timezones/Europe/Podgorica.ts
new file mode 100644
index 0000000..2208fc4
--- /dev/null
+++ b/src/timezones/Europe/Podgorica.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Podgorica',
+ gmt_offset: [7200, 4920, 3600]
+};
diff --git a/src/timezones/Europe/Prague.ts b/src/timezones/Europe/Prague.ts
new file mode 100644
index 0000000..821ac6c
--- /dev/null
+++ b/src/timezones/Europe/Prague.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Prague',
+ gmt_offset: [7200, 3600, 3464, 0]
+};
diff --git a/src/timezones/Europe/Riga.ts b/src/timezones/Europe/Riga.ts
new file mode 100644
index 0000000..b0fc73a
--- /dev/null
+++ b/src/timezones/Europe/Riga.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Riga',
+ gmt_offset: [14400, 10800, 9394, 7200, 5794, 3600]
+};
diff --git a/src/timezones/Europe/Rome.ts b/src/timezones/Europe/Rome.ts
new file mode 100644
index 0000000..9052250
--- /dev/null
+++ b/src/timezones/Europe/Rome.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Rome',
+ gmt_offset: [7200, 3600, 2996]
+};
diff --git a/src/timezones/Europe/Samara.ts b/src/timezones/Europe/Samara.ts
new file mode 100644
index 0000000..d050c6f
--- /dev/null
+++ b/src/timezones/Europe/Samara.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Samara',
+ gmt_offset: [18000, 14400, 12020, 10800]
+};
diff --git a/src/timezones/Europe/San_Marino.ts b/src/timezones/Europe/San_Marino.ts
new file mode 100644
index 0000000..f4e3205
--- /dev/null
+++ b/src/timezones/Europe/San_Marino.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/San_Marino',
+ gmt_offset: [7200, 3600, 2996]
+};
diff --git a/src/timezones/Europe/Sarajevo.ts b/src/timezones/Europe/Sarajevo.ts
new file mode 100644
index 0000000..a861468
--- /dev/null
+++ b/src/timezones/Europe/Sarajevo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Sarajevo',
+ gmt_offset: [7200, 4420, 3600]
+};
diff --git a/src/timezones/Europe/Saratov.ts b/src/timezones/Europe/Saratov.ts
new file mode 100644
index 0000000..1b7172a
--- /dev/null
+++ b/src/timezones/Europe/Saratov.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Saratov',
+ gmt_offset: [18000, 14400, 11058, 10800]
+};
diff --git a/src/timezones/Europe/Simferopol.ts b/src/timezones/Europe/Simferopol.ts
new file mode 100644
index 0000000..028accc
--- /dev/null
+++ b/src/timezones/Europe/Simferopol.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Simferopol',
+ gmt_offset: [14400, 10800, 8184, 8160, 7200, 3600]
+};
diff --git a/src/timezones/Europe/Skopje.ts b/src/timezones/Europe/Skopje.ts
new file mode 100644
index 0000000..936f51a
--- /dev/null
+++ b/src/timezones/Europe/Skopje.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Skopje',
+ gmt_offset: [7200, 5144, 3600]
+};
diff --git a/src/timezones/Europe/Sofia.ts b/src/timezones/Europe/Sofia.ts
new file mode 100644
index 0000000..b0b413a
--- /dev/null
+++ b/src/timezones/Europe/Sofia.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Sofia',
+ gmt_offset: [10800, 7200, 7016, 5596, 3600]
+};
diff --git a/src/timezones/Europe/Stockholm.ts b/src/timezones/Europe/Stockholm.ts
new file mode 100644
index 0000000..37b9c47
--- /dev/null
+++ b/src/timezones/Europe/Stockholm.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Stockholm',
+ gmt_offset: [7200, 4332, 3614, 3600]
+};
diff --git a/src/timezones/Europe/Tallinn.ts b/src/timezones/Europe/Tallinn.ts
new file mode 100644
index 0000000..81896be
--- /dev/null
+++ b/src/timezones/Europe/Tallinn.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Tallinn',
+ gmt_offset: [14400, 10800, 7200, 5940, 3600]
+};
diff --git a/src/timezones/Europe/Tirane.ts b/src/timezones/Europe/Tirane.ts
new file mode 100644
index 0000000..641edb9
--- /dev/null
+++ b/src/timezones/Europe/Tirane.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Tirane',
+ gmt_offset: [7200, 4760, 3600]
+};
diff --git a/src/timezones/Europe/Ulyanovsk.ts b/src/timezones/Europe/Ulyanovsk.ts
new file mode 100644
index 0000000..d97924b
--- /dev/null
+++ b/src/timezones/Europe/Ulyanovsk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Ulyanovsk',
+ gmt_offset: [18000, 14400, 11616, 10800, 7200]
+};
diff --git a/src/timezones/Europe/Vaduz.ts b/src/timezones/Europe/Vaduz.ts
new file mode 100644
index 0000000..f5be010
--- /dev/null
+++ b/src/timezones/Europe/Vaduz.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Vaduz',
+ gmt_offset: [7200, 3600, 2284]
+};
diff --git a/src/timezones/Europe/Vatican.ts b/src/timezones/Europe/Vatican.ts
new file mode 100644
index 0000000..d2cacf3
--- /dev/null
+++ b/src/timezones/Europe/Vatican.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Vatican',
+ gmt_offset: [7200, 3600, 2996]
+};
diff --git a/src/timezones/Europe/Vienna.ts b/src/timezones/Europe/Vienna.ts
new file mode 100644
index 0000000..0776372
--- /dev/null
+++ b/src/timezones/Europe/Vienna.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Vienna',
+ gmt_offset: [7200, 3921, 3600]
+};
diff --git a/src/timezones/Europe/Vilnius.ts b/src/timezones/Europe/Vilnius.ts
new file mode 100644
index 0000000..9c6a229
--- /dev/null
+++ b/src/timezones/Europe/Vilnius.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Vilnius',
+ gmt_offset: [14400, 10800, 7200, 6076, 5736, 5040, 3600]
+};
diff --git a/src/timezones/Europe/Volgograd.ts b/src/timezones/Europe/Volgograd.ts
new file mode 100644
index 0000000..e344ee7
--- /dev/null
+++ b/src/timezones/Europe/Volgograd.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Volgograd',
+ gmt_offset: [18000, 14400, 10800, 10660]
+};
diff --git a/src/timezones/Europe/Warsaw.ts b/src/timezones/Europe/Warsaw.ts
new file mode 100644
index 0000000..4dd9231
--- /dev/null
+++ b/src/timezones/Europe/Warsaw.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Warsaw',
+ gmt_offset: [10800, 7200, 5040, 3600]
+};
diff --git a/src/timezones/Europe/Zagreb.ts b/src/timezones/Europe/Zagreb.ts
new file mode 100644
index 0000000..0b73d91
--- /dev/null
+++ b/src/timezones/Europe/Zagreb.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Zagreb',
+ gmt_offset: [7200, 3832, 3600]
+};
diff --git a/src/timezones/Europe/Zurich.ts b/src/timezones/Europe/Zurich.ts
new file mode 100644
index 0000000..ba24600
--- /dev/null
+++ b/src/timezones/Europe/Zurich.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Europe/Zurich',
+ gmt_offset: [7200, 3600, 2048, 1786]
+};
diff --git a/src/timezones/Indian/Antananarivo.ts b/src/timezones/Indian/Antananarivo.ts
new file mode 100644
index 0000000..d1d6f00
--- /dev/null
+++ b/src/timezones/Indian/Antananarivo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Antananarivo',
+ gmt_offset: [14400, 11404, 10800]
+};
diff --git a/src/timezones/Indian/Chagos.ts b/src/timezones/Indian/Chagos.ts
new file mode 100644
index 0000000..bc7b164
--- /dev/null
+++ b/src/timezones/Indian/Chagos.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Chagos',
+ gmt_offset: [21600, 18000, 17380]
+};
diff --git a/src/timezones/Indian/Christmas.ts b/src/timezones/Indian/Christmas.ts
new file mode 100644
index 0000000..3378f82
--- /dev/null
+++ b/src/timezones/Indian/Christmas.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Christmas',
+ gmt_offset: [25372, 25200]
+};
diff --git a/src/timezones/Indian/Cocos.ts b/src/timezones/Indian/Cocos.ts
new file mode 100644
index 0000000..42588b0
--- /dev/null
+++ b/src/timezones/Indian/Cocos.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Cocos',
+ gmt_offset: [23400, 23260]
+};
diff --git a/src/timezones/Indian/Comoro.ts b/src/timezones/Indian/Comoro.ts
new file mode 100644
index 0000000..6e613e9
--- /dev/null
+++ b/src/timezones/Indian/Comoro.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Comoro',
+ gmt_offset: [10800, 10384]
+};
diff --git a/src/timezones/Indian/Kerguelen.ts b/src/timezones/Indian/Kerguelen.ts
new file mode 100644
index 0000000..2c20736
--- /dev/null
+++ b/src/timezones/Indian/Kerguelen.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Kerguelen',
+ gmt_offset: [18000, 0]
+};
diff --git a/src/timezones/Indian/Mahe.ts b/src/timezones/Indian/Mahe.ts
new file mode 100644
index 0000000..d860283
--- /dev/null
+++ b/src/timezones/Indian/Mahe.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Mahe',
+ gmt_offset: [14400, 13308]
+};
diff --git a/src/timezones/Indian/Maldives.ts b/src/timezones/Indian/Maldives.ts
new file mode 100644
index 0000000..42cd087
--- /dev/null
+++ b/src/timezones/Indian/Maldives.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Maldives',
+ gmt_offset: [18000, 17640]
+};
diff --git a/src/timezones/Indian/Mauritius.ts b/src/timezones/Indian/Mauritius.ts
new file mode 100644
index 0000000..112833c
--- /dev/null
+++ b/src/timezones/Indian/Mauritius.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Mauritius',
+ gmt_offset: [18000, 14400, 13800]
+};
diff --git a/src/timezones/Indian/Mayotte.ts b/src/timezones/Indian/Mayotte.ts
new file mode 100644
index 0000000..4ab141c
--- /dev/null
+++ b/src/timezones/Indian/Mayotte.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Mayotte',
+ gmt_offset: [10856, 10800]
+};
diff --git a/src/timezones/Indian/Reunion.ts b/src/timezones/Indian/Reunion.ts
new file mode 100644
index 0000000..b0d0064
--- /dev/null
+++ b/src/timezones/Indian/Reunion.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Indian/Reunion',
+ gmt_offset: [14400, 13312]
+};
diff --git a/src/timezones/Pacific/Apia.ts b/src/timezones/Pacific/Apia.ts
new file mode 100644
index 0000000..a53da59
--- /dev/null
+++ b/src/timezones/Pacific/Apia.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Apia',
+ gmt_offset: [50400, 46800, 45184, -36000, -39600, -41216, -41400]
+};
diff --git a/src/timezones/Pacific/Auckland.ts b/src/timezones/Pacific/Auckland.ts
new file mode 100644
index 0000000..419bbee
--- /dev/null
+++ b/src/timezones/Pacific/Auckland.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Auckland',
+ gmt_offset: [46800, 45000, 43200, 41944, 41400]
+};
diff --git a/src/timezones/Pacific/Bougainville.ts b/src/timezones/Pacific/Bougainville.ts
new file mode 100644
index 0000000..e830567
--- /dev/null
+++ b/src/timezones/Pacific/Bougainville.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Bougainville',
+ gmt_offset: [39600, 37336, 36000, 35312, 32400]
+};
diff --git a/src/timezones/Pacific/Chatham.ts b/src/timezones/Pacific/Chatham.ts
new file mode 100644
index 0000000..ff77de8
--- /dev/null
+++ b/src/timezones/Pacific/Chatham.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Chatham',
+ gmt_offset: [49500, 45900, 44100, 44028]
+};
diff --git a/src/timezones/Pacific/Chuuk.ts b/src/timezones/Pacific/Chuuk.ts
new file mode 100644
index 0000000..fb1f859
--- /dev/null
+++ b/src/timezones/Pacific/Chuuk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Chuuk',
+ gmt_offset: [36428, 36000, 32400, -49972]
+};
diff --git a/src/timezones/Pacific/Easter.ts b/src/timezones/Pacific/Easter.ts
new file mode 100644
index 0000000..470b400
--- /dev/null
+++ b/src/timezones/Pacific/Easter.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Easter',
+ gmt_offset: [-18000, -21600, -25200, -26248]
+};
diff --git a/src/timezones/Pacific/Efate.ts b/src/timezones/Pacific/Efate.ts
new file mode 100644
index 0000000..a0807ac
--- /dev/null
+++ b/src/timezones/Pacific/Efate.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Efate',
+ gmt_offset: [43200, 40396, 39600]
+};
diff --git a/src/timezones/Pacific/Fakaofo.ts b/src/timezones/Pacific/Fakaofo.ts
new file mode 100644
index 0000000..33ed3e3
--- /dev/null
+++ b/src/timezones/Pacific/Fakaofo.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Fakaofo',
+ gmt_offset: [46800, -39600, -41096]
+};
diff --git a/src/timezones/Pacific/Fiji.ts b/src/timezones/Pacific/Fiji.ts
new file mode 100644
index 0000000..93fe66f
--- /dev/null
+++ b/src/timezones/Pacific/Fiji.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Fiji',
+ gmt_offset: [46800, 43200, 42944]
+};
diff --git a/src/timezones/Pacific/Funafuti.ts b/src/timezones/Pacific/Funafuti.ts
new file mode 100644
index 0000000..25104e5
--- /dev/null
+++ b/src/timezones/Pacific/Funafuti.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Funafuti',
+ gmt_offset: [43200, 43012]
+};
diff --git a/src/timezones/Pacific/Galapagos.ts b/src/timezones/Pacific/Galapagos.ts
new file mode 100644
index 0000000..3bead22
--- /dev/null
+++ b/src/timezones/Pacific/Galapagos.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Galapagos',
+ gmt_offset: [-18000, -21504, -21600]
+};
diff --git a/src/timezones/Pacific/Gambier.ts b/src/timezones/Pacific/Gambier.ts
new file mode 100644
index 0000000..ac4547c
--- /dev/null
+++ b/src/timezones/Pacific/Gambier.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Gambier',
+ gmt_offset: [-32388, -32400]
+};
diff --git a/src/timezones/Pacific/Guadalcanal.ts b/src/timezones/Pacific/Guadalcanal.ts
new file mode 100644
index 0000000..94d36bb
--- /dev/null
+++ b/src/timezones/Pacific/Guadalcanal.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Guadalcanal',
+ gmt_offset: [39600, 38388]
+};
diff --git a/src/timezones/Pacific/Guam.ts b/src/timezones/Pacific/Guam.ts
new file mode 100644
index 0000000..9725df0
--- /dev/null
+++ b/src/timezones/Pacific/Guam.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Guam',
+ gmt_offset: [39600, 36000, 34740, 32400, -51660]
+};
diff --git a/src/timezones/Pacific/Honolulu.ts b/src/timezones/Pacific/Honolulu.ts
new file mode 100644
index 0000000..877b195
--- /dev/null
+++ b/src/timezones/Pacific/Honolulu.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Honolulu',
+ gmt_offset: [-34200, -36000, -37800, -37886]
+};
diff --git a/src/timezones/Pacific/Kanton.ts b/src/timezones/Pacific/Kanton.ts
new file mode 100644
index 0000000..3b94531
--- /dev/null
+++ b/src/timezones/Pacific/Kanton.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Kanton',
+ gmt_offset: [46800, 0, -39600, -43200]
+};
diff --git a/src/timezones/Pacific/Kiritimati.ts b/src/timezones/Pacific/Kiritimati.ts
new file mode 100644
index 0000000..8bbcc01
--- /dev/null
+++ b/src/timezones/Pacific/Kiritimati.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Kiritimati',
+ gmt_offset: [50400, -36000, -37760, -38400]
+};
diff --git a/src/timezones/Pacific/Kosrae.ts b/src/timezones/Pacific/Kosrae.ts
new file mode 100644
index 0000000..0194076
--- /dev/null
+++ b/src/timezones/Pacific/Kosrae.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Kosrae',
+ gmt_offset: [43200, 39600, 39116, 36000, 32400, -47284]
+};
diff --git a/src/timezones/Pacific/Kwajalein.ts b/src/timezones/Pacific/Kwajalein.ts
new file mode 100644
index 0000000..dae8e3b
--- /dev/null
+++ b/src/timezones/Pacific/Kwajalein.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Kwajalein',
+ gmt_offset: [43200, 40160, 39600, 36000, 32400, -43200]
+};
diff --git a/src/timezones/Pacific/Majuro.ts b/src/timezones/Pacific/Majuro.ts
new file mode 100644
index 0000000..a3bd87d
--- /dev/null
+++ b/src/timezones/Pacific/Majuro.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Majuro',
+ gmt_offset: [43200, 41088, 39600, 36000, 32400]
+};
diff --git a/src/timezones/Pacific/Marquesas.ts b/src/timezones/Pacific/Marquesas.ts
new file mode 100644
index 0000000..449e56a
--- /dev/null
+++ b/src/timezones/Pacific/Marquesas.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Marquesas',
+ gmt_offset: [-33480, -34200]
+};
diff --git a/src/timezones/Pacific/Midway.ts b/src/timezones/Pacific/Midway.ts
new file mode 100644
index 0000000..09b8db1
--- /dev/null
+++ b/src/timezones/Pacific/Midway.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Midway',
+ gmt_offset: [-36000, -39600, -42568]
+};
diff --git a/src/timezones/Pacific/Nauru.ts b/src/timezones/Pacific/Nauru.ts
new file mode 100644
index 0000000..8442a8b
--- /dev/null
+++ b/src/timezones/Pacific/Nauru.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Nauru',
+ gmt_offset: [43200, 41400, 40060, 32400]
+};
diff --git a/src/timezones/Pacific/Niue.ts b/src/timezones/Pacific/Niue.ts
new file mode 100644
index 0000000..744a89a
--- /dev/null
+++ b/src/timezones/Pacific/Niue.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Niue',
+ gmt_offset: [-39600, -40780, -40800]
+};
diff --git a/src/timezones/Pacific/Norfolk.ts b/src/timezones/Pacific/Norfolk.ts
new file mode 100644
index 0000000..9bd51f9
--- /dev/null
+++ b/src/timezones/Pacific/Norfolk.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Norfolk',
+ gmt_offset: [45000, 43200, 41400, 40320, 40312, 39600]
+};
diff --git a/src/timezones/Pacific/Noumea.ts b/src/timezones/Pacific/Noumea.ts
new file mode 100644
index 0000000..ac3edb4
--- /dev/null
+++ b/src/timezones/Pacific/Noumea.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Noumea',
+ gmt_offset: [43200, 39948, 39600]
+};
diff --git a/src/timezones/Pacific/Pago_Pago.ts b/src/timezones/Pacific/Pago_Pago.ts
new file mode 100644
index 0000000..9e68595
--- /dev/null
+++ b/src/timezones/Pacific/Pago_Pago.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Pago_Pago',
+ gmt_offset: [45432, -39600, -40968]
+};
diff --git a/src/timezones/Pacific/Palau.ts b/src/timezones/Pacific/Palau.ts
new file mode 100644
index 0000000..649c7fe
--- /dev/null
+++ b/src/timezones/Pacific/Palau.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Palau',
+ gmt_offset: [32400, 32276, -54124]
+};
diff --git a/src/timezones/Pacific/Pitcairn.ts b/src/timezones/Pacific/Pitcairn.ts
new file mode 100644
index 0000000..733761d
--- /dev/null
+++ b/src/timezones/Pacific/Pitcairn.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Pitcairn',
+ gmt_offset: [-28800, -30600, -31220]
+};
diff --git a/src/timezones/Pacific/Pohnpei.ts b/src/timezones/Pacific/Pohnpei.ts
new file mode 100644
index 0000000..4747fe1
--- /dev/null
+++ b/src/timezones/Pacific/Pohnpei.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Pohnpei',
+ gmt_offset: [39600, 37972, 36000, 32400, -48428]
+};
diff --git a/src/timezones/Pacific/Port_Moresby.ts b/src/timezones/Pacific/Port_Moresby.ts
new file mode 100644
index 0000000..5b4f096
--- /dev/null
+++ b/src/timezones/Pacific/Port_Moresby.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Port_Moresby',
+ gmt_offset: [36000, 35320, 35312]
+};
diff --git a/src/timezones/Pacific/Rarotonga.ts b/src/timezones/Pacific/Rarotonga.ts
new file mode 100644
index 0000000..94d9ee3
--- /dev/null
+++ b/src/timezones/Pacific/Rarotonga.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Rarotonga',
+ gmt_offset: [48056, -34200, -36000, -37800, -38344]
+};
diff --git a/src/timezones/Pacific/Saipan.ts b/src/timezones/Pacific/Saipan.ts
new file mode 100644
index 0000000..588a040
--- /dev/null
+++ b/src/timezones/Pacific/Saipan.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Saipan',
+ gmt_offset: [39600, 36000, 34980, 32400, -51420]
+};
diff --git a/src/timezones/Pacific/Tahiti.ts b/src/timezones/Pacific/Tahiti.ts
new file mode 100644
index 0000000..9ec5bce
--- /dev/null
+++ b/src/timezones/Pacific/Tahiti.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Tahiti',
+ gmt_offset: [-35896, -36000]
+};
diff --git a/src/timezones/Pacific/Tarawa.ts b/src/timezones/Pacific/Tarawa.ts
new file mode 100644
index 0000000..741f62e
--- /dev/null
+++ b/src/timezones/Pacific/Tarawa.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Tarawa',
+ gmt_offset: [43200, 41524]
+};
diff --git a/src/timezones/Pacific/Tongatapu.ts b/src/timezones/Pacific/Tongatapu.ts
new file mode 100644
index 0000000..b3b1d8a
--- /dev/null
+++ b/src/timezones/Pacific/Tongatapu.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Tongatapu',
+ gmt_offset: [50400, 46800, 44400, 44352]
+};
diff --git a/src/timezones/Pacific/Wake.ts b/src/timezones/Pacific/Wake.ts
new file mode 100644
index 0000000..31e9032
--- /dev/null
+++ b/src/timezones/Pacific/Wake.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Wake',
+ gmt_offset: [43200, 39988]
+};
diff --git a/src/timezones/Pacific/Wallis.ts b/src/timezones/Pacific/Wallis.ts
new file mode 100644
index 0000000..7dc1e4b
--- /dev/null
+++ b/src/timezones/Pacific/Wallis.ts
@@ -0,0 +1,4 @@
+export default {
+ zone_name: 'Pacific/Wallis',
+ gmt_offset: [44120, 43200]
+};
diff --git a/src/transform.ts b/src/transform.ts
new file mode 100644
index 0000000..d3984b8
--- /dev/null
+++ b/src/transform.ts
@@ -0,0 +1,18 @@
+import { parse } from './parse.ts';
+import { format } from './format.ts';
+import { CompiledObject } from './compile.ts';
+import type { ParserOptions } from './parser.ts';
+import type { FormatterOptions } from './formatter.ts';
+
+/**
+ * Transforms a date string from one format to another.
+ * @param dateString - The date string to transform
+ * @param arg1 - The format string or compiled object for parsing
+ * @param arg2 - The format string or compiled object for formatting
+ * @param [options1] - Optional parser options
+ * @param [options2] - Optional formatter options
+ * @returns The transformed date string
+ */
+export function transform(dateString: string, arg1: string | CompiledObject, arg2: string | CompiledObject, options1?: ParserOptions, options2?: FormatterOptions) {
+ return format(parse(dateString, arg1, options1), arg2, options2);
+}
diff --git a/src/utils.ts b/src/utils.ts
new file mode 100644
index 0000000..8281183
--- /dev/null
+++ b/src/utils.ts
@@ -0,0 +1,18 @@
+/**
+ * Determines if the specified year is a leap year.
+ * @param year - The year to check
+ * @returns True if the year is a leap year, false otherwise
+ */
+export const isLeapYear = (year: number) => {
+ return (!(year % 4) && !!(year % 100)) || !(year % 400);
+};
+
+/**
+ * Determines if two dates represent the same calendar day.
+ * @param date1 - The first date to compare
+ * @param date2 - The second date to compare
+ * @returns True if both dates are on the same day, false otherwise
+ */
+export const isSameDay = (date1: Date, date2: Date) => {
+ return date1.toDateString() === date2.toDateString();
+};
diff --git a/src/zonenames.ts b/src/zonenames.ts
new file mode 100644
index 0000000..e1d5478
--- /dev/null
+++ b/src/zonenames.ts
@@ -0,0 +1,250 @@
+/**
+ * @description
+ * This file was generated from the execution result of the `npm run zonename` command.
+ */
+
+export default {
+ 'Acre Standard Time': 'ACT',
+ 'Acre Summer Time': 'ACST',
+ 'Afghanistan Time': 'AFT',
+ 'Alaska Daylight Time': 'AKDT',
+ 'Alaska Standard Time': 'AKST',
+ 'Almaty Standard Time': 'ALMT',
+ 'Almaty Summer Time': 'ALMST',
+ 'Amazon Standard Time': 'AMT',
+ 'Amazon Summer Time': 'AMST',
+ 'American Samoa Standard Time': 'SST',
+ 'Anadyr Standard Time': 'ANAT',
+ 'Anadyr Summer Time': 'ANAST',
+ 'Aqtau Standard Time': 'AQTT',
+ 'Aqtau Summer Time': 'AQTST',
+ 'Aqtobe Standard Time': 'AQTT',
+ 'Aqtobe Summer Time': 'AQTST',
+ 'Arabian Daylight Time': 'ADT',
+ 'Arabian Standard Time': 'AST',
+ 'Argentina Standard Time': 'ART',
+ 'Argentina Summer Time': 'ARST',
+ 'Armenia Standard Time': 'AMT',
+ 'Armenia Summer Time': 'AMST',
+ 'Atlantic Daylight Time': 'ADT',
+ 'Atlantic Standard Time': 'AST',
+ 'Australian Central Daylight Time': 'ACDT',
+ 'Australian Central Standard Time': 'ACST',
+ 'Australian Central Western Daylight Time': 'ACWDT',
+ 'Australian Central Western Standard Time': 'ACWST',
+ 'Australian Eastern Daylight Time': 'AEDT',
+ 'Australian Eastern Standard Time': 'AEST',
+ 'Australian Western Daylight Time': 'AWDT',
+ 'Australian Western Standard Time': 'AWST',
+ 'Azerbaijan Standard Time': 'AZT',
+ 'Azerbaijan Summer Time': 'AZST',
+ 'Azores Standard Time': 'AZOT',
+ 'Azores Summer Time': 'AZOST',
+ 'Bangladesh Standard Time': 'BST',
+ 'Bangladesh Summer Time': 'BDST',
+ 'Bhutan Time': 'BTT',
+ 'Bolivia Time': 'BOT',
+ 'Brasilia Standard Time': 'BRT',
+ 'Brasilia Summer Time': 'BRST',
+ 'British Summer Time': 'BST',
+ 'Brunei Time': 'BNT',
+ 'Cape Verde Standard Time': 'CVT',
+ 'Casey Time': 'CAST',
+ 'Central Africa Time': 'CAT',
+ 'Central Daylight Time': 'CDT',
+ 'Central European Standard Time': 'CET',
+ 'Central European Summer Time': 'CEST',
+ 'Central Indonesia Time': 'WITA',
+ 'Central Standard Time': 'CST',
+ 'Chamorro Standard Time': 'ChST',
+ 'Chatham Daylight Time': 'CHADT',
+ 'Chatham Standard Time': 'CHAST',
+ 'Chile Standard Time': 'CLT',
+ 'Chile Summer Time': 'CLST',
+ 'China Daylight Time': 'CDT',
+ 'China Standard Time': 'CST',
+ 'Christmas Island Time': 'CXT',
+ 'Chuuk Time': 'CHUT',
+ 'Cocos Islands Time': 'CCT',
+ 'Colombia Standard Time': 'COT',
+ 'Colombia Summer Time': 'COST',
+ 'Cook Islands Standard Time': 'CKT',
+ 'Cook Islands Summer Time': 'CKST',
+ 'Coordinated Universal Time': 'UTC',
+ 'Cuba Daylight Time': 'CDT',
+ 'Cuba Standard Time': 'CST',
+ 'Davis Time': 'DAVT',
+ 'Dumont d’Urville Time': 'DDUT',
+ 'East Africa Time': 'EAT',
+ 'East Greenland Standard Time': 'EGT',
+ 'East Greenland Summer Time': 'EGST',
+ 'East Kazakhstan Time': 'ALMT',
+ 'Easter Island Standard Time': 'EAST',
+ 'Easter Island Summer Time': 'EASST',
+ 'Eastern Daylight Time': 'EDT',
+ 'Eastern European Standard Time': 'EET',
+ 'Eastern European Summer Time': 'EEST',
+ 'Eastern Indonesia Time': 'WIT',
+ 'Eastern Standard Time': 'EST',
+ 'Ecuador Time': 'ECT',
+ 'Falkland Islands Standard Time': 'FKST',
+ 'Falkland Islands Summer Time': 'FKST',
+ 'Fernando de Noronha Standard Time': 'FNT',
+ 'Fernando de Noronha Summer Time': 'FNST',
+ 'Fiji Standard Time': 'FJT',
+ 'Fiji Summer Time': 'FJST',
+ 'French Guiana Time': 'GFT',
+ 'French Southern & Antarctic Time': 'TFT',
+ 'Further-eastern European Time': 'FET',
+ 'Galapagos Time': 'GALT',
+ 'Gambier Time': 'GAMT',
+ 'Georgia Standard Time': 'GET',
+ 'Georgia Summer Time': 'GEST',
+ 'Gilbert Islands Time': 'GILT',
+ 'Greenland Standard Time': 'GT',
+ 'Greenland Summer Time': 'GST',
+ 'Greenwich Mean Time': 'GMT',
+ 'Guam Standard Time': 'ChST',
+ 'Gulf Standard Time': 'GST',
+ 'Guyana Time': 'GYT',
+ 'Hawaii-Aleutian Daylight Time': 'HADT',
+ 'Hawaii-Aleutian Standard Time': 'HAST',
+ 'Hong Kong Standard Time': 'HKT',
+ 'Hong Kong Summer Time': 'HKST',
+ 'Hovd Standard Time': 'HOVT',
+ 'Hovd Summer Time': 'HOVST',
+ 'India Standard Time': 'IST',
+ 'Indian Ocean Time': 'IOT',
+ 'Indochina Time': 'ICT',
+ 'Iran Daylight Time': 'IRDT',
+ 'Iran Standard Time': 'IRST',
+ 'Irish Standard Time': 'IST',
+ 'Irkutsk Standard Time': 'IRKT',
+ 'Irkutsk Summer Time': 'IRKST',
+ 'Israel Daylight Time': 'IDT',
+ 'Israel Standard Time': 'IST',
+ 'Japan Standard Time': 'JST',
+ 'Kamchatka Standard Time': 'PETT',
+ 'Kamchatka Summer Time': 'PETST',
+ 'Kazakhstan Time': 'KZT',
+ 'Korean Daylight Time': 'KDT',
+ 'Korean Standard Time': 'KST',
+ 'Kosrae Time': 'KOST',
+ 'Krasnoyarsk Standard Time': 'KRAT',
+ 'Krasnoyarsk Summer Time': 'KRAST',
+ 'Kyrgyzstan Time': 'KGT',
+ 'Lanka Time': 'LKT',
+ 'Line Islands Time': 'LINT',
+ 'Lord Howe Daylight Time': 'LHDT',
+ 'Lord Howe Standard Time': 'LHST',
+ 'Macao Standard Time': 'CST',
+ 'Macao Summer Time': 'CST',
+ 'Magadan Standard Time': 'MAGT',
+ 'Magadan Summer Time': 'MAGST',
+ 'Malaysia Time': 'MYT',
+ 'Maldives Time': 'MVT',
+ 'Marquesas Time': 'MART',
+ 'Marshall Islands Time': 'MHT',
+ 'Mauritius Standard Time': 'MUT',
+ 'Mauritius Summer Time': 'MUST',
+ 'Mawson Time': 'MAWT',
+ 'Mexican Pacific Daylight Time': 'PDT',
+ 'Mexican Pacific Standard Time': 'PST',
+ 'Moscow Standard Time': 'MSK',
+ 'Moscow Summer Time': 'MSD',
+ 'Mountain Daylight Time': 'MDT',
+ 'Mountain Standard Time': 'MST',
+ 'Myanmar Time': 'MMT',
+ 'Nauru Time': 'NRT',
+ 'Nepal Time': 'NPT',
+ 'New Caledonia Standard Time': 'NCT',
+ 'New Caledonia Summer Time': 'NCST',
+ 'New Zealand Daylight Time': 'NZDT',
+ 'New Zealand Standard Time': 'NZST',
+ 'Newfoundland Daylight Time': 'NDT',
+ 'Newfoundland Standard Time': 'NST',
+ 'Niue Time': 'NUT',
+ 'Norfolk Island Daylight Time': 'NFDT',
+ 'Norfolk Island Standard Time': 'NFT',
+ 'North Korea Time': 'KST',
+ 'Northern Mariana Islands Time': 'CHST',
+ 'Novosibirsk Standard Time': 'NOVT',
+ 'Novosibirsk Summer Time': 'NOVST',
+ 'Omsk Standard Time': 'OMST',
+ 'Omsk Summer Time': 'OMSST',
+ 'Pacific Daylight Time': 'PDT',
+ 'Pacific Standard Time': 'PST',
+ 'Pakistan Standard Time': 'PKT',
+ 'Pakistan Summer Time': 'PKST',
+ 'Palau Time': 'PWT',
+ 'Papua New Guinea Time': 'PGT',
+ 'Paraguay Standard Time': 'PYT',
+ 'Paraguay Summer Time': 'PYST',
+ 'Peru Standard Time': 'PET',
+ 'Peru Summer Time': 'PEST',
+ 'Philippine Standard Time': 'PST',
+ 'Philippine Summer Time': 'PHST',
+ 'Phoenix Islands Time': 'PHOT',
+ 'Pitcairn Time': 'PIT',
+ 'Pohnpei Time': 'PONT',
+ 'Qyzylorda Standard Time': 'QYZT',
+ 'Qyzylorda Summer Time': 'QYZST',
+ 'Rothera Time': 'ROTT',
+ 'Réunion Time': 'RET',
+ 'Sakhalin Standard Time': 'SAKT',
+ 'Sakhalin Summer Time': 'SAKST',
+ 'Samara Standard Time': 'SAMT',
+ 'Samara Summer Time': 'SAMST',
+ 'Samoa Daylight Time': 'SDT',
+ 'Samoa Standard Time': 'SST',
+ 'Seychelles Time': 'SCT',
+ 'Singapore Standard Time': 'SGT',
+ 'Solomon Islands Time': 'SBT',
+ 'South Africa Standard Time': 'SAST',
+ 'South Georgia Time': 'GST',
+ 'St. Pierre & Miquelon Daylight Time': 'PMDT',
+ 'St. Pierre & Miquelon Standard Time': 'PMST',
+ 'Suriname Time': 'SRT',
+ 'Syowa Time': 'SYOT',
+ 'Tahiti Time': 'TAHT',
+ 'Taiwan Daylight Time': 'CDT',
+ 'Taiwan Standard Time': 'CST',
+ 'Tajikistan Time': 'TJT',
+ 'Timor-Leste Time': 'TLT',
+ 'Tokelau Time': 'TKT',
+ 'Tonga Standard Time': 'TOT',
+ 'Tonga Summer Time': 'TOST',
+ 'Turkmenistan Standard Time': 'TMT',
+ 'Tuvalu Time': 'TVT',
+ 'Ulaanbaatar Standard Time': 'ULAT',
+ 'Ulaanbaatar Summer Time': 'ULAST',
+ 'Uruguay Standard Time': 'UYT',
+ 'Uruguay Summer Time': 'UYST',
+ 'Uzbekistan Standard Time': 'UZT',
+ 'Uzbekistan Summer Time': 'UZST',
+ 'Vanuatu Standard Time': 'VUT',
+ 'Vanuatu Summer Time': 'VUST',
+ 'Venezuela Time': 'VET',
+ 'Vladivostok Standard Time': 'VLAT',
+ 'Vladivostok Summer Time': 'VLAST',
+ 'Volgograd Standard Time': 'VOLT',
+ 'Volgograd Summer Time': 'VOLST',
+ 'Vostok Time': 'VOST',
+ 'Wake Island Time': 'WAKT',
+ 'Wallis & Futuna Time': 'WFT',
+ 'West Africa Standard Time': 'WAT',
+ 'West Africa Summer Time': 'WAST',
+ 'West Greenland Standard Time': 'WGT',
+ 'West Greenland Summer Time': 'WGST',
+ 'West Kazakhstan Time': 'AQTT',
+ 'Western Argentina Standard Time': 'ART',
+ 'Western Argentina Summer Time': 'ARST',
+ 'Western European Standard Time': 'WET',
+ 'Western European Summer Time': 'WEST',
+ 'Western Indonesia Time': 'WIB',
+ 'Yakutsk Standard Time': 'YAKT',
+ 'Yakutsk Summer Time': 'YAKST',
+ 'Yekaterinburg Standard Time': 'YEKT',
+ 'Yekaterinburg Summer Time': 'YEKST',
+ 'Yukon Time': 'YT'
+};
diff --git a/test.sh b/test.sh
deleted file mode 100755
index 7c6452e..0000000
--- a/test.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh -eu
-
-# Core (Node)
-mocha test/test.js
-# Testing in areas with daylight saving time
-mocha test/dst.js
-
-# Locales (Node CJS)
-mocha test/locale/ar.js
-mocha test/locale/az.js
-mocha test/locale/bn.js
-mocha test/locale/cs.js
-mocha test/locale/de.js
-mocha test/locale/dk.js
-mocha test/locale/el.js
-mocha test/locale/es.js
-mocha test/locale/fa.js
-mocha test/locale/fr.js
-mocha test/locale/hi.js
-mocha test/locale/hu.js
-mocha test/locale/id.js
-mocha test/locale/it.js
-mocha test/locale/ja.js
-mocha test/locale/jv.js
-mocha test/locale/ko.js
-mocha test/locale/my.js
-mocha test/locale/nl.js
-mocha test/locale/pa-in.js
-mocha test/locale/pl.js
-mocha test/locale/pt.js
-mocha test/locale/ro.js
-mocha test/locale/ru.js
-mocha test/locale/rw.js
-mocha test/locale/sr.js
-mocha test/locale/sv.js
-mocha test/locale/th.js
-mocha test/locale/tr.js
-mocha test/locale/uk.js
-mocha test/locale/uz.js
-mocha test/locale/vi.js
-mocha test/locale/zh-cn.js
-mocha test/locale/zh-tw.js
-
-# Plugins (Node CJS)
-mocha test/plugin/day-of-week.js
-mocha test/plugin/meridiem.js
-mocha test/plugin/microsecond.js
-mocha test/plugin/ordinal.js
-mocha test/plugin/timespan.js
-mocha test/plugin/two-digit-year.js
-mocha test/plugin/timezone.js
-
-# Combination (Node CJS)
-mocha test/combination.js
-
-# Locales (Node ESM)
-mocha test/esm/locale/ar.mjs
-mocha test/esm/locale/az.mjs
-mocha test/esm/locale/bn.mjs
-mocha test/esm/locale/cs.mjs
-mocha test/esm/locale/de.mjs
-mocha test/esm/locale/dk.mjs
-mocha test/esm/locale/el.mjs
-mocha test/esm/locale/es.mjs
-mocha test/esm/locale/fa.mjs
-mocha test/esm/locale/fr.mjs
-mocha test/esm/locale/hi.mjs
-mocha test/esm/locale/hu.mjs
-mocha test/esm/locale/id.mjs
-mocha test/esm/locale/it.mjs
-mocha test/esm/locale/ja.mjs
-mocha test/esm/locale/jv.mjs
-mocha test/esm/locale/ko.mjs
-mocha test/esm/locale/my.mjs
-mocha test/esm/locale/nl.mjs
-mocha test/esm/locale/pa-in.mjs
-mocha test/esm/locale/pl.mjs
-mocha test/esm/locale/pt.mjs
-mocha test/esm/locale/ro.mjs
-mocha test/esm/locale/ru.mjs
-mocha test/esm/locale/rw.mjs
-mocha test/esm/locale/sr.mjs
-mocha test/esm/locale/sv.mjs
-mocha test/esm/locale/th.mjs
-mocha test/esm/locale/tr.mjs
-mocha test/esm/locale/uk.mjs
-mocha test/esm/locale/uz.mjs
-mocha test/esm/locale/vi.mjs
-mocha test/esm/locale/zh-cn.mjs
-mocha test/esm/locale/zh-tw.mjs
-
-# Plugins (Node ESM)
-mocha test/esm/plugin/day-of-week.mjs
-mocha test/esm/plugin/meridiem.mjs
-mocha test/esm/plugin/microsecond.mjs
-mocha test/esm/plugin/ordinal.mjs
-mocha test/esm/plugin/timespan.mjs
-mocha test/esm/plugin/two-digit-year.mjs
-mocha test/esm/plugin/timezone.mjs
-
-# Combination (Node ESM)
-mocha test/esm/combination.mjs
diff --git a/test/combination.js b/test/combination.js
deleted file mode 100644
index 7cd35fd..0000000
--- a/test/combination.js
+++ /dev/null
@@ -1,2843 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- en = typeof require === 'function' ? require('date-and-time/locale/en') : 'en',
- es = typeof require === 'function' ? require('date-and-time/locale/es') : 'es',
- ja = typeof require === 'function' ? require('date-and-time/locale/ja') : 'ja';
-
- describe('Change locale and revert, then format', function () {
- before(function () {
- date.locale(ja);
- date.locale(en);
- });
-
- it('"YYYY" equals to "0001"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'YYYY')).to.equal('0001');
- });
- it('"YYYY" equals to "0099"', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.format(now, 'YYYY')).to.equal('0099');
- });
- it('"YYYY" equals to "0100"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('0100');
- });
- it('"YYYY" equals to "1800"', function () {
- var now = new Date(1800, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1800');
- });
- it('"YYYY" equals to "1899"', function () {
- var now = new Date(1899, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1899');
- });
- it('"YYYY" equals to "1900"', function () {
- var now = new Date(1900, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1900');
- });
- it('"YYYY" equals to "1901"', function () {
- var now = new Date(1901, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1901');
- });
- it('"YYYY" equals to "1970"', function () {
- var now = new Date(1970, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1970');
- });
- it('"YYYY" equals to "1999"', function () {
- var now = new Date(1999, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1999');
- });
- it('"YYYY" equals to "2000"', function () {
- var now = new Date(2000, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('2000');
- });
- it('"YYYY" equals to "2001"', function () {
- var now = new Date(2001, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('2001');
- });
- it('"YYYY" equals to "9999"', function () {
- var now = new Date(9999, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('9999');
- });
- it('"YYYY" as UTC equals to "XXXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'YYYY', utc)).to.equal('' + now.getUTCFullYear());
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(101, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(199, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(1900, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(1901, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(1999, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(2000, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(2001, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(2099, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(9900, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(9901, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(9999, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'YY')).to.equal('' + (now.getUTCFullYear() - 2000));
- });
- it('"Y" equals to "1"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'Y')).to.equal('1');
- });
- it('"Y" equals to "10"', function () {
- var now = new Date(0, -1890 * 12, 1);
- expect(date.format(now, 'Y')).to.equal('10');
- });
- it('"Y" equals to "100"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'Y')).to.equal('100');
- });
- it('"Y" equals to "1000"', function () {
- var now = new Date(1000, 0, 1);
- expect(date.format(now, 'Y')).to.equal('1000');
- });
- it('"Y" equals to "10000"', function () {
- var now = new Date(10000, 0, 1);
- expect(date.format(now, 'Y')).to.equal('10000');
- });
- it('"Y" as UTC equals to "X"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'Y')).to.equal('' + (now.getUTCFullYear()));
- });
- it('"MMMM" equals to "January"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal('January');
- });
- it('"MMMM" equals to "December"', function () {
- var now = new Date(2015, 11, 1);
- expect(date.format(now, 'MMMM')).to.equal('December');
- });
- it('"MMM" equals to "Jan"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal('Jan');
- });
- it('"MMM" equals to "Dec"', function () {
- var now = new Date(2015, 11, 1);
- expect(date.format(now, 'MMM')).to.equal('Dec');
- });
- it('"MM" equals to "01"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MM')).to.equal('01');
- });
- it('"MM" equals to "12"', function () {
- var now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MM')).to.equal('12');
- });
- it('"MM" as UTC equals to "XX"', function () {
- var now = new Date(2015, 10, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'MM', utc)).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"M" equals to "1"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('1');
- });
- it('"M" equals to "12"', function () {
- var now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('12');
- });
- it('"M" as UTC equals to "XX"', function () {
- var now = new Date(2015, 10, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"DD" equals to "01"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'DD')).to.equal('01');
- });
- it('"DD" equals to "31"', function () {
- var now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(date.format(now, 'DD')).to.equal('31');
- });
- it('"DD" equals to "XX"', function () {
- var now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'DD', utc)).to.equal('' + now.getUTCDate());
- });
- it('"D" equals to "1"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'D')).to.equal('1');
- });
- it('"D" equals to "31"', function () {
- var now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(date.format(now, 'D')).to.equal('31');
- });
- it('"D" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'D', utc)).to.equal('' + now.getUTCDate());
- });
- it('"dddd" equals to "Tuesday"', function () {
- var now = new Date(2015, 0, 6, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal('Tuesday');
- });
- it('"dddd" equals to "Thursday"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal('Thursday');
- });
- it('"ddd" equals to "Sun"', function () {
- var now = new Date(2015, 0, 4, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal('Sun');
- });
- it('"ddd" equals to "Wed"', function () {
- var now = new Date(2015, 0, 7, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal('Wed');
- });
- it('"dd" equals to "Fr"', function () {
- var now = new Date(2015, 0, 2, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal('Fr');
- });
- it('"dd" equals to "Sa"', function () {
- var now = new Date(2015, 0, 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal('Sa');
- });
- it('"HH" equals to "12"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('12');
- });
- it('"HH" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('00');
- });
- it('"HH" equals to "23"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('23');
- });
- it('"HH" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'HH', utc)).to.equal(('0' + now.getUTCHours()).slice(-2));
- });
- it('"H" equals to "12"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('12');
- });
- it('"H" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('0');
- });
- it('"H" equals to "23"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('23');
- });
- it('"H" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'H', utc)).to.equal('' + now.getUTCHours());
- });
- it('"hh A" equals to "12 PM"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('12 PM');
- });
- it('"hh A" equals to "12 AM"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('12 AM');
- });
- it('"hh A" equals to "11 PM"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('11 PM');
- });
- it('"hh A" equals to "01 AM"', function () {
- var now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('01 AM');
- });
- it('"hh A" equals to "01 PM"', function () {
- var now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('01 PM');
- });
- it('"h A" equals to "12 PM"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('12 PM');
- });
- it('"h A" equals to "12 AM"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('12 AM');
- });
- it('"h A" equals to "11 PM"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('11 PM');
- });
- it('"h A" equals to "1 AM"', function () {
- var now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('1 AM');
- });
- it('"h A" equals to "1 PM"', function () {
- var now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('1 PM');
- });
- it('"mm" equals to "34"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'mm')).to.equal('34');
- });
- it('"mm" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(date.format(now, 'mm')).to.equal('00');
- });
- it('"mm" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(date.format(now, 'mm')).to.equal('59');
- });
- it('"mm" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(date.format(now, 'mm', utc)).to.equal(('0' + now.getUTCMinutes()).slice(-2));
- });
- it('"m" equals to "34"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'm')).to.equal('34');
- });
- it('"m" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(date.format(now, 'm')).to.equal('0');
- });
- it('"m" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(date.format(now, 'm')).to.equal('59');
- });
- it('"m" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(date.format(now, 'm', utc)).to.equal('' + now.getUTCMinutes());
- });
- it('"ss" equals to "56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ss')).to.equal('56');
- });
- it('"ss" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(date.format(now, 'ss')).to.equal('00');
- });
- it('"ss" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(date.format(now, 'ss')).to.equal('59');
- });
- it('"ss" as UTC equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(date.format(now, 'ss', utc)).to.equal(('0' + now.getUTCSeconds()).slice(-2));
- });
- it('"s" equals to "56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 's')).to.equal('56');
- });
- it('"s" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(date.format(now, 's')).to.equal('0');
- });
- it('"s" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(date.format(now, 's')).to.equal('59');
- });
- it('"s" as UTC equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(date.format(now, 's', utc)).to.equal('' + now.getUTCSeconds());
- });
- it('"SSS" equals to "789"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'SSS')).to.equal('789');
- });
- it('"SSS" equals to "000"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'SSS')).to.equal('000');
- });
- it('"SSS" equals to "001"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'SSS')).to.equal('001');
- });
- it('"SSS" as UTC equals to "XXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 10),
- utc = true;
- expect(date.format(now, 'SSS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3));
- });
- it('"SS" equals to "78"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'SS')).to.equal('78');
- });
- it('"SS" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'SS')).to.equal('00');
- });
- it('"SS" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'SS')).to.equal('00');
- });
- it('"SS" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 9),
- utc = true;
- expect(date.format(now, 'SS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 2));
- });
- it('"S" equals to "7"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'S')).to.equal('7');
- });
- it('"S" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "X"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'S', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 1));
- });
- it('"Z" matches "+XXXX/-XXXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'Z')).to.match(/^[+-]\d{4}$/);
- });
- it('"Z" as UTC equals to "+0000"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'Z', utc)).to.equal('+0000');
- });
- it('"ZZ" matches "+XX:XX/-XX:XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ZZ')).to.match(/^[+-]\d{2}:\d{2}$/);
- });
- it('"ZZ" as UTC equals to "+00:00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'ZZ', utc)).to.equal('+00:00');
- });
- it('"ddd MMM DD YYYY HH:mm:ss" equals to "Thu Jan 01 2015 12:34:56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ddd MMM DD YYYY HH:mm:ss')).to.equal('Thu Jan 01 2015 12:34:56');
- });
- it('"YYYY/MM/DD HH:mm:ss.SSS" equals to "1900/01/01 00:00:00.000"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YYYY/MM/DD HH:mm:ss.SSS')).to.equal('1900/01/01 00:00:00.000');
- });
- it('"YY/MM/DD HH:mm:ss.SSS" equals to "00/01/01 00:00:00.000"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YY/MM/DD HH:mm:ss.SSS')).to.equal('00/01/01 00:00:00.000');
- });
- it('"Y/M/D H:m:s.SSS" equals to "999/1/1 0:0:0.000"', function () {
- var now = new Date(999, 0, 1);
- expect(date.format(now, 'Y/M/D H:m:s.SSS')).to.equal('999/1/1 0:0:0.000');
- });
- it('"dddd, MMMM D, YYYY h A" equals to "Saturday, January 1, 2000 10 AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, 'dddd, MMMM D, YYYY h A')).to.equal('Saturday, January 1, 2000 10 AM');
- });
- it('"[dddd, MMMM D, YYYY h A]" equals to "dddd, MMMM D, YYYY h A"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd, MMMM D, YYYY h A]')).to.equal('dddd, MMMM D, YYYY h A');
- });
- it('"[dddd], MMMM [D], YYYY [h] A" equals to "dddd, January D, 2000 h AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd], MMMM [D], YYYY [h] A')).to.equal('dddd, January D, 2000 h AM');
- });
- it('"[[dddd], MMMM [D], YYYY [h] A]" equals to "[dddd], MMMM [D], YYYY [h] A"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[[dddd], MMMM [D], YYYY [h] A]')).to.equal('[dddd], MMMM [D], YYYY [h] A');
- });
- it('"[dddd], MMMM [[D], YYYY] [h] A" equals to "dddd, January [D], YYYY h AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd], MMMM [[D], YYYY] [h] A')).to.equal('dddd, January [D], YYYY h AM');
- });
-
- after(function () {
- date.locale(en);
- });
- });
-
- describe('Change locale and revert, then parse', function () {
- before(function () {
- date.locale(ja);
- date.locale(en);
- });
-
- it('YYYY', function () {
- expect(isNaN(date.parse('0000', 'YYYY'))).to.be(true);
- });
- it('YYYY', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.parse('0001', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.parse('0099', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(100, 0, 1);
- expect(date.parse('0100', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1899, 0, 1);
- expect(date.parse('1899', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1900, 0, 1);
- expect(date.parse('1900', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1969, 0, 1);
- expect(date.parse('1969', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1970, 0, 1);
- expect(date.parse('1970', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1999, 0, 1);
- expect(date.parse('1999', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(2000, 0, 1);
- expect(date.parse('2000', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(9999, 0, 1);
- expect(date.parse('9999', 'YYYY')).to.eql(now);
- });
- it('Y', function () {
- expect(isNaN(date.parse('0', 'Y'))).to.be(true);
- });
- it('Y', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.parse('1', 'Y')).to.eql(now);
- });
- it('Y', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.parse('99', 'Y')).to.eql(now);
- });
- it('Y', function () {
- var now = new Date(100, 0, 1);
- expect(date.parse('100', 'Y')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015 January', 'YYYY MMMM')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015 December', 'YYYY MMMM')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- expect(isNaN(date.parse('2015 Zero', 'YYYY MMMM'))).to.be(true);
- });
- it('YYYY MMM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015 Jan', 'YYYY MMM')).to.eql(now);
- });
- it('YYYY MMM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015 Dec', 'YYYY MMM')).to.eql(now);
- });
- it('YYYY MMM', function () {
- expect(isNaN(date.parse('2015 Zero', 'YYYY MMM'))).to.be(true);
- });
- it('YYYY-MM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-01', 'YYYY-MM')).to.eql(now);
- });
- it('YYYY-MM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015-12', 'YYYY-MM')).to.eql(now);
- });
- it('YYYY-MM', function () {
- expect(isNaN(date.parse('2015-00', 'YYYY-MM'))).to.be(true);
- });
- it('YYYY-M', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-1', 'YYYY-M')).to.eql(now);
- });
- it('YYYY-M', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015-12', 'YYYY-M')).to.eql(now);
- });
- it('YYYY-M', function () {
- expect(isNaN(date.parse('2015-0', 'YYYY-M'))).to.be(true);
- });
- it('YYYY-MM-DD', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-01-01', 'YYYY-MM-DD')).to.eql(now);
- });
- it('YYYY-MM-DD', function () {
- var now = new Date(2015, 11, 31);
- expect(date.parse('2015-12-31', 'YYYY-MM-DD')).to.eql(now);
- });
- it('YYYY-MM-DD', function () {
- expect(isNaN(date.parse('2015-00-00', 'YYYY-MM-DD'))).to.be(true);
- });
- it('YYYY-M-D', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-1-1', 'YYYY-M-D')).to.eql(now);
- });
- it('YYYY-M-D', function () {
- var now = new Date(2015, 11, 31);
- expect(date.parse('2015-12-31', 'YYYY-M-D')).to.eql(now);
- });
- it('YYYY-M-D', function () {
- expect(isNaN(date.parse('2015-0-0', 'YYYY-M-D'))).to.be(true);
- });
- it('YYYY-MM-DD HH', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-01-01 00', 'YYYY-MM-DD HH')).to.eql(now);
- });
- it('YYYY-MM-DD HH', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 23', 'YYYY-MM-DD HH')).to.eql(now);
- });
- it('YYYY-MM-DD HH', function () {
- expect(isNaN(date.parse('2015-00-00 24', 'YYYY-MM-DD HH'))).to.be(true);
- });
- it('YYYY-M-D H', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 0', 'YYYY-M-D H')).to.eql(now);
- });
- it('YYYY-M-D H', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 23', 'YYYY-M-D H')).to.eql(now);
- });
- it('YYYY-M-D H', function () {
- expect(isNaN(date.parse('2015-0-0 24', 'YYYY-M-D H'))).to.be(true);
- });
- it('YYYY-M-D hh A', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 12 AM', 'YYYY-M-D hh A')).to.eql(now);
- });
- it('YYYY-M-D hh A', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 11 PM', 'YYYY-M-D hh A')).to.eql(now);
- });
- it('YYYY-M-D hh A', function () {
- expect(isNaN(date.parse('2015-0-0 12 AM', 'YYYY-M-D hh A'))).to.be(true);
- });
- it('YYYY-M-D h A', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 12 AM', 'YYYY-M-D h A')).to.eql(now);
- });
- it('YYYY-M-D h A', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 11 PM', 'YYYY-M-D h A')).to.eql(now);
- });
- it('YYYY-M-D h A', function () {
- expect(isNaN(date.parse('2015-0-0 12 AM', 'YYYY-M-D h A'))).to.be(true);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-01-01 00:00', 'YYYY-MM-DD HH:mm')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var now = new Date(2015, 11, 31, 23, 59);
- expect(date.parse('2015-12-31 23:59', 'YYYY-MM-DD HH:mm')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm', function () {
- expect(isNaN(date.parse('2015-00-00 24:60', 'YYYY-MM-DD HH:mm'))).to.be(true);
- });
- it('YYYY-M-D H:m', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-1-1 0:0', 'YYYY-M-D H:m')).to.eql(now);
- });
- it('YYYY-M-D H:m', function () {
- var now = new Date(2015, 11, 31, 23, 59);
- expect(date.parse('2015-12-31 23:59', 'YYYY-M-D H:m')).to.eql(now);
- });
- it('YYYY-M-D H:m', function () {
- expect(isNaN(date.parse('2015-0-0 24:60', 'YYYY-M-D H:m'))).to.be(true);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59);
- expect(date.parse('2015-12-31 23:59:59', 'YYYY-MM-DD HH:mm:ss')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- expect(isNaN(date.parse('2015-00-00 24:60:60', 'YYYY-MM-DD HH:mm:ss'))).to.be(true);
- });
- it('YYYY-M-D H:m:s', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-1-1 0:0:0', 'YYYY-M-D H:m:s')).to.eql(now);
- });
- it('YYYY-M-D H:m:s', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59);
- expect(date.parse('2015-12-31 23:59:59', 'YYYY-M-D H:m:s')).to.eql(now);
- });
- it('YYYY-M-D H:m:s', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:60', 'YYYY-M-D H:m:s'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SSS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 999);
- expect(date.parse('2015-12-31 23:59:59.999', 'YYYY-M-D H:m:s.SSS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.000', 'YYYY-M-D H:m:s.SSS'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 990);
- expect(date.parse('2015-12-31 23:59:59.99', 'YYYY-M-D H:m:s.SS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.00', 'YYYY-M-D H:m:s.SS'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.S')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('2015-12-31 23:59:59.9', 'YYYY-M-D H:m:s.S')).to.eql(now);
- });
- it('YYYY M D H m s S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('2015-12-31 23:59:59.9', 'YYYY M D H m s S')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.S', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.0', 'YYYY-M-D H:m:s.S'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
- expect(date.parse('2015-1-1 0:0:0.0 +0000', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
- expect(date.parse('2015-12-31 23:00:59.999 -0059', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
- expect(date.parse('2015-12-31 09:59:59.999 -1200', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- expect(isNaN(date.parse('2015-12-31 09:58:59.999 -1201', 'YYYY-M-D H:m:s.SSS Z'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
- expect(date.parse('2015-12-31 12:00:59.999 +1400', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- expect(isNaN(date.parse('2015-12-31 12:01:59.999 +1401', 'YYYY-M-D H:m:s.SSS Z'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
- expect(date.parse('2015-1-1 0:0:0.0 +00:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
- expect(date.parse('2015-12-31 23:00:59.999 -00:59', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
- expect(date.parse('2015-12-31 09:59:59.999 -12:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- expect(isNaN(date.parse('2015-12-31 09:58:59.999 -12:01', 'YYYY-M-D H:m:s.SSS ZZ'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
- expect(date.parse('2015-12-31 12:00:59.999 +14:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- expect(isNaN(date.parse('2015-12-31 12:01:59.999 +14:01', 'YYYY-M-D H:m:s.SSS ZZ'))).to.be(true);
- });
- it('MMDDHHmmssSSS', function () {
- var now = new Date(1970, 11, 31, 23, 59, 59, 999);
- expect(date.parse('1231235959999', 'MMDDHHmmssSSS')).to.eql(now);
- });
- it('DDHHmmssSSS', function () {
- var now = new Date(1970, 0, 31, 23, 59, 59, 999);
- expect(date.parse('31235959999', 'DDHHmmssSSS')).to.eql(now);
- });
- it('HHmmssSSS', function () {
- var now = new Date(1970, 0, 1, 23, 59, 59, 999);
- expect(date.parse('235959999', 'HHmmssSSS')).to.eql(now);
- });
- it('mmssSSS', function () {
- var now = new Date(1970, 0, 1, 0, 59, 59, 999);
- expect(date.parse('5959999', 'mmssSSS')).to.eql(now);
- });
- it('ssSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 59, 999);
- expect(date.parse('59999', 'ssSSS')).to.eql(now);
- });
- it('SSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 999);
- expect(date.parse('999', 'SSS')).to.eql(now);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+000', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+00', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+0', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('0', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('0000', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('00000', 'Z'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+00:0', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+00:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+0:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('0:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('00:00', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('00:000', 'ZZ'))).to.be(true);
- });
- it('foo', function () {
- expect(isNaN(date.parse('20150101235959', 'foo'))).to.be(true);
- });
- it('bar', function () {
- expect(isNaN(date.parse('20150101235959', 'bar'))).to.be(true);
- });
- it('YYYYMMDD', function () {
- expect(isNaN(date.parse('20150101235959', 'YYYYMMDD'))).to.be(true);
- });
- it('20150101235959', function () {
- expect(isNaN(date.parse('20150101235959', '20150101235959'))).to.be(true);
- });
- it('YYYY?M?D H?m?s?S', function () {
- expect(isNaN(date.parse('2015-12-31 23:59:59.9', 'YYYY?M?D H?m?s?S'))).to.be(true);
- });
- it('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('Y2015M12D31H23m59s59S9', '[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S')).to.eql(now);
- });
- it('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', function () {
- expect(isNaN(date.parse('[Y]2015[M]12[D]31[H]23[m]59[s]59[S]9', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]'))).to.be(true);
- });
- it(' ', function () {
- expect(isNaN(date.parse('20151231235959900', ' '))).to.be(true);
- });
-
- after(function () {
- date.locale(en);
- });
- });
-
- describe('Change locale and revert, then extend', function () {
- before(function () {
- date.locale(ja);
- date.locale(en);
- });
-
- it('getting current locale', function () {
- expect(date.locale()).to.equal('en');
- });
- it('changing default meridiem', function () {
- date.extend({ res: { A: ['am', 'pm'] } });
- expect(date.format(new Date(2012, 0, 1, 12), 'h A')).to.not.equal('12 pm');
- });
- it('extending default meridiem', function () {
- date.extend({
- res: {
- a: ['am', 'pm']
- },
- formatter: {
- a: function (d) {
- return this.res.a[d.getHours() > 11 | 0];
- }
- }
- });
- expect(date.format(new Date(2012, 0, 1, 12), 'h a')).to.equal('12 pm');
- });
-
- after(function () {
- date.locale(en);
- });
- });
-
- var forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
- MMM = ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'],
- dddd = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
- ddd = ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'],
- dd = ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
- A = ['de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', // 0 - 11
- 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', // 12 - 18
- 'de la noche', 'de la noche', 'de la noche', 'de la noche', 'de la noche']; // 19 - 23
-
- describe('Change the local to ja, then es, then format', function () {
- before(function () {
- date.locale(ja);
- date.locale(es);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(en);
- });
- });
-
- describe('Change the locale to ja, then es, then parse', function () {
- before(function () {
- date.locale(ja);
- date.locale(es);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(en);
- });
- });
-
- var day_of_week = 'day-of-week';
- var meridiem = 'meridiem';
- var microsecond = 'microsecond';
- var ordinal = 'ordinal';
- var timespan = 'timespan';
- var timezone = 'timezone';
- var two_digit_year = 'two-digit-year';
-
- if (typeof require === 'function') {
- day_of_week = require('date-and-time/plugin/day-of-week');
- meridiem = require('date-and-time/plugin/meridiem');
- microsecond = require('date-and-time/plugin/microsecond');
- ordinal = require('date-and-time/plugin/ordinal');
- timespan = require('date-and-time/plugin/timespan');
- timezone = require('date-and-time/plugin/timezone');
- two_digit_year = require('date-and-time/plugin/two-digit-year');
- }
-
- describe('Install multiple plugins, then format', function () {
- before(function () {
- date.plugin(day_of_week);
- date.plugin(meridiem);
- date.plugin(microsecond);
- date.plugin(ordinal);
- date.plugin(timespan);
- date.plugin(timezone);
- date.plugin(two_digit_year);
- });
-
- it('"YYYY" equals to "0001"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'YYYY')).to.equal('0001');
- });
- it('"YYYY" equals to "0099"', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.format(now, 'YYYY')).to.equal('0099');
- });
- it('"YYYY" equals to "0100"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('0100');
- });
- it('"YYYY" equals to "1800"', function () {
- var now = new Date(1800, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1800');
- });
- it('"YYYY" equals to "1899"', function () {
- var now = new Date(1899, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1899');
- });
- it('"YYYY" equals to "1900"', function () {
- var now = new Date(1900, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1900');
- });
- it('"YYYY" equals to "1901"', function () {
- var now = new Date(1901, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1901');
- });
- it('"YYYY" equals to "1970"', function () {
- var now = new Date(1970, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1970');
- });
- it('"YYYY" equals to "1999"', function () {
- var now = new Date(1999, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1999');
- });
- it('"YYYY" equals to "2000"', function () {
- var now = new Date(2000, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('2000');
- });
- it('"YYYY" equals to "2001"', function () {
- var now = new Date(2001, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('2001');
- });
- it('"YYYY" equals to "9999"', function () {
- var now = new Date(9999, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('9999');
- });
- it('"YYYY" as UTC equals to "XXXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'YYYY', utc)).to.equal('' + now.getUTCFullYear());
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(101, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(199, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(1900, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(1901, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(1999, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(2000, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(2001, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(2099, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(9900, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(9901, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(9999, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'YY')).to.equal('' + (now.getUTCFullYear() - 2000));
- });
- it('"Y" equals to "1"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'Y')).to.equal('1');
- });
- it('"Y" equals to "10"', function () {
- var now = new Date(0, -1890 * 12, 1);
- expect(date.format(now, 'Y')).to.equal('10');
- });
- it('"Y" equals to "100"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'Y')).to.equal('100');
- });
- it('"Y" equals to "1000"', function () {
- var now = new Date(1000, 0, 1);
- expect(date.format(now, 'Y')).to.equal('1000');
- });
- it('"Y" equals to "10000"', function () {
- var now = new Date(10000, 0, 1);
- expect(date.format(now, 'Y')).to.equal('10000');
- });
- it('"Y" as UTC equals to "X"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'Y')).to.equal('' + (now.getUTCFullYear()));
- });
- it('"MMMM" equals to "January"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal('January');
- });
- it('"MMMM" equals to "December"', function () {
- var now = new Date(2015, 11, 1);
- expect(date.format(now, 'MMMM')).to.equal('December');
- });
- it('"MMM" equals to "Jan"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal('Jan');
- });
- it('"MMM" equals to "Dec"', function () {
- var now = new Date(2015, 11, 1);
- expect(date.format(now, 'MMM')).to.equal('Dec');
- });
- it('"MM" equals to "01"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MM')).to.equal('01');
- });
- it('"MM" equals to "12"', function () {
- var now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MM')).to.equal('12');
- });
- it('"MM" as UTC equals to "XX"', function () {
- var now = new Date(2015, 10, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'MM', utc)).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"M" equals to "1"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('1');
- });
- it('"M" equals to "12"', function () {
- var now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('12');
- });
- it('"M" as UTC equals to "XX"', function () {
- var now = new Date(2015, 10, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"DD" equals to "01"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'DD')).to.equal('01');
- });
- it('"DD" equals to "31"', function () {
- var now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(date.format(now, 'DD')).to.equal('31');
- });
- it('"DD" equals to "XX"', function () {
- var now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'DD', utc)).to.equal('' + now.getUTCDate());
- });
- it('"D" equals to "1"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'D')).to.equal('1');
- });
- it('"D" equals to "31"', function () {
- var now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(date.format(now, 'D')).to.equal('31');
- });
- it('"D" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'D', utc)).to.equal('' + now.getUTCDate());
- });
- it('"dddd" equals to "Tuesday"', function () {
- var now = new Date(2015, 0, 6, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal('Tuesday');
- });
- it('"dddd" equals to "Thursday"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal('Thursday');
- });
- it('"ddd" equals to "Sun"', function () {
- var now = new Date(2015, 0, 4, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal('Sun');
- });
- it('"ddd" equals to "Wed"', function () {
- var now = new Date(2015, 0, 7, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal('Wed');
- });
- it('"dd" equals to "Fr"', function () {
- var now = new Date(2015, 0, 2, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal('Fr');
- });
- it('"dd" equals to "Sa"', function () {
- var now = new Date(2015, 0, 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal('Sa');
- });
- it('"HH" equals to "12"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('12');
- });
- it('"HH" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('00');
- });
- it('"HH" equals to "23"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('23');
- });
- it('"HH" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'HH', utc)).to.equal(('0' + now.getUTCHours()).slice(-2));
- });
- it('"H" equals to "12"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('12');
- });
- it('"H" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('0');
- });
- it('"H" equals to "23"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('23');
- });
- it('"H" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'H', utc)).to.equal('' + now.getUTCHours());
- });
- it('"hh A" equals to "12 PM"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('12 PM');
- });
- it('"hh A" equals to "12 AM"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('12 AM');
- });
- it('"hh A" equals to "11 PM"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('11 PM');
- });
- it('"hh A" equals to "01 AM"', function () {
- var now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('01 AM');
- });
- it('"hh A" equals to "01 PM"', function () {
- var now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('01 PM');
- });
- it('"h A" equals to "12 PM"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('12 PM');
- });
- it('"h A" equals to "12 AM"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('12 AM');
- });
- it('"h A" equals to "11 PM"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('11 PM');
- });
- it('"h A" equals to "1 AM"', function () {
- var now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('1 AM');
- });
- it('"h A" equals to "1 PM"', function () {
- var now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('1 PM');
- });
- it('"mm" equals to "34"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'mm')).to.equal('34');
- });
- it('"mm" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(date.format(now, 'mm')).to.equal('00');
- });
- it('"mm" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(date.format(now, 'mm')).to.equal('59');
- });
- it('"mm" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(date.format(now, 'mm', utc)).to.equal(('0' + now.getUTCMinutes()).slice(-2));
- });
- it('"m" equals to "34"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'm')).to.equal('34');
- });
- it('"m" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(date.format(now, 'm')).to.equal('0');
- });
- it('"m" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(date.format(now, 'm')).to.equal('59');
- });
- it('"m" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(date.format(now, 'm', utc)).to.equal('' + now.getUTCMinutes());
- });
- it('"ss" equals to "56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ss')).to.equal('56');
- });
- it('"ss" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(date.format(now, 'ss')).to.equal('00');
- });
- it('"ss" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(date.format(now, 'ss')).to.equal('59');
- });
- it('"ss" as UTC equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(date.format(now, 'ss', utc)).to.equal(('0' + now.getUTCSeconds()).slice(-2));
- });
- it('"s" equals to "56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 's')).to.equal('56');
- });
- it('"s" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(date.format(now, 's')).to.equal('0');
- });
- it('"s" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(date.format(now, 's')).to.equal('59');
- });
- it('"s" as UTC equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(date.format(now, 's', utc)).to.equal('' + now.getUTCSeconds());
- });
- it('"SSS" equals to "789"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'SSS')).to.equal('789');
- });
- it('"SSS" equals to "000"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'SSS')).to.equal('000');
- });
- it('"SSS" equals to "001"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'SSS')).to.equal('001');
- });
- it('"SSS" as UTC equals to "XXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 10),
- utc = true;
- expect(date.format(now, 'SSS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3));
- });
- it('"SS" equals to "78"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'SS')).to.equal('78');
- });
- it('"SS" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'SS')).to.equal('00');
- });
- it('"SS" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'SS')).to.equal('00');
- });
- it('"SS" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 9),
- utc = true;
- expect(date.format(now, 'SS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 2));
- });
- it('"S" equals to "7"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'S')).to.equal('7');
- });
- it('"S" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "X"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'S', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 1));
- });
- it('"Z" matches "+XXXX/-XXXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'Z')).to.match(/^[+-]\d{4}$/);
- });
- it('"Z" as UTC equals to "+0000"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'Z', utc)).to.equal('+0000');
- });
- it('"ZZ" matches "+XX:XX/-XX:XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ZZ')).to.match(/^[+-]\d{2}:\d{2}$/);
- });
- it('"ZZ" as UTC equals to "+00:00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'ZZ', utc)).to.equal('+00:00');
- });
- it('"ddd MMM DD YYYY HH:mm:ss" equals to "Thu Jan 01 2015 12:34:56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ddd MMM DD YYYY HH:mm:ss')).to.equal('Thu Jan 01 2015 12:34:56');
- });
- it('"YYYY/MM/DD HH:mm:ss.SSS" equals to "1900/01/01 00:00:00.000"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YYYY/MM/DD HH:mm:ss.SSS')).to.equal('1900/01/01 00:00:00.000');
- });
- it('"YY/MM/DD HH:mm:ss.SSS" equals to "00/01/01 00:00:00.000"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YY/MM/DD HH:mm:ss.SSS')).to.equal('00/01/01 00:00:00.000');
- });
- it('"Y/M/D H:m:s.SSS" equals to "999/1/1 0:0:0.000"', function () {
- var now = new Date(999, 0, 1);
- expect(date.format(now, 'Y/M/D H:m:s.SSS')).to.equal('999/1/1 0:0:0.000');
- });
- it('"dddd, MMMM D, YYYY h A" equals to "Saturday, January 1, 2000 10 AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, 'dddd, MMMM D, YYYY h A')).to.equal('Saturday, January 1, 2000 10 AM');
- });
- it('"[dddd, MMMM D, YYYY h A]" equals to "dddd, MMMM D, YYYY h A"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd, MMMM D, YYYY h A]')).to.equal('dddd, MMMM D, YYYY h A');
- });
- it('"[dddd], MMMM [D], YYYY [h] A" equals to "dddd, January D, 2000 h AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd], MMMM [D], YYYY [h] A')).to.equal('dddd, January D, 2000 h AM');
- });
- it('"[[dddd], MMMM [D], YYYY [h] A]" equals to "[dddd], MMMM [D], YYYY [h] A"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[[dddd], MMMM [D], YYYY [h] A]')).to.equal('[dddd], MMMM [D], YYYY [h] A');
- });
- it('"[dddd], MMMM [[D], YYYY] [h] A" equals to "dddd, January [D], YYYY h AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd], MMMM [[D], YYYY] [h] A')).to.equal('dddd, January [D], YYYY h AM');
- });
- });
-
- describe('Install multiple plugins, then parse', function () {
- before(function () {
- date.plugin(day_of_week);
- date.plugin(meridiem);
- date.plugin(microsecond);
- date.plugin(ordinal);
- date.plugin(timespan);
- date.plugin(timezone);
- date.plugin(two_digit_year);
- });
-
- it('YYYY', function () {
- expect(isNaN(date.parse('0000', 'YYYY'))).to.be(true);
- });
- it('YYYY', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.parse('0001', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.parse('0099', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(100, 0, 1);
- expect(date.parse('0100', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1899, 0, 1);
- expect(date.parse('1899', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1900, 0, 1);
- expect(date.parse('1900', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1969, 0, 1);
- expect(date.parse('1969', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1970, 0, 1);
- expect(date.parse('1970', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1999, 0, 1);
- expect(date.parse('1999', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(2000, 0, 1);
- expect(date.parse('2000', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(9999, 0, 1);
- expect(date.parse('9999', 'YYYY')).to.eql(now);
- });
- it('Y', function () {
- expect(isNaN(date.parse('0', 'Y'))).to.be(true);
- });
- it('Y', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.parse('1', 'Y')).to.eql(now);
- });
- it('Y', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.parse('99', 'Y')).to.eql(now);
- });
- it('Y', function () {
- var now = new Date(100, 0, 1);
- expect(date.parse('100', 'Y')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015 January', 'YYYY MMMM')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015 December', 'YYYY MMMM')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- expect(isNaN(date.parse('2015 Zero', 'YYYY MMMM'))).to.be(true);
- });
- it('YYYY MMM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015 Jan', 'YYYY MMM')).to.eql(now);
- });
- it('YYYY MMM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015 Dec', 'YYYY MMM')).to.eql(now);
- });
- it('YYYY MMM', function () {
- expect(isNaN(date.parse('2015 Zero', 'YYYY MMM'))).to.be(true);
- });
- it('YYYY-MM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-01', 'YYYY-MM')).to.eql(now);
- });
- it('YYYY-MM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015-12', 'YYYY-MM')).to.eql(now);
- });
- it('YYYY-MM', function () {
- expect(isNaN(date.parse('2015-00', 'YYYY-MM'))).to.be(true);
- });
- it('YYYY-M', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-1', 'YYYY-M')).to.eql(now);
- });
- it('YYYY-M', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015-12', 'YYYY-M')).to.eql(now);
- });
- it('YYYY-M', function () {
- expect(isNaN(date.parse('2015-0', 'YYYY-M'))).to.be(true);
- });
- it('YYYY-MM-DD', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-01-01', 'YYYY-MM-DD')).to.eql(now);
- });
- it('YYYY-MM-DD', function () {
- var now = new Date(2015, 11, 31);
- expect(date.parse('2015-12-31', 'YYYY-MM-DD')).to.eql(now);
- });
- it('YYYY-MM-DD', function () {
- expect(isNaN(date.parse('2015-00-00', 'YYYY-MM-DD'))).to.be(true);
- });
- it('YYYY-M-D', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-1-1', 'YYYY-M-D')).to.eql(now);
- });
- it('YYYY-M-D', function () {
- var now = new Date(2015, 11, 31);
- expect(date.parse('2015-12-31', 'YYYY-M-D')).to.eql(now);
- });
- it('YYYY-M-D', function () {
- expect(isNaN(date.parse('2015-0-0', 'YYYY-M-D'))).to.be(true);
- });
- it('YYYY-MM-DD HH', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-01-01 00', 'YYYY-MM-DD HH')).to.eql(now);
- });
- it('YYYY-MM-DD HH', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 23', 'YYYY-MM-DD HH')).to.eql(now);
- });
- it('YYYY-MM-DD HH', function () {
- expect(isNaN(date.parse('2015-00-00 24', 'YYYY-MM-DD HH'))).to.be(true);
- });
- it('YYYY-M-D H', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 0', 'YYYY-M-D H')).to.eql(now);
- });
- it('YYYY-M-D H', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 23', 'YYYY-M-D H')).to.eql(now);
- });
- it('YYYY-M-D H', function () {
- expect(isNaN(date.parse('2015-0-0 24', 'YYYY-M-D H'))).to.be(true);
- });
- it('YYYY-M-D hh A', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 12 AM', 'YYYY-M-D hh A')).to.eql(now);
- });
- it('YYYY-M-D hh A', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 11 PM', 'YYYY-M-D hh A')).to.eql(now);
- });
- it('YYYY-M-D hh A', function () {
- expect(isNaN(date.parse('2015-0-0 12 AM', 'YYYY-M-D hh A'))).to.be(true);
- });
- it('YYYY-M-D h A', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 12 AM', 'YYYY-M-D h A')).to.eql(now);
- });
- it('YYYY-M-D h A', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 11 PM', 'YYYY-M-D h A')).to.eql(now);
- });
- it('YYYY-M-D h A', function () {
- expect(isNaN(date.parse('2015-0-0 12 AM', 'YYYY-M-D h A'))).to.be(true);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-01-01 00:00', 'YYYY-MM-DD HH:mm')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var now = new Date(2015, 11, 31, 23, 59);
- expect(date.parse('2015-12-31 23:59', 'YYYY-MM-DD HH:mm')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm', function () {
- expect(isNaN(date.parse('2015-00-00 24:60', 'YYYY-MM-DD HH:mm'))).to.be(true);
- });
- it('YYYY-M-D H:m', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-1-1 0:0', 'YYYY-M-D H:m')).to.eql(now);
- });
- it('YYYY-M-D H:m', function () {
- var now = new Date(2015, 11, 31, 23, 59);
- expect(date.parse('2015-12-31 23:59', 'YYYY-M-D H:m')).to.eql(now);
- });
- it('YYYY-M-D H:m', function () {
- expect(isNaN(date.parse('2015-0-0 24:60', 'YYYY-M-D H:m'))).to.be(true);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59);
- expect(date.parse('2015-12-31 23:59:59', 'YYYY-MM-DD HH:mm:ss')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- expect(isNaN(date.parse('2015-00-00 24:60:60', 'YYYY-MM-DD HH:mm:ss'))).to.be(true);
- });
- it('YYYY-M-D H:m:s', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-1-1 0:0:0', 'YYYY-M-D H:m:s')).to.eql(now);
- });
- it('YYYY-M-D H:m:s', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59);
- expect(date.parse('2015-12-31 23:59:59', 'YYYY-M-D H:m:s')).to.eql(now);
- });
- it('YYYY-M-D H:m:s', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:60', 'YYYY-M-D H:m:s'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SSS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 999);
- expect(date.parse('2015-12-31 23:59:59.999', 'YYYY-M-D H:m:s.SSS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.000', 'YYYY-M-D H:m:s.SSS'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 990);
- expect(date.parse('2015-12-31 23:59:59.99', 'YYYY-M-D H:m:s.SS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.00', 'YYYY-M-D H:m:s.SS'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.S')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('2015-12-31 23:59:59.9', 'YYYY-M-D H:m:s.S')).to.eql(now);
- });
- it('YYYY M D H m s S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('2015-12-31 23:59:59.9', 'YYYY M D H m s S')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.S', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.0', 'YYYY-M-D H:m:s.S'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
- expect(date.parse('2015-1-1 0:0:0.0 +0000', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
- expect(date.parse('2015-12-31 23:00:59.999 -0059', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
- expect(date.parse('2015-12-31 09:59:59.999 -1200', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- expect(isNaN(date.parse('2015-12-31 09:58:59.999 -1201', 'YYYY-M-D H:m:s.SSS Z'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
- expect(date.parse('2015-12-31 12:00:59.999 +1400', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- expect(isNaN(date.parse('2015-12-31 12:01:59.999 +1401', 'YYYY-M-D H:m:s.SSS Z'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
- expect(date.parse('2015-1-1 0:0:0.0 +00:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
- expect(date.parse('2015-12-31 23:00:59.999 -00:59', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
- expect(date.parse('2015-12-31 09:59:59.999 -12:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- expect(isNaN(date.parse('2015-12-31 09:58:59.999 -12:01', 'YYYY-M-D H:m:s.SSS ZZ'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
- expect(date.parse('2015-12-31 12:00:59.999 +14:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- expect(isNaN(date.parse('2015-12-31 12:01:59.999 +14:01', 'YYYY-M-D H:m:s.SSS ZZ'))).to.be(true);
- });
- it('MMDDHHmmssSSS', function () {
- var now = new Date(1970, 11, 31, 23, 59, 59, 999);
- expect(date.parse('1231235959999', 'MMDDHHmmssSSS')).to.eql(now);
- });
- it('DDHHmmssSSS', function () {
- var now = new Date(1970, 0, 31, 23, 59, 59, 999);
- expect(date.parse('31235959999', 'DDHHmmssSSS')).to.eql(now);
- });
- it('HHmmssSSS', function () {
- var now = new Date(1970, 0, 1, 23, 59, 59, 999);
- expect(date.parse('235959999', 'HHmmssSSS')).to.eql(now);
- });
- it('mmssSSS', function () {
- var now = new Date(1970, 0, 1, 0, 59, 59, 999);
- expect(date.parse('5959999', 'mmssSSS')).to.eql(now);
- });
- it('ssSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 59, 999);
- expect(date.parse('59999', 'ssSSS')).to.eql(now);
- });
- it('SSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 999);
- expect(date.parse('999', 'SSS')).to.eql(now);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+000', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+00', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+0', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('0', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('0000', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('00000', 'Z'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+00:0', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+00:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+0:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('0:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('00:00', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('00:000', 'ZZ'))).to.be(true);
- });
- it('foo', function () {
- expect(isNaN(date.parse('20150101235959', 'foo'))).to.be(true);
- });
- it('bar', function () {
- expect(isNaN(date.parse('20150101235959', 'bar'))).to.be(true);
- });
- it('YYYYMMDD', function () {
- expect(isNaN(date.parse('20150101235959', 'YYYYMMDD'))).to.be(true);
- });
- it('20150101235959', function () {
- expect(isNaN(date.parse('20150101235959', '20150101235959'))).to.be(true);
- });
- it('YYYY?M?D H?m?s?S', function () {
- expect(isNaN(date.parse('2015-12-31 23:59:59.9', 'YYYY?M?D H?m?s?S'))).to.be(true);
- });
- it('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('Y2015M12D31H23m59s59S9', '[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S')).to.eql(now);
- });
- it('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', function () {
- expect(isNaN(date.parse('[Y]2015[M]12[D]31[H]23[m]59[s]59[S]9', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]'))).to.be(true);
- });
- it(' ', function () {
- expect(isNaN(date.parse('20151231235959900', ' '))).to.be(true);
- });
- });
-
- describe('Install multiple plugins, then extend', function () {
- before(function () {
- date.plugin(day_of_week);
- date.plugin(meridiem);
- date.plugin(microsecond);
- date.plugin(ordinal);
- date.plugin(timespan);
- date.plugin(timezone);
- date.plugin(two_digit_year);
- });
-
- it('getting current locale', function () {
- expect(date.locale()).to.equal('en');
- });
- it('changing default meridiem', function () {
- date.extend({ res: { A: ['am', 'pm'] } });
- expect(date.format(new Date(2012, 0, 1, 12), 'h A')).to.not.equal('12 pm');
- });
- it('extending default meridiem', function () {
- date.extend({
- res: {
- a: ['am', 'pm']
- },
- formatter: {
- a: function (d) {
- return this.res.a[d.getHours() > 11 | 0];
- }
- }
- });
- expect(date.format(new Date(2012, 0, 1, 12), 'h a')).to.equal('12 pm');
- });
- });
-
- var AA = ['A.M.', 'P.M.'],
- a = ['am', 'pm'],
- aa = ['a.m.', 'p.m.'];
-
- A = ['AM', 'PM'];
-
- describe('Multiple locale changes and multiple plugin installations', function () {
- before(function () {
- date.locale(es);
- date.plugin(day_of_week);
- date.plugin(meridiem);
- date.plugin(microsecond);
- date.plugin(ordinal);
- date.plugin(timespan);
- date.plugin(timezone);
- date.plugin(two_digit_year);
- date.locale(en);
- });
-
- // day of week
-
- it('dd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Fr', 'dd')).to.eql(now);
- });
- it('ddd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Fri', 'ddd')).to.eql(now);
- });
- it('dddd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Friday', 'dddd')).to.eql(now);
- });
-
- // meridiem
-
- it('A, ante meridiem', function () {
- var now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(A[0]);
- });
- it('A, post meridiem', function () {
- var now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(A[1]);
- });
- it('a, ante meridiem', function () {
- var now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'a')).to.equal(a[0]);
- });
- it('a, post meridiem', function () {
- var now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'a')).to.equal(a[1]);
- });
- it('AA, ante meridiem', function () {
- var now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'AA')).to.equal(AA[0]);
- });
- it('AA, post meridiem', function () {
- var now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'AA')).to.equal(AA[1]);
- });
- it('aa, ante meridiem', function () {
- var now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'aa')).to.equal(aa[0]);
- });
- it('aa, post meridiem', function () {
- var now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'aa')).to.equal(aa[1]);
- });
- it('parse a.m.', function () {
- var now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 a.m.', 'hh:mm aa')).to.eql(now);
- });
- it('parse p.m.', function () {
- var now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 p.m.', 'hh:mm aa')).to.eql(now);
- });
- it('parse A.M.', function () {
- var now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 A.M.', 'hh:mm AA')).to.eql(now);
- });
- it('parse P.M.', function () {
- var now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 P.M.', 'hh:mm AA')).to.eql(now);
- });
- it('parse AM', function () {
- var now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 AM', 'hh:mm A')).to.eql(now);
- });
- it('parse PM', function () {
- var now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 PM', 'hh:mm A')).to.eql(now);
- });
- it('parse am', function () {
- var now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 am', 'hh:mm a')).to.eql(now);
- });
- it('parse pm', function () {
- var now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 pm', 'hh:mm a')).to.eql(now);
- });
-
- // microsecond
-
- it('SSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 123);
- expect(date.parse('0.1234', '0.SSSS')).to.eql(now);
- });
- it('SSSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 12);
- expect(date.parse('0.01234', '0.SSSSS')).to.eql(now);
- });
- it('SSSSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 1);
- expect(date.parse('0.001234', '0.SSSSSS')).to.eql(now);
- });
-
- // ordinal number
-
- it('Jan. XX, 2019', function () {
- for (var i = 1, d, now; i <= 31; i++) {
- now = new Date(2019, 0, i, 12, 34, 56, 789);
- switch (i) {
- case 1:
- case 21:
- case 31:
- d = i + 'st';
- break;
- case 2:
- case 22:
- d = i + 'nd';
- break;
- case 3:
- case 23:
- d = i + 'rd';
- break;
- default:
- d = i + 'th';
- break;
- }
- expect(date.format(now, 'MMM. DDD, YYYY')).to.equal('Jan. ' + d + ', 2019');
- }
- });
-
- // timespan
-
- it('toMilliseconds, S', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('S')).to.equal('1');
- });
- it('toMilliseconds, SS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('SS')).to.equal('01');
- });
- it('toMilliseconds, SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('001');
- });
- it('toMilliseconds, over SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('' + 31 * 24 * 60 * 60 * 1000);
- });
- it('toMilliseconds, over SSS, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('-' + 31 * 24 * 60 * 60 * 1000);
- });
- it('toSeconds, s', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toSeconds('s')).to.equal('0');
- });
- it('toSeconds, ss', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('00');
- });
- it('toSeconds, over ss', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('' + 31 * 24 * 60 * 60);
- });
- it('toSeconds, over ss, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('-' + 31 * 24 * 60 * 60);
- });
- it('toSeconds, over ss.SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 57, 790);
- expect(date.timeSpan(to, from).toSeconds('ss.SSS')).to.equal('01.001');
- });
- it('toSeconds, over ss.SSS, negative', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 790);
- var to = new Date(2019, 0, 1, 0, 34, 55, 789);
- expect(date.timeSpan(to, from).toSeconds('ss.SSS')).to.equal('-01.001');
- });
- it('toMinutes, m', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMinutes('m')).to.equal('0');
- });
- it('toMinutes, mm', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('00');
- });
- it('toMinutes, over mm', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('' + 31 * 24 * 60);
- });
- it('toMinutes, over mm, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('-' + 31 * 24 * 60);
- });
- it('toMinutes, over mm:ss.SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 35, 57, 790);
- expect(date.timeSpan(to, from).toMinutes('mm:ss.SSS')).to.equal('01:01.001');
- });
- it('toMinutes, over mm:ss.SSS, negative', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 790);
- var to = new Date(2019, 0, 1, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toMinutes('mm:ss.SSS')).to.equal('-01:01.001');
- });
- it('toHours, H', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toHours('H')).to.equal('0');
- });
- it('toHours, HH', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('00');
- });
- it('toHours, over HH', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('' + 31 * 24);
- });
- it('toHours, over HH, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('-' + 31 * 24);
- });
- it('toHours, over HH:mm:ss.SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 1, 35, 57, 790);
- expect(date.timeSpan(to, from).toHours('HH:mm:ss.SSS')).to.equal('01:01:01.001');
- });
- it('toHours, over HH:mm:ss.SSS, negative', function () {
- var from = new Date(2019, 0, 1, 1, 34, 56, 790);
- var to = new Date(2019, 0, 1, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toHours('HH:mm:ss.SSS')).to.equal('-01:01:01.001');
- });
- it('toDays, D', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toDays('D')).to.equal('0');
- });
- it('toDays, DD', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('00');
- });
- it('toDays, over DD', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('' + 31);
- });
- it('toDays, over DD, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('-' + 31);
- });
- it('toDays, over DD HH:mm:ss.SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 2, 1, 35, 57, 790);
- expect(date.timeSpan(to, from).toDays('DD HH:mm:ss.SSS')).to.equal('01 01:01:01.001');
- });
- it('toDays, over DD HH:mm:ss.SSS, negative', function () {
- var from = new Date(2019, 0, 1, 1, 34, 56, 790);
- var to = new Date(2019, 0, 0, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toDays('DD HH:mm:ss.SSS')).to.equal('-01 01:01:01.001');
- });
- it('comments', function () {
- var from = new Date(2019, 0, 1, 1, 34, 56, 790);
- var to = new Date(2019, 0, 0, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toDays('[DD HH:mm:ss.SSS]')).to.equal('DD HH:mm:ss.SSS');
- });
-
- // timezone
-
- it('formatTZ UTC-8', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 UTC-0800');
- });
- it('formatTZ UTC-7 (Start of DST)', function () {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 3:00:00.000 UTC-0700');
- });
- it('formatTZ UTC-7 (End of DST)', function () {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:59:59.999 UTC-0700');
- });
- it('formatTZ UTC-8', function () {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:00:00.000 UTC-0800');
- });
- it('formatTZ UTC+9', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 18:59:59.999 UTC+0900');
- });
-
- it('parseTZ UTC-8', function () {
- // Mar 14 2021 1:59:59.999 => 2021-03-14T09:59:59.999Z
- var dateString = 'Mar 14 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Edge case1', function () {
- // Mar 14 2021 2:00:00.000 => 2021-03-14T10:00:00.000Z
- var dateString = 'Mar 14 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles';
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Edge case2', function () {
- // Mar 14 2021 2:59:59.999 => 2021-03-14T10:59:59.999Z
- var dateString = 'Mar 14 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles';
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-7 (Start of DST)', function () {
- // Mar 14 2021 3:00:00.000 => 2021-03-14T10:00:00.000Z
- var dateString = 'Mar 14 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-7 (End of DST)', function () {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T08:59:59.999Z
- var dateString = 'Nov 7 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-8 with Z', function () {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T09:59:59.999Z
- var dateString = 'Nov 7 2021 1:59:59.999 -0800';
- var formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-8', function () {
- // Nov 7 2021 2:00:00.000 => 2021-11-07T10:00:00.000Z
- var dateString = 'Nov 7 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 10, 7, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5', function () {
- // Oct 3 2021 1:59:59.999 => 2021-10-02T16:29:59.999Z
- var dateString = 'Oct 3 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Edge case1', function () {
- // Oct 3 2021 2:00:00.000 => 2021-10-02T16:30:00.000Z
- var dateString = 'Oct 3 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide';
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Edge case2', function () {
- // Oct 3 2021 2:59:59.999 => 2021-10-02T17:29:59.999Z
- var dateString = 'Oct 3 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide';
- var dateObj = new Date(Date.UTC(2021, 9, 2, 17, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+10.5 (Start of DST)', function () {
- // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
- var dateString = 'Oct 3 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+10.5 DST
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+10.5 (End of DST)', function () {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T16:29:59.999Z
- var dateString = 'Apr 4 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+10.5 DST
- var dateObj = new Date(Date.UTC(2021, 3, 3, 16, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5 with Z', function () {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T17:29:59.999Z
- var dateString = 'Apr 4 2021 2:59:59.999 +0930';
- var formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 3, 3, 17, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5', function () {
- // Apr 4 2021 3:00:00.000 => 2021-04-03T17:30:00.000Z
- var dateString = 'Apr 4 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 3, 3, 17, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('transformTZ EST to PST', function () {
- var dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'November 7 2021 1:00:00.000';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EST to PDT (End of DST)', function () {
- var dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'November 7 2021 1:59:59.999';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EDT to PST', function () {
- var dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'March 14 2021 1:59:59.999';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EDT to PDT (Start of DST)', function () {
- var dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'March 14 2021 3:00:00.000';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ PST to JST', function () {
- var dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 18:59:59.999';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ PDT to JST', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 19:00:00.000';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- // two-digit-year
-
- it('YY', function () {
- var obj = ['YY', 'YY'];
- expect(date.compile('YY')).to.eql(obj);
- });
-
- it('YY-1', function () {
- var dt = { Y: 2000, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('00', 'YY')).to.eql(dt);
- });
- it('YY-2', function () {
- var dt = { Y: 2001, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('01', 'YY')).to.eql(dt);
- });
- it('YY-3', function () {
- var dt = { Y: 2010, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('10', 'YY')).to.eql(dt);
- });
- it('YY-4', function () {
- var dt = { Y: 2069, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('69', 'YY')).to.eql(dt);
- });
- it('YY-5', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('70', 'YY')).to.eql(dt);
- });
- it('YY-6', function () {
- var dt = { Y: 1999, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('99', 'YY')).to.eql(dt);
- });
-
- it('YY-1', function () {
- var now = new Date(2000, 0, 1);
- expect(date.parse('00', 'YY')).to.eql(now);
- });
- it('YY-2', function () {
- var now = new Date(2001, 0, 1);
- expect(date.parse('01', 'YY')).to.eql(now);
- });
- it('YY-3', function () {
- var now = new Date(2010, 0, 1);
- expect(date.parse('10', 'YY')).to.eql(now);
- });
- it('YY-4', function () {
- var now = new Date(2069, 0, 1);
- expect(date.parse('69', 'YY')).to.eql(now);
- });
- it('YY-5', function () {
- var now = new Date(1970, 0, 1);
- expect(date.parse('70', 'YY')).to.eql(now);
- });
- it('YY-6', function () {
- var now = new Date(1999, 0, 1);
- expect(date.parse('99', 'YY')).to.eql(now);
- });
- });
-
- describe('Applying locale changes to plugins', function () {
- before(function () {
- date.locale(es);
- date.plugin(day_of_week);
- date.plugin(timezone);
- });
-
- // day of week
-
- it('dd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('ju', 'dd')).to.eql(now);
- });
- it('ddd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('jue.', 'ddd')).to.eql(now);
- });
- it('dddd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('jueves', 'dddd')).to.eql(now);
- });
-
- // timezone
-
- it('formatTZ UTC-8', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('marzo 14 2021 1:59:59.999 UTC-0800');
- });
- it('formatTZ UTC-7 (Start of DST)', function () {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('marzo 14 2021 3:00:00.000 UTC-0700');
- });
- it('formatTZ UTC-7 (End of DST)', function () {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('noviembre 7 2021 1:59:59.999 UTC-0700');
- });
- it('formatTZ UTC-8', function () {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('noviembre 7 2021 1:00:00.000 UTC-0800');
- });
- it('formatTZ UTC+9', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('marzo 14 2021 18:59:59.999 UTC+0900');
- });
-
- it('parseTZ UTC-8', function () {
- // Mar 14 2021 1:59:59.999 => 2021-03-14T09:59:59.999Z
- var dateString = 'mar. 14 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Edge case1', function () {
- // Mar 14 2021 2:00:00.000 => 2021-03-14T10:00:00.000Z
- var dateString = 'mar. 14 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles';
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Edge case2', function () {
- // Mar 14 2021 2:59:59.999 => 2021-03-14T10:59:59.999Z
- var dateString = 'mar. 14 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles';
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-7 (Start of DST)', function () {
- // Mar 14 2021 3:00:00.000 => 2021-03-14T10:00:00.000Z
- var dateString = 'mar. 14 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-7 (End of DST)', function () {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T08:59:59.999Z
- var dateString = 'nov. 7 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-8 with Z', function () {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T09:59:59.999Z
- var dateString = 'nov. 7 2021 1:59:59.999 -0800';
- var formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-8', function () {
- // Nov 7 2021 2:00:00.000 => 2021-11-07T10:00:00.000Z
- var dateString = 'nov. 7 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 10, 7, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5', function () {
- // Oct 3 2021 1:59:59.999 => 2021-10-02T16:29:59.999Z
- var dateString = 'oct. 3 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Edge case1', function () {
- // Oct 3 2021 2:00:00.000 => 2021-10-02T16:30:00.000Z
- var dateString = 'oct. 3 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide';
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Edge case2', function () {
- // Oct 3 2021 2:59:59.999 => 2021-10-02T17:29:59.999Z
- var dateString = 'oct. 3 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide';
- var dateObj = new Date(Date.UTC(2021, 9, 2, 17, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+10.5 (Start of DST)', function () {
- // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
- var dateString = 'oct. 3 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+10.5 DST
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+10.5 (End of DST)', function () {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T16:29:59.999Z
- var dateString = 'abr. 4 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+10.5 DST
- var dateObj = new Date(Date.UTC(2021, 3, 3, 16, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5 with Z', function () {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T17:29:59.999Z
- var dateString = 'abr. 4 2021 2:59:59.999 +0930';
- var formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 3, 3, 17, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5', function () {
- // Apr 4 2021 3:00:00.000 => 2021-04-03T17:30:00.000Z
- var dateString = 'abr. 4 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 3, 3, 17, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('transformTZ EST to PST', function () {
- var dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'noviembre 7 2021 1:00:00.000';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EST to PDT (End of DST)', function () {
- var dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'noviembre 7 2021 1:59:59.999';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EDT to PST', function () {
- var dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'marzo 14 2021 1:59:59.999';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EDT to PDT (Start of DST)', function () {
- var dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'marzo 14 2021 3:00:00.000';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ PST to JST', function () {
- var dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'marzo 14 2021 18:59:59.999';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ PDT to JST', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'marzo 14 2021 19:00:00.000';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- after(function () {
- date.locale(en);
- });
- });
-
- describe('Applying other plugins to formatTZ, parseTZ and transformTZ', function () {
- before(function () {
- date.plugin(meridiem);
- date.plugin(timezone);
- });
-
- it('formatTZ UTC-8', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY h:mm:ss.SSS AA [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 A.M. UTC-0800');
- });
-
- it('parseTZ UTC+10.5 (Start of DST)', function () {
- // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
- var dateString = 'Oct 3 2021 3:00:00.000 A.M.';
- var formatString = 'MMM D YYYY h:mm:ss.SSS AA';
- var tz = 'Australia/Adelaide'; // UTC+10.5 DST
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('transformTZ PDT to JST', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY h:mm:ss.SSS AA';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 7:00:00.000 P.M.';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- });
-
-}(this));
diff --git a/test/dst.js b/test/dst.js
deleted file mode 100644
index eaaae33..0000000
--- a/test/dst.js
+++ /dev/null
@@ -1,250 +0,0 @@
-/*global describe, it */
-process.env.TZ = 'America/Los_Angeles';
-
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time');
-
- describe('format', function () {
- it('before DST in America/Los_Angeles', function () {
- var dateObj = new Date(2021, 2, 14, 1, 59, 59, 999);
- var dateString = '2021-03-14 01:59:59.999 UTC-0800';
- var utc = false;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- it('start of DST in America/Los_Angeles', function () {
- var dateObj = new Date(2021, 2, 14, 2, 0, 0, 0);
- var dateString = '2021-03-14 03:00:00.000 UTC-0700';
- var utc = false;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- it('before of PST in America/Los_Angeles', function () {
- var dateObj = new Date(2021, 10, 7, 1, 59, 59, 999);
- var dateString = '2021-11-07 01:59:59.999 UTC-0700';
- var utc = false;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- it('end of DST in America/Los_Angeles', function () {
- var dateObj = new Date(2021, 10, 7, 2, 0, 0, 0);
- var dateString = '2021-11-07 02:00:00.000 UTC-0800';
- var utc = false;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- it('after of DST in America/Los_Angeles', function () {
- var dateObj = new Date(2021, 10, 7, 3, 0, 0, 0);
- var dateString = '2021-11-07 03:00:00.000 UTC-0800';
- var utc = false;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- });
-
- describe('format UTC', function () {
- it('before DST in America/Los_Angeles', function () {
- var dateObj = new Date(Date.UTC(2021, 2, 14, 1, 59, 59, 999));
- var dateString = '2021-03-14 01:59:59.999 UTC+0000';
- var utc = true;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- it('start of DST in America/Los_Angeles', function () {
- var dateObj = new Date(Date.UTC(2021, 2, 14, 2, 0, 0, 0));
- var dateString = '2021-03-14 02:00:00.000 UTC+0000';
- var utc = true;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- it('before of PST in America/Los_Angeles', function () {
- var dateObj = new Date(Date.UTC(2021, 10, 7, 1, 59, 59, 999));
- var dateString = '2021-11-07 01:59:59.999 UTC+0000';
- var utc = true;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- it('end of DST in America/Los_Angeles', function () {
- var dateObj = new Date(Date.UTC(2021, 10, 7, 2, 0, 0, 0));
- var dateString = '2021-11-07 02:00:00.000 UTC+0000';
- var utc = true;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- it('after of DST in America/Los_Angeles', function () {
- var dateObj = new Date(Date.UTC(2021, 10, 7, 3, 0, 0, 0));
- var dateString = '2021-11-07 03:00:00.000 UTC+0000';
- var utc = true;
- expect(date.format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z', utc)).to.eql(dateString);
- });
- });
-
- describe('addition', function () {
- it('add a year', function () {
- var date1 = new Date(2021, 2, 14, 3);
- var date2 = new Date(2022, 2, 14, 3);
- var utc = false;
- expect(date.addYears(date1, 1, utc)).to.eql(date2);
- });
- it('add a year at the end of the month', function () {
- var date1 = new Date(2020, 1, 29, 3);
- var date2 = new Date(2021, 1, 28, 3);
- var utc = false;
- expect(date.addYears(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a year', function () {
- var date1 = new Date(2021, 2, 14, 3);
- var date2 = new Date(2020, 2, 14, 3);
- var utc = false;
- expect(date.addYears(date1, -1, utc)).to.eql(date2);
- });
- it('subtract a year at the end of the month', function () {
- var date1 = new Date(2024, 1, 29, 3);
- var date2 = new Date(2023, 1, 28, 3);
- var utc = false;
- expect(date.addYears(date1, -1, utc)).to.eql(date2);
- });
- it('add a month', function () {
- var date1 = new Date(2021, 2, 14, 3);
- var date2 = new Date(2021, 3, 14, 3);
- var utc = false;
- expect(date.addMonths(date1, 1, utc)).to.eql(date2);
- });
- it('add a month at the end of the month', function () {
- var date1 = new Date(2023, 0, 31, 3);
- var date2 = new Date(2023, 1, 28, 3);
- var utc = false;
- expect(date.addMonths(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a month', function () {
- var date1 = new Date(2021, 2, 14, 3);
- var date2 = new Date(2021, 1, 14, 3);
- var utc = false;
- expect(date.addMonths(date1, -1, utc)).to.eql(date2);
- });
- it('subtract a month at the end of the month', function () {
- var date1 = new Date(2023, 2, 31, 3);
- var date2 = new Date(2023, 1, 28, 3);
- var utc = false;
- expect(date.addMonths(date1, -1, utc)).to.eql(date2);
- });
- it('add a day', function () {
- var date1 = new Date(2021, 2, 14, 3);
- var date2 = new Date(2021, 2, 15, 3);
- var utc = false;
- expect(date.addDays(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a day', function () {
- var date1 = new Date(2021, 2, 14, 3);
- var date2 = new Date(2021, 2, 13, 3);
- var utc = false;
- expect(date.addDays(date1, -1, utc)).to.eql(date2);
- });
- it('add an hour', function () {
- var date1 = new Date(2021, 2, 14, 3);
- var date2 = new Date(2021, 2, 14, 4);
- var utc = false;
- expect(date.addHours(date1, 1, utc)).to.eql(date2);
- });
- it('subtract an hour', function () {
- var date1 = new Date(2021, 2, 14, 3);
- var date2 = new Date(2021, 2, 14, 1);
- var utc = false;
- expect(date.addHours(date1, -1, utc)).to.eql(date2);
- });
- it('add a minute', function () {
- var date1 = new Date(2021, 2, 14, 3, 0);
- var date2 = new Date(2021, 2, 14, 3, 1);
- var utc = false;
- expect(date.addMinutes(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a minute', function () {
- var date1 = new Date(2021, 2, 14, 3, 0);
- var date2 = new Date(2021, 2, 14, 1, 59);
- var utc = false;
- expect(date.addMinutes(date1, -1, utc)).to.eql(date2);
- });
- it('add a second', function () {
- var date1 = new Date(2021, 2, 14, 3, 0, 0);
- var date2 = new Date(2021, 2, 14, 3, 0, 1);
- var utc = false;
- expect(date.addSeconds(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a second', function () {
- var date1 = new Date(2021, 2, 14, 3, 0, 0);
- var date2 = new Date(2021, 2, 14, 1, 59, 59);
- var utc = false;
- expect(date.addSeconds(date1, -1, utc)).to.eql(date2);
- });
- it('add a millisecond', function () {
- var date1 = new Date(2021, 2, 14, 3, 0, 0, 0);
- var date2 = new Date(2021, 2, 14, 3, 0, 0, 1);
- var utc = false;
- expect(date.addMilliseconds(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a millisecond', function () {
- var date1 = new Date(2021, 2, 14, 3, 0, 0, 0);
- var date2 = new Date(2021, 2, 14, 1, 59, 59, 999);
- var utc = false;
- expect(date.addMilliseconds(date1, -1, utc)).to.eql(date2);
- });
- });
-
- describe('addition UTC', function () {
- it('add a year', function () {
- var date1 = new Date(Date.UTC(2021, 2, 14, 10));
- var date2 = new Date(Date.UTC(2022, 2, 14, 10));
- var utc = true;
- expect(date.addYears(date1, 1, utc)).to.eql(date2);
- });
- it('add a year at the end of the month', function () {
- var date1 = new Date(Date.UTC(2020, 1, 29, 9));
- var date2 = new Date(Date.UTC(2021, 1, 28, 9));
- var utc = true;
- expect(date.addYears(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a year', function () {
- var date1 = new Date(Date.UTC(2021, 2, 14, 10));
- var date2 = new Date(Date.UTC(2020, 2, 14, 10));
- var utc = true;
- expect(date.addYears(date1, -1, utc)).to.eql(date2);
- });
- it('subtract a year at the end of the month', function () {
- var date1 = new Date(Date.UTC(2024, 1, 29, 9));
- var date2 = new Date(Date.UTC(2023, 1, 28, 9));
- var utc = true;
- expect(date.addYears(date1, -1, utc)).to.eql(date2);
- });
- it('add a month', function () {
- var date1 = new Date(Date.UTC(2021, 2, 14, 10));
- var date2 = new Date(Date.UTC(2021, 3, 14, 10));
- var utc = true;
- expect(date.addMonths(date1, 1, utc)).to.eql(date2);
- });
- it('add a month at the end of the month', function () {
- var date1 = new Date(Date.UTC(2023, 0, 31, 9));
- var date2 = new Date(Date.UTC(2023, 1, 28, 9));
- var utc = true;
- expect(date.addMonths(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a month', function () {
- var date1 = new Date(Date.UTC(2021, 2, 14, 10));
- var date2 = new Date(Date.UTC(2021, 1, 14, 10));
- var utc = true;
- expect(date.addMonths(date1, -1, utc)).to.eql(date2);
- });
- it('subtract a month at the end of the month', function () {
- var date1 = new Date(Date.UTC(2023, 2, 31, 10));
- var date2 = new Date(Date.UTC(2023, 1, 28, 10));
- var utc = true;
- expect(date.addMonths(date1, -1, utc)).to.eql(date2);
- });
- it('add a day', function () {
- var date1 = new Date(Date.UTC(2021, 2, 14, 10));
- var date2 = new Date(Date.UTC(2021, 2, 15, 10));
- var utc = true;
- expect(date.addDays(date1, 1, utc)).to.eql(date2);
- });
- it('subtract a day', function () {
- var date1 = new Date(Date.UTC(2021, 2, 14, 10));
- var date2 = new Date(Date.UTC(2021, 2, 13, 10));
- var utc = true;
- expect(date.addDays(date1, -1, utc)).to.eql(date2);
- });
- });
-
-}(this));
diff --git a/test/esm/combination.mjs b/test/esm/combination.mjs
deleted file mode 100644
index 8a9679f..0000000
--- a/test/esm/combination.mjs
+++ /dev/null
@@ -1,2390 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-// Destructuring assignment
-const { compile, format, parse, preparse, extend, locale, plugin } = date;
-
-import en from 'date-and-time/locale/en';
-import es from 'date-and-time/locale/es';
-import ja from 'date-and-time/locale/ja';
-
-import day_of_week from 'date-and-time/plugin/day-of-week';
-import meridiem from 'date-and-time/plugin/meridiem';
-import microsecond from 'date-and-time/plugin/microsecond';
-import ordinal from 'date-and-time/plugin/ordinal';
-import timespan from 'date-and-time/plugin/timespan';
-import timezone from 'date-and-time/plugin/timezone';
-import two_digit_year from 'date-and-time/plugin/two-digit-year';
-
-import expect from 'expect.js';
-
-describe('Change locale and revert, then format', () => {
- before(() => {
- locale(ja);
- locale(en);
- });
-
- it('"YYYY" equals to "0001"', () => {
- const now = new Date(0, -1899 * 12, 1);
- expect(format(now, 'YYYY')).to.equal('0001');
- });
- it('"YYYY" equals to "0099"', () => {
- const now = new Date(0, -1801 * 12, 1);
- expect(format(now, 'YYYY')).to.equal('0099');
- });
- it('"YYYY" equals to "0100"', () => {
- const now = new Date(100, 0, 1);
- expect(format(now, 'YYYY')).to.equal('0100');
- });
- it('"YYYY" equals to "1800"', () => {
- const now = new Date(1800, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1800');
- });
- it('"YYYY" equals to "1899"', () => {
- const now = new Date(1899, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1899');
- });
- it('"YYYY" equals to "1900"', () => {
- const now = new Date(1900, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1900');
- });
- it('"YYYY" equals to "1901"', () => {
- const now = new Date(1901, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1901');
- });
- it('"YYYY" equals to "1970"', () => {
- const now = new Date(1970, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1970');
- });
- it('"YYYY" equals to "1999"', () => {
- const now = new Date(1999, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1999');
- });
- it('"YYYY" equals to "2000"', () => {
- const now = new Date(2000, 0, 1);
- expect(format(now, 'YYYY')).to.equal('2000');
- });
- it('"YYYY" equals to "2001"', () => {
- const now = new Date(2001, 0, 1);
- expect(format(now, 'YYYY')).to.equal('2001');
- });
- it('"YYYY" equals to "9999"', () => {
- const now = new Date(9999, 0, 1);
- expect(format(now, 'YYYY')).to.equal('9999');
- });
- it('"YYYY" as UTC equals to "XXXX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'YYYY', utc)).to.equal('' + now.getUTCFullYear());
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(0, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(0, -1899 * 12, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(0, -1801 * 12, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(100, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(101, 0, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(199, 0, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(1900, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(1901, 0, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(1999, 0, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(2000, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(2001, 0, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(2099, 0, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(9900, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(9901, 0, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(9999, 0, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'YY')).to.equal('' + (now.getUTCFullYear() - 2000));
- });
- it('"Y" equals to "1"', () => {
- const now = new Date(0, -1899 * 12, 1);
- expect(format(now, 'Y')).to.equal('1');
- });
- it('"Y" equals to "10"', () => {
- const now = new Date(0, -1890 * 12, 1);
- expect(format(now, 'Y')).to.equal('10');
- });
- it('"Y" equals to "100"', () => {
- const now = new Date(100, 0, 1);
- expect(format(now, 'Y')).to.equal('100');
- });
- it('"Y" equals to "1000"', () => {
- const now = new Date(1000, 0, 1);
- expect(format(now, 'Y')).to.equal('1000');
- });
- it('"Y" equals to "10000"', () => {
- const now = new Date(10000, 0, 1);
- expect(format(now, 'Y')).to.equal('10000');
- });
- it('"Y" as UTC equals to "X"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'Y')).to.equal('' + (now.getUTCFullYear()));
- });
- it('"MMMM" equals to "January"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'MMMM')).to.equal('January');
- });
- it('"MMMM" equals to "December"', () => {
- const now = new Date(2015, 11, 1);
- expect(format(now, 'MMMM')).to.equal('December');
- });
- it('"MMM" equals to "Jan"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'MMM')).to.equal('Jan');
- });
- it('"MMM" equals to "Dec"', () => {
- const now = new Date(2015, 11, 1);
- expect(format(now, 'MMM')).to.equal('Dec');
- });
- it('"MM" equals to "01"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'MM')).to.equal('01');
- });
- it('"MM" equals to "12"', () => {
- const now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(format(now, 'MM')).to.equal('12');
- });
- it('"MM" as UTC equals to "XX"', () => {
- const now = new Date(2015, 10, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'MM', utc)).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"M" equals to "1"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'M')).to.equal('1');
- });
- it('"M" equals to "12"', () => {
- const now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(format(now, 'M')).to.equal('12');
- });
- it('"M" as UTC equals to "XX"', () => {
- const now = new Date(2015, 10, 1, 12, 34, 56, 789);
- expect(format(now, 'M')).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"DD" equals to "01"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'DD')).to.equal('01');
- });
- it('"DD" equals to "31"', () => {
- const now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(format(now, 'DD')).to.equal('31');
- });
- it('"DD" equals to "XX"', () => {
- const now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'DD', utc)).to.equal('' + now.getUTCDate());
- });
- it('"D" equals to "1"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'D')).to.equal('1');
- });
- it('"D" equals to "31"', () => {
- const now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(format(now, 'D')).to.equal('31');
- });
- it('"D" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'D', utc)).to.equal('' + now.getUTCDate());
- });
- it('"dddd" equals to "Tuesday"', () => {
- const now = new Date(2015, 0, 6, 12, 34, 56, 789);
- expect(format(now, 'dddd')).to.equal('Tuesday');
- });
- it('"dddd" equals to "Thursday"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'dddd')).to.equal('Thursday');
- });
- it('"ddd" equals to "Sun"', () => {
- const now = new Date(2015, 0, 4, 12, 34, 56, 789);
- expect(format(now, 'ddd')).to.equal('Sun');
- });
- it('"ddd" equals to "Wed"', () => {
- const now = new Date(2015, 0, 7, 12, 34, 56, 789);
- expect(format(now, 'ddd')).to.equal('Wed');
- });
- it('"dd" equals to "Fr"', () => {
- const now = new Date(2015, 0, 2, 12, 34, 56, 789);
- expect(format(now, 'dd')).to.equal('Fr');
- });
- it('"dd" equals to "Sa"', () => {
- const now = new Date(2015, 0, 3, 12, 34, 56, 789);
- expect(format(now, 'dd')).to.equal('Sa');
- });
- it('"HH" equals to "12"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'HH')).to.equal('12');
- });
- it('"HH" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'HH')).to.equal('00');
- });
- it('"HH" equals to "23"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(format(now, 'HH')).to.equal('23');
- });
- it('"HH" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'HH', utc)).to.equal(('0' + now.getUTCHours()).slice(-2));
- });
- it('"H" equals to "12"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'H')).to.equal('12');
- });
- it('"H" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'H')).to.equal('0');
- });
- it('"H" equals to "23"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(format(now, 'H')).to.equal('23');
- });
- it('"H" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'H', utc)).to.equal('' + now.getUTCHours());
- });
- it('"hh A" equals to "12 PM"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('12 PM');
- });
- it('"hh A" equals to "12 AM"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('12 AM');
- });
- it('"hh A" equals to "11 PM"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('11 PM');
- });
- it('"hh A" equals to "01 AM"', () => {
- const now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('01 AM');
- });
- it('"hh A" equals to "01 PM"', () => {
- const now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('01 PM');
- });
- it('"h A" equals to "12 PM"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('12 PM');
- });
- it('"h A" equals to "12 AM"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('12 AM');
- });
- it('"h A" equals to "11 PM"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('11 PM');
- });
- it('"h A" equals to "1 AM"', () => {
- const now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('1 AM');
- });
- it('"h A" equals to "1 PM"', () => {
- const now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('1 PM');
- });
- it('"mm" equals to "34"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'mm')).to.equal('34');
- });
- it('"mm" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(format(now, 'mm')).to.equal('00');
- });
- it('"mm" equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(format(now, 'mm')).to.equal('59');
- });
- it('"mm" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(format(now, 'mm', utc)).to.equal(('0' + now.getUTCMinutes()).slice(-2));
- });
- it('"m" equals to "34"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'm')).to.equal('34');
- });
- it('"m" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(format(now, 'm')).to.equal('0');
- });
- it('"m" equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(format(now, 'm')).to.equal('59');
- });
- it('"m" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(format(now, 'm', utc)).to.equal('' + now.getUTCMinutes());
- });
- it('"ss" equals to "56"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'ss')).to.equal('56');
- });
- it('"ss" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(format(now, 'ss')).to.equal('00');
- });
- it('"ss" equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(format(now, 'ss')).to.equal('59');
- });
- it('"ss" as UTC equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(format(now, 'ss', utc)).to.equal(('0' + now.getUTCSeconds()).slice(-2));
- });
- it('"s" equals to "56"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 's')).to.equal('56');
- });
- it('"s" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(format(now, 's')).to.equal('0');
- });
- it('"s" equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(format(now, 's')).to.equal('59');
- });
- it('"s" as UTC equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(format(now, 's', utc)).to.equal('' + now.getUTCSeconds());
- });
- it('"SSS" equals to "789"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'SSS')).to.equal('789');
- });
- it('"SSS" equals to "000"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(format(now, 'SSS')).to.equal('000');
- });
- it('"SSS" equals to "001"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(format(now, 'SSS')).to.equal('001');
- });
- it('"SSS" as UTC equals to "XXX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 10),
- utc = true;
- expect(format(now, 'SSS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3));
- });
- it('"SS" equals to "78"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'SS')).to.equal('78');
- });
- it('"SS" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(format(now, 'SS')).to.equal('00');
- });
- it('"SS" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(format(now, 'SS')).to.equal('00');
- });
- it('"SS" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 9),
- utc = true;
- expect(format(now, 'SS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 2));
- });
- it('"S" equals to "7"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'S')).to.equal('7');
- });
- it('"S" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "X"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'S', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 1));
- });
- it('"Z" matches "+XXXX/-XXXX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'Z')).to.match(/^[+-]\d{4}$/);
- });
- it('"Z" as UTC equals to "+0000"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'Z', utc)).to.equal('+0000');
- });
- it('"ZZ" matches "+XX:XX/-XX:XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ZZ')).to.match(/^[+-]\d{2}:\d{2}$/);
- });
- it('"ZZ" as UTC equals to "+00:00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'ZZ', utc)).to.equal('+00:00');
- });
- it('"ddd MMM DD YYYY HH:mm:ss" equals to "Thu Jan 01 2015 12:34:56"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'ddd MMM DD YYYY HH:mm:ss')).to.equal('Thu Jan 01 2015 12:34:56');
- });
- it('"YYYY/MM/DD HH:mm:ss.SSS" equals to "1900/01/01 00:00:00.000"', () => {
- const now = new Date(0, 0, 1);
- expect(format(now, 'YYYY/MM/DD HH:mm:ss.SSS')).to.equal('1900/01/01 00:00:00.000');
- });
- it('"YY/MM/DD HH:mm:ss.SSS" equals to "00/01/01 00:00:00.000"', () => {
- const now = new Date(0, 0, 1);
- expect(format(now, 'YY/MM/DD HH:mm:ss.SSS')).to.equal('00/01/01 00:00:00.000');
- });
- it('"Y/M/D H:m:s.SSS" equals to "999/1/1 0:0:0.000"', () => {
- const now = new Date(999, 0, 1);
- expect(format(now, 'Y/M/D H:m:s.SSS')).to.equal('999/1/1 0:0:0.000');
- });
- it('"dddd, MMMM D, YYYY h A" equals to "Saturday, January 1, 2000 10 AM"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, 'dddd, MMMM D, YYYY h A')).to.equal('Saturday, January 1, 2000 10 AM');
- });
- it('"[dddd, MMMM D, YYYY h A]" equals to "dddd, MMMM D, YYYY h A"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, '[dddd, MMMM D, YYYY h A]')).to.equal('dddd, MMMM D, YYYY h A');
- });
- it('"[dddd], MMMM [D], YYYY [h] A" equals to "dddd, January D, 2000 h AM"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, '[dddd], MMMM [D], YYYY [h] A')).to.equal('dddd, January D, 2000 h AM');
- });
- it('"[[dddd], MMMM [D], YYYY [h] A]" equals to "[dddd], MMMM [D], YYYY [h] A"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, '[[dddd], MMMM [D], YYYY [h] A]')).to.equal('[dddd], MMMM [D], YYYY [h] A');
- });
- it('"[dddd], MMMM [[D], YYYY] [h] A" equals to "dddd, January [D], YYYY h AM"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, '[dddd], MMMM [[D], YYYY] [h] A')).to.equal('dddd, January [D], YYYY h AM');
- });
-
- after(() => {
- locale(en);
- });
-});
-
-describe('Change locale and revert, then parse', () => {
- before(() => {
- locale(ja);
- locale(en);
- });
-
- it('YYYY', () => {
- expect(isNaN(parse('0000', 'YYYY'))).to.be(true);
- });
- it('YYYY', () => {
- const now = new Date(0, -1899 * 12, 1);
- expect(parse('0001', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(0, -1801 * 12, 1);
- expect(parse('0099', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(100, 0, 1);
- expect(parse('0100', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(1899, 0, 1);
- expect(parse('1899', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(1900, 0, 1);
- expect(parse('1900', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(1969, 0, 1);
- expect(parse('1969', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(1970, 0, 1);
- expect(parse('1970', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(1999, 0, 1);
- expect(parse('1999', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(2000, 0, 1);
- expect(parse('2000', 'YYYY')).to.eql(now);
- });
- it('YYYY', () => {
- const now = new Date(9999, 0, 1);
- expect(parse('9999', 'YYYY')).to.eql(now);
- });
- it('Y', () => {
- expect(isNaN(parse('0', 'Y'))).to.be(true);
- });
- it('Y', () => {
- const now = new Date(0, -1899 * 12, 1);
- expect(parse('1', 'Y')).to.eql(now);
- });
- it('Y', () => {
- const now = new Date(0, -1801 * 12, 1);
- expect(parse('99', 'Y')).to.eql(now);
- });
- it('Y', () => {
- const now = new Date(100, 0, 1);
- expect(parse('100', 'Y')).to.eql(now);
- });
- it('YYYY MMMM', () => {
- const now = new Date(2015, 0, 1);
- expect(parse('2015 January', 'YYYY MMMM')).to.eql(now);
- });
- it('YYYY MMMM', () => {
- const now = new Date(2015, 11, 1);
- expect(parse('2015 December', 'YYYY MMMM')).to.eql(now);
- });
- it('YYYY MMMM', () => {
- expect(isNaN(parse('2015 Zero', 'YYYY MMMM'))).to.be(true);
- });
- it('YYYY MMM', () => {
- const now = new Date(2015, 0, 1);
- expect(parse('2015 Jan', 'YYYY MMM')).to.eql(now);
- });
- it('YYYY MMM', () => {
- const now = new Date(2015, 11, 1);
- expect(parse('2015 Dec', 'YYYY MMM')).to.eql(now);
- });
- it('YYYY MMM', () => {
- expect(isNaN(parse('2015 Zero', 'YYYY MMM'))).to.be(true);
- });
- it('YYYY-MM', () => {
- const now = new Date(2015, 0, 1);
- expect(parse('2015-01', 'YYYY-MM')).to.eql(now);
- });
- it('YYYY-MM', () => {
- const now = new Date(2015, 11, 1);
- expect(parse('2015-12', 'YYYY-MM')).to.eql(now);
- });
- it('YYYY-MM', () => {
- expect(isNaN(parse('2015-00', 'YYYY-MM'))).to.be(true);
- });
- it('YYYY-M', () => {
- const now = new Date(2015, 0, 1);
- expect(parse('2015-1', 'YYYY-M')).to.eql(now);
- });
- it('YYYY-M', () => {
- const now = new Date(2015, 11, 1);
- expect(parse('2015-12', 'YYYY-M')).to.eql(now);
- });
- it('YYYY-M', () => {
- expect(isNaN(parse('2015-0', 'YYYY-M'))).to.be(true);
- });
- it('YYYY-MM-DD', () => {
- const now = new Date(2015, 0, 1);
- expect(parse('2015-01-01', 'YYYY-MM-DD')).to.eql(now);
- });
- it('YYYY-MM-DD', () => {
- const now = new Date(2015, 11, 31);
- expect(parse('2015-12-31', 'YYYY-MM-DD')).to.eql(now);
- });
- it('YYYY-MM-DD', () => {
- expect(isNaN(parse('2015-00-00', 'YYYY-MM-DD'))).to.be(true);
- });
- it('YYYY-M-D', () => {
- const now = new Date(2015, 0, 1);
- expect(parse('2015-1-1', 'YYYY-M-D')).to.eql(now);
- });
- it('YYYY-M-D', () => {
- const now = new Date(2015, 11, 31);
- expect(parse('2015-12-31', 'YYYY-M-D')).to.eql(now);
- });
- it('YYYY-M-D', () => {
- expect(isNaN(parse('2015-0-0', 'YYYY-M-D'))).to.be(true);
- });
- it('YYYY-MM-DD HH', () => {
- const now = new Date(2015, 0, 1, 0);
- expect(parse('2015-01-01 00', 'YYYY-MM-DD HH')).to.eql(now);
- });
- it('YYYY-MM-DD HH', () => {
- const now = new Date(2015, 11, 31, 23);
- expect(parse('2015-12-31 23', 'YYYY-MM-DD HH')).to.eql(now);
- });
- it('YYYY-MM-DD HH', () => {
- expect(isNaN(parse('2015-00-00 24', 'YYYY-MM-DD HH'))).to.be(true);
- });
- it('YYYY-M-D H', () => {
- const now = new Date(2015, 0, 1, 0);
- expect(parse('2015-1-1 0', 'YYYY-M-D H')).to.eql(now);
- });
- it('YYYY-M-D H', () => {
- const now = new Date(2015, 11, 31, 23);
- expect(parse('2015-12-31 23', 'YYYY-M-D H')).to.eql(now);
- });
- it('YYYY-M-D H', () => {
- expect(isNaN(parse('2015-0-0 24', 'YYYY-M-D H'))).to.be(true);
- });
- it('YYYY-M-D hh A', () => {
- const now = new Date(2015, 0, 1, 0);
- expect(parse('2015-1-1 12 AM', 'YYYY-M-D hh A')).to.eql(now);
- });
- it('YYYY-M-D hh A', () => {
- const now = new Date(2015, 11, 31, 23);
- expect(parse('2015-12-31 11 PM', 'YYYY-M-D hh A')).to.eql(now);
- });
- it('YYYY-M-D hh A', () => {
- expect(isNaN(parse('2015-0-0 12 AM', 'YYYY-M-D hh A'))).to.be(true);
- });
- it('YYYY-M-D h A', () => {
- const now = new Date(2015, 0, 1, 0);
- expect(parse('2015-1-1 12 AM', 'YYYY-M-D h A')).to.eql(now);
- });
- it('YYYY-M-D h A', () => {
- const now = new Date(2015, 11, 31, 23);
- expect(parse('2015-12-31 11 PM', 'YYYY-M-D h A')).to.eql(now);
- });
- it('YYYY-M-D h A', () => {
- expect(isNaN(parse('2015-0-0 12 AM', 'YYYY-M-D h A'))).to.be(true);
- });
- it('YYYY-MM-DD HH:mm', () => {
- const now = new Date(2015, 0, 1, 0, 0);
- expect(parse('2015-01-01 00:00', 'YYYY-MM-DD HH:mm')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm', () => {
- const now = new Date(2015, 11, 31, 23, 59);
- expect(parse('2015-12-31 23:59', 'YYYY-MM-DD HH:mm')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm', () => {
- expect(isNaN(parse('2015-00-00 24:60', 'YYYY-MM-DD HH:mm'))).to.be(true);
- });
- it('YYYY-M-D H:m', () => {
- const now = new Date(2015, 0, 1, 0, 0);
- expect(parse('2015-1-1 0:0', 'YYYY-M-D H:m')).to.eql(now);
- });
- it('YYYY-M-D H:m', () => {
- const now = new Date(2015, 11, 31, 23, 59);
- expect(parse('2015-12-31 23:59', 'YYYY-M-D H:m')).to.eql(now);
- });
- it('YYYY-M-D H:m', () => {
- expect(isNaN(parse('2015-0-0 24:60', 'YYYY-M-D H:m'))).to.be(true);
- });
- it('YYYY-MM-DD HH:mm:ss', () => {
- const now = new Date(2015, 0, 1, 0, 0, 0);
- expect(parse('2015-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm:ss', () => {
- const now = new Date(2015, 11, 31, 23, 59, 59);
- expect(parse('2015-12-31 23:59:59', 'YYYY-MM-DD HH:mm:ss')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm:ss', () => {
- expect(isNaN(parse('2015-00-00 24:60:60', 'YYYY-MM-DD HH:mm:ss'))).to.be(true);
- });
- it('YYYY-M-D H:m:s', () => {
- const now = new Date(2015, 0, 1, 0, 0);
- expect(parse('2015-1-1 0:0:0', 'YYYY-M-D H:m:s')).to.eql(now);
- });
- it('YYYY-M-D H:m:s', () => {
- const now = new Date(2015, 11, 31, 23, 59, 59);
- expect(parse('2015-12-31 23:59:59', 'YYYY-M-D H:m:s')).to.eql(now);
- });
- it('YYYY-M-D H:m:s', () => {
- expect(isNaN(parse('2015-0-0 24:60:60', 'YYYY-M-D H:m:s'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS', () => {
- const now = new Date(2015, 0, 1, 0, 0, 0);
- expect(parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SSS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS', () => {
- const now = new Date(2015, 11, 31, 23, 59, 59, 999);
- expect(parse('2015-12-31 23:59:59.999', 'YYYY-M-D H:m:s.SSS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS', () => {
- expect(isNaN(parse('2015-0-0 24:60:61.000', 'YYYY-M-D H:m:s.SSS'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SS', () => {
- const now = new Date(2015, 0, 1, 0, 0, 0);
- expect(parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SS', () => {
- const now = new Date(2015, 11, 31, 23, 59, 59, 990);
- expect(parse('2015-12-31 23:59:59.99', 'YYYY-M-D H:m:s.SS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SS', () => {
- expect(isNaN(parse('2015-0-0 24:60:61.00', 'YYYY-M-D H:m:s.SS'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.S', () => {
- const now = new Date(2015, 0, 1, 0, 0, 0);
- expect(parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.S')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.S', () => {
- const now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(parse('2015-12-31 23:59:59.9', 'YYYY-M-D H:m:s.S')).to.eql(now);
- });
- it('YYYY M D H m s S', () => {
- const now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(parse('2015-12-31 23:59:59.9', 'YYYY M D H m s S')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.S', () => {
- expect(isNaN(parse('2015-0-0 24:60:61.0', 'YYYY-M-D H:m:s.S'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS Z', () => {
- const now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
- expect(parse('2015-1-1 0:0:0.0 +0000', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', () => {
- const now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
- expect(parse('2015-12-31 23:00:59.999 -0059', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', () => {
- const now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
- expect(parse('2015-12-31 09:59:59.999 -1200', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', () => {
- expect(isNaN(parse('2015-12-31 09:58:59.999 -1201', 'YYYY-M-D H:m:s.SSS Z'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS Z', () => {
- const now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
- expect(parse('2015-12-31 12:00:59.999 +1400', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', () => {
- expect(isNaN(parse('2015-12-31 12:01:59.999 +1401', 'YYYY-M-D H:m:s.SSS Z'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', () => {
- const now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
- expect(date.parse('2015-1-1 0:0:0.0 +00:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', () => {
- const now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
- expect(date.parse('2015-12-31 23:00:59.999 -00:59', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', () => {
- const now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
- expect(date.parse('2015-12-31 09:59:59.999 -12:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', () => {
- expect(isNaN(date.parse('2015-12-31 09:58:59.999 -12:01', 'YYYY-M-D H:m:s.SSS ZZ'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', () => {
- const now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
- expect(date.parse('2015-12-31 12:00:59.999 +14:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', () => {
- expect(isNaN(date.parse('2015-12-31 12:01:59.999 +14:01', 'YYYY-M-D H:m:s.SSS ZZ'))).to.be(true);
- });
- it('MMDDHHmmssSSS', () => {
- const now = new Date(1970, 11, 31, 23, 59, 59, 999);
- expect(parse('1231235959999', 'MMDDHHmmssSSS')).to.eql(now);
- });
- it('DDHHmmssSSS', () => {
- const now = new Date(1970, 0, 31, 23, 59, 59, 999);
- expect(parse('31235959999', 'DDHHmmssSSS')).to.eql(now);
- });
- it('HHmmssSSS', () => {
- const now = new Date(1970, 0, 1, 23, 59, 59, 999);
- expect(parse('235959999', 'HHmmssSSS')).to.eql(now);
- });
- it('mmssSSS', () => {
- const now = new Date(1970, 0, 1, 0, 59, 59, 999);
- expect(parse('5959999', 'mmssSSS')).to.eql(now);
- });
- it('ssSSS', () => {
- const now = new Date(1970, 0, 1, 0, 0, 59, 999);
- expect(parse('59999', 'ssSSS')).to.eql(now);
- });
- it('SSS', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 999);
- expect(parse('999', 'SSS')).to.eql(now);
- });
- it('Z', () => {
- expect(isNaN(parse('+000', 'Z'))).to.be(true);
- });
- it('Z', () => {
- expect(isNaN(parse('+00', 'Z'))).to.be(true);
- });
- it('Z', () => {
- expect(isNaN(parse('+0', 'Z'))).to.be(true);
- });
- it('Z', () => {
- expect(isNaN(parse('0', 'Z'))).to.be(true);
- });
- it('Z', () => {
- expect(isNaN(parse('0000', 'Z'))).to.be(true);
- });
- it('Z', () => {
- expect(isNaN(parse('00000', 'Z'))).to.be(true);
- });
- it('ZZ', () => {
- expect(isNaN(date.parse('+00:0', 'ZZ'))).to.be(true);
- });
- it('ZZ', () => {
- expect(isNaN(date.parse('+00:', 'ZZ'))).to.be(true);
- });
- it('ZZ', () => {
- expect(isNaN(date.parse('+0:', 'ZZ'))).to.be(true);
- });
- it('ZZ', () => {
- expect(isNaN(date.parse('0:', 'ZZ'))).to.be(true);
- });
- it('ZZ', () => {
- expect(isNaN(date.parse('00:00', 'ZZ'))).to.be(true);
- });
- it('ZZ', () => {
- expect(isNaN(date.parse('00:000', 'ZZ'))).to.be(true);
- });
- it('foo', () => {
- expect(isNaN(parse('20150101235959', 'foo'))).to.be(true);
- });
- it('bar', () => {
- expect(isNaN(parse('20150101235959', 'bar'))).to.be(true);
- });
- it('YYYYMMDD', () => {
- expect(isNaN(parse('20150101235959', 'YYYYMMDD'))).to.be(true);
- });
- it('20150101235959', () => {
- expect(isNaN(parse('20150101235959', '20150101235959'))).to.be(true);
- });
- it('YYYY?M?D H?m?s?S', () => {
- expect(isNaN(parse('2015-12-31 23:59:59.9', 'YYYY?M?D H?m?s?S'))).to.be(true);
- });
- it('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', () => {
- const now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(parse('Y2015M12D31H23m59s59S9', '[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S')).to.eql(now);
- });
- it('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', () => {
- expect(isNaN(parse('[Y]2015[M]12[D]31[H]23[m]59[s]59[S]9', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]'))).to.be(true);
- });
- it(' ', () => {
- expect(isNaN(parse('20151231235959900', ' '))).to.be(true);
- });
-
- after(() => {
- locale(en);
- });
-});
-
-describe('Change locale and revert, then extend', () => {
- before(() => {
- locale(ja);
- locale(en);
- });
-
- it('getting current locale', () => {
- expect(locale()).to.equal('en');
- });
- it('changing default meridiem', () => {
- extend({ res: { A: ['am', 'pm'] } });
- expect(format(new Date(2012, 0, 1, 12), 'h A')).to.not.equal('12 pm');
- });
- it('extending default meridiem', () => {
- extend({
- res: {
- a: ['am', 'pm']
- },
- formatter: {
- a: function (d) {
- return this.res.a[d.getHours() > 11 | 0];
- }
- }
- });
- expect(format(new Date(2012, 0, 1, 12), 'h a')).to.equal('12 pm');
- });
-
- after(() => {
- locale(en);
- });
-});
-
-const MMMM = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
-const MMM = ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'];
-const dddd = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'];
-const ddd = ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'];
-const dd = ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'];
-const es_A = ['de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', // 0 - 11
- 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', // 12 - 18
- 'de la noche', 'de la noche', 'de la noche', 'de la noche', 'de la noche']; // 19 - 23
-
-describe('Change the local to ja, then es, then format', () => {
- before(() => {
- locale(ja);
- locale(es);
- });
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(format(now, 'dd')).to.equal(d);
- });
- });
- es_A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => {
- locale(en);
- });
-});
-
-describe('Change the locale to ja, then es, then parse', () => {
- before(() => {
- locale(ja);
- locale(es);
- });
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(parse(m, 'MMM')).to.eql(now);
- });
- });
- es_A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => {
- locale(en);
- });
-});
-
-describe('Install multiple plugins, then format', () => {
- before(() => {
- plugin(day_of_week);
- plugin(meridiem);
- plugin(microsecond);
- plugin(ordinal);
- plugin(timespan);
- plugin(two_digit_year);
- });
-
- it('"YYYY" equals to "0001"', () => {
- const now = new Date(0, -1899 * 12, 1);
- expect(format(now, 'YYYY')).to.equal('0001');
- });
- it('"YYYY" equals to "0099"', () => {
- const now = new Date(0, -1801 * 12, 1);
- expect(format(now, 'YYYY')).to.equal('0099');
- });
- it('"YYYY" equals to "0100"', () => {
- const now = new Date(100, 0, 1);
- expect(format(now, 'YYYY')).to.equal('0100');
- });
- it('"YYYY" equals to "1800"', () => {
- const now = new Date(1800, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1800');
- });
- it('"YYYY" equals to "1899"', () => {
- const now = new Date(1899, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1899');
- });
- it('"YYYY" equals to "1900"', () => {
- const now = new Date(1900, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1900');
- });
- it('"YYYY" equals to "1901"', () => {
- const now = new Date(1901, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1901');
- });
- it('"YYYY" equals to "1970"', () => {
- const now = new Date(1970, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1970');
- });
- it('"YYYY" equals to "1999"', () => {
- const now = new Date(1999, 0, 1);
- expect(format(now, 'YYYY')).to.equal('1999');
- });
- it('"YYYY" equals to "2000"', () => {
- const now = new Date(2000, 0, 1);
- expect(format(now, 'YYYY')).to.equal('2000');
- });
- it('"YYYY" equals to "2001"', () => {
- const now = new Date(2001, 0, 1);
- expect(format(now, 'YYYY')).to.equal('2001');
- });
- it('"YYYY" equals to "9999"', () => {
- const now = new Date(9999, 0, 1);
- expect(format(now, 'YYYY')).to.equal('9999');
- });
- it('"YYYY" as UTC equals to "XXXX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'YYYY', utc)).to.equal('' + now.getUTCFullYear());
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(0, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(0, -1899 * 12, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(0, -1801 * 12, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(100, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(101, 0, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(199, 0, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(1900, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(1901, 0, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(1999, 0, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(2000, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(2001, 0, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(2099, 0, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', () => {
- const now = new Date(9900, 0, 1);
- expect(format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', () => {
- const now = new Date(9901, 0, 1);
- expect(format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', () => {
- const now = new Date(9999, 0, 1);
- expect(format(now, 'YY')).to.equal('99');
- });
- it('"YY" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'YY')).to.equal('' + (now.getUTCFullYear() - 2000));
- });
- it('"Y" equals to "1"', () => {
- const now = new Date(0, -1899 * 12, 1);
- expect(format(now, 'Y')).to.equal('1');
- });
- it('"Y" equals to "10"', () => {
- const now = new Date(0, -1890 * 12, 1);
- expect(format(now, 'Y')).to.equal('10');
- });
- it('"Y" equals to "100"', () => {
- const now = new Date(100, 0, 1);
- expect(format(now, 'Y')).to.equal('100');
- });
- it('"Y" equals to "1000"', () => {
- const now = new Date(1000, 0, 1);
- expect(format(now, 'Y')).to.equal('1000');
- });
- it('"Y" equals to "10000"', () => {
- const now = new Date(10000, 0, 1);
- expect(format(now, 'Y')).to.equal('10000');
- });
- it('"Y" as UTC equals to "X"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'Y')).to.equal('' + (now.getUTCFullYear()));
- });
- it('"MMMM" equals to "January"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'MMMM')).to.equal('January');
- });
- it('"MMMM" equals to "December"', () => {
- const now = new Date(2015, 11, 1);
- expect(format(now, 'MMMM')).to.equal('December');
- });
- it('"MMM" equals to "Jan"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'MMM')).to.equal('Jan');
- });
- it('"MMM" equals to "Dec"', () => {
- const now = new Date(2015, 11, 1);
- expect(format(now, 'MMM')).to.equal('Dec');
- });
- it('"MM" equals to "01"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'MM')).to.equal('01');
- });
- it('"MM" equals to "12"', () => {
- const now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(format(now, 'MM')).to.equal('12');
- });
- it('"MM" as UTC equals to "XX"', () => {
- const now = new Date(2015, 10, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'MM', utc)).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"M" equals to "1"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'M')).to.equal('1');
- });
- it('"M" equals to "12"', () => {
- const now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(format(now, 'M')).to.equal('12');
- });
- it('"M" as UTC equals to "XX"', () => {
- const now = new Date(2015, 10, 1, 12, 34, 56, 789);
- expect(format(now, 'M')).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"DD" equals to "01"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'DD')).to.equal('01');
- });
- it('"DD" equals to "31"', () => {
- const now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(format(now, 'DD')).to.equal('31');
- });
- it('"DD" equals to "XX"', () => {
- const now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'DD', utc)).to.equal('' + now.getUTCDate());
- });
- it('"D" equals to "1"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'D')).to.equal('1');
- });
- it('"D" equals to "31"', () => {
- const now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(format(now, 'D')).to.equal('31');
- });
- it('"D" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'D', utc)).to.equal('' + now.getUTCDate());
- });
- it('"dddd" equals to "Tuesday"', () => {
- const now = new Date(2015, 0, 6, 12, 34, 56, 789);
- expect(format(now, 'dddd')).to.equal('Tuesday');
- });
- it('"dddd" equals to "Thursday"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'dddd')).to.equal('Thursday');
- });
- it('"ddd" equals to "Sun"', () => {
- const now = new Date(2015, 0, 4, 12, 34, 56, 789);
- expect(format(now, 'ddd')).to.equal('Sun');
- });
- it('"ddd" equals to "Wed"', () => {
- const now = new Date(2015, 0, 7, 12, 34, 56, 789);
- expect(format(now, 'ddd')).to.equal('Wed');
- });
- it('"dd" equals to "Fr"', () => {
- const now = new Date(2015, 0, 2, 12, 34, 56, 789);
- expect(format(now, 'dd')).to.equal('Fr');
- });
- it('"dd" equals to "Sa"', () => {
- const now = new Date(2015, 0, 3, 12, 34, 56, 789);
- expect(format(now, 'dd')).to.equal('Sa');
- });
- it('"HH" equals to "12"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'HH')).to.equal('12');
- });
- it('"HH" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'HH')).to.equal('00');
- });
- it('"HH" equals to "23"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(format(now, 'HH')).to.equal('23');
- });
- it('"HH" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'HH', utc)).to.equal(('0' + now.getUTCHours()).slice(-2));
- });
- it('"H" equals to "12"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'H')).to.equal('12');
- });
- it('"H" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'H')).to.equal('0');
- });
- it('"H" equals to "23"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(format(now, 'H')).to.equal('23');
- });
- it('"H" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'H', utc)).to.equal('' + now.getUTCHours());
- });
- it('"hh A" equals to "12 PM"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('12 PM');
- });
- it('"hh A" equals to "12 AM"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('12 AM');
- });
- it('"hh A" equals to "11 PM"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('11 PM');
- });
- it('"hh A" equals to "01 AM"', () => {
- const now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('01 AM');
- });
- it('"hh A" equals to "01 PM"', () => {
- const now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(format(now, 'hh A')).to.equal('01 PM');
- });
- it('"h A" equals to "12 PM"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('12 PM');
- });
- it('"h A" equals to "12 AM"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('12 AM');
- });
- it('"h A" equals to "11 PM"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('11 PM');
- });
- it('"h A" equals to "1 AM"', () => {
- const now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('1 AM');
- });
- it('"h A" equals to "1 PM"', () => {
- const now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(format(now, 'h A')).to.equal('1 PM');
- });
- it('"mm" equals to "34"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'mm')).to.equal('34');
- });
- it('"mm" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(format(now, 'mm')).to.equal('00');
- });
- it('"mm" equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(format(now, 'mm')).to.equal('59');
- });
- it('"mm" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(format(now, 'mm', utc)).to.equal(('0' + now.getUTCMinutes()).slice(-2));
- });
- it('"m" equals to "34"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'm')).to.equal('34');
- });
- it('"m" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(format(now, 'm')).to.equal('0');
- });
- it('"m" equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(format(now, 'm')).to.equal('59');
- });
- it('"m" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(format(now, 'm', utc)).to.equal('' + now.getUTCMinutes());
- });
- it('"ss" equals to "56"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'ss')).to.equal('56');
- });
- it('"ss" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(format(now, 'ss')).to.equal('00');
- });
- it('"ss" equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(format(now, 'ss')).to.equal('59');
- });
- it('"ss" as UTC equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(format(now, 'ss', utc)).to.equal(('0' + now.getUTCSeconds()).slice(-2));
- });
- it('"s" equals to "56"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 's')).to.equal('56');
- });
- it('"s" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(format(now, 's')).to.equal('0');
- });
- it('"s" equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(format(now, 's')).to.equal('59');
- });
- it('"s" as UTC equals to "59"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(format(now, 's', utc)).to.equal('' + now.getUTCSeconds());
- });
- it('"SSS" equals to "789"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'SSS')).to.equal('789');
- });
- it('"SSS" equals to "000"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(format(now, 'SSS')).to.equal('000');
- });
- it('"SSS" equals to "001"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(format(now, 'SSS')).to.equal('001');
- });
- it('"SSS" as UTC equals to "XXX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 10),
- utc = true;
- expect(format(now, 'SSS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3));
- });
- it('"SS" equals to "78"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'SS')).to.equal('78');
- });
- it('"SS" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(format(now, 'SS')).to.equal('00');
- });
- it('"SS" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(format(now, 'SS')).to.equal('00');
- });
- it('"SS" as UTC equals to "XX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 9),
- utc = true;
- expect(format(now, 'SS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 2));
- });
- it('"S" equals to "7"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'S')).to.equal('7');
- });
- it('"S" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "X"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'S', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 1));
- });
- it('"Z" matches "+XXXX/-XXXX"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'Z')).to.match(/^[+-]\d{4}$/);
- });
- it('"Z" as UTC equals to "+0000"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(format(now, 'Z', utc)).to.equal('+0000');
- });
- it('"ddd MMM DD YYYY HH:mm:ss" equals to "Thu Jan 01 2015 12:34:56"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'ddd MMM DD YYYY HH:mm:ss')).to.equal('Thu Jan 01 2015 12:34:56');
- });
- it('"YYYY/MM/DD HH:mm:ss.SSS" equals to "1900/01/01 00:00:00.000"', () => {
- const now = new Date(0, 0, 1);
- expect(format(now, 'YYYY/MM/DD HH:mm:ss.SSS')).to.equal('1900/01/01 00:00:00.000');
- });
- it('"YY/MM/DD HH:mm:ss.SSS" equals to "00/01/01 00:00:00.000"', () => {
- const now = new Date(0, 0, 1);
- expect(format(now, 'YY/MM/DD HH:mm:ss.SSS')).to.equal('00/01/01 00:00:00.000');
- });
- it('"Y/M/D H:m:s.SSS" equals to "999/1/1 0:0:0.000"', () => {
- const now = new Date(999, 0, 1);
- expect(format(now, 'Y/M/D H:m:s.SSS')).to.equal('999/1/1 0:0:0.000');
- });
- it('"dddd, MMMM D, YYYY h A" equals to "Saturday, January 1, 2000 10 AM"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, 'dddd, MMMM D, YYYY h A')).to.equal('Saturday, January 1, 2000 10 AM');
- });
- it('"[dddd, MMMM D, YYYY h A]" equals to "dddd, MMMM D, YYYY h A"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, '[dddd, MMMM D, YYYY h A]')).to.equal('dddd, MMMM D, YYYY h A');
- });
- it('"[dddd], MMMM [D], YYYY [h] A" equals to "dddd, January D, 2000 h AM"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, '[dddd], MMMM [D], YYYY [h] A')).to.equal('dddd, January D, 2000 h AM');
- });
- it('"[[dddd], MMMM [D], YYYY [h] A]" equals to "[dddd], MMMM [D], YYYY [h] A"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, '[[dddd], MMMM [D], YYYY [h] A]')).to.equal('[dddd], MMMM [D], YYYY [h] A');
- });
- it('"[dddd], MMMM [[D], YYYY] [h] A" equals to "dddd, January [D], YYYY h AM"', () => {
- const now = new Date(2000, 0, 1, 10, 0, 0);
- expect(format(now, '[dddd], MMMM [[D], YYYY] [h] A')).to.equal('dddd, January [D], YYYY h AM');
- });
-});
-
-describe('Install multiple plugins, then parse', () => {
- let timeSpan, formatTZ, parseTZ;
-
- before(() => {
- locale(es);
- plugin(day_of_week);
- plugin(meridiem);
- plugin(microsecond);
- plugin(ordinal);
- plugin(timespan);
- plugin(timezone);
- plugin(two_digit_year);
- locale(en);
-
- ({ timeSpan, formatTZ, parseTZ } = date);
- });
-
- // day of week
-
- it('dd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(parse('Fr', 'dd')).to.eql(now);
- });
- it('ddd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(parse('Fri', 'ddd')).to.eql(now);
- });
- it('dddd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(parse('Friday', 'dddd')).to.eql(now);
- });
-
- // meridiem
-
- const A = ['AM', 'PM'];
- const AA = ['A.M.', 'P.M.'];
- const a = ['am', 'pm'];
- const aa = ['a.m.', 'p.m.'];
-
- it('A, ante meridiem', () => {
- const now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'A')).to.equal(A[0]);
- });
- it('A, post meridiem', () => {
- const now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'A')).to.equal(A[1]);
- });
- it('a, ante meridiem', () => {
- const now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'a')).to.equal(a[0]);
- });
- it('a, post meridiem', () => {
- const now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'a')).to.equal(a[1]);
- });
- it('AA, ante meridiem', () => {
- const now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'AA')).to.equal(AA[0]);
- });
- it('AA, post meridiem', () => {
- const now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'AA')).to.equal(AA[1]);
- });
- it('aa, ante meridiem', () => {
- const now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(format(now, 'aa')).to.equal(aa[0]);
- });
- it('aa, post meridiem', () => {
- const now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(format(now, 'aa')).to.equal(aa[1]);
- });
- it('parse a.m.', () => {
- const now = new Date(1970, 0, 1, 0, 34);
- expect(parse('00:34 a.m.', 'hh:mm aa')).to.eql(now);
- });
- it('parse p.m.', () => {
- const now = new Date(1970, 0, 1, 12, 34);
- expect(parse('00:34 p.m.', 'hh:mm aa')).to.eql(now);
- });
- it('parse A.M.', () => {
- const now = new Date(1970, 0, 1, 0, 34);
- expect(parse('00:34 A.M.', 'hh:mm AA')).to.eql(now);
- });
- it('parse P.M.', () => {
- const now = new Date(1970, 0, 1, 12, 34);
- expect(parse('00:34 P.M.', 'hh:mm AA')).to.eql(now);
- });
- it('parse AM', () => {
- const now = new Date(1970, 0, 1, 0, 34);
- expect(parse('00:34 AM', 'hh:mm A')).to.eql(now);
- });
- it('parse PM', () => {
- const now = new Date(1970, 0, 1, 12, 34);
- expect(parse('00:34 PM', 'hh:mm A')).to.eql(now);
- });
- it('parse am', () => {
- const now = new Date(1970, 0, 1, 0, 34);
- expect(parse('00:34 am', 'hh:mm a')).to.eql(now);
- });
- it('parse pm', () => {
- const now = new Date(1970, 0, 1, 12, 34);
- expect(parse('00:34 pm', 'hh:mm a')).to.eql(now);
- });
-
- // microsecond
-
- it('SSSS', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 123);
- expect(parse('0.1234', '0.SSSS')).to.eql(now);
- });
- it('SSSSS', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 12);
- expect(parse('0.01234', '0.SSSSS')).to.eql(now);
- });
- it('SSSSSS', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 1);
- expect(parse('0.001234', '0.SSSSSS')).to.eql(now);
- });
-
- // ordinal number
-
- it('Jan. XX, 2019', () => {
- for (let i = 1, d, now; i <= 31; i++) {
- now = new Date(2019, 0, i, 12, 34, 56, 789);
- switch (i) {
- case 1:
- case 21:
- case 31:
- d = i + 'st';
- break;
- case 2:
- case 22:
- d = i + 'nd';
- break;
- case 3:
- case 23:
- d = i + 'rd';
- break;
- default:
- d = i + 'th';
- break;
- }
- expect(format(now, 'MMM. DDD, YYYY')).to.equal('Jan. ' + d + ', 2019');
- }
- });
-
- // timespan
-
- it('toMilliseconds, S', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toMilliseconds('S')).to.equal('1');
- });
- it('toMilliseconds, SS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toMilliseconds('SS')).to.equal('01');
- });
- it('toMilliseconds, SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toMilliseconds('SSS')).to.equal('001');
- });
- it('toMilliseconds, over SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toMilliseconds('SSS')).to.equal('' + 31 * 24 * 60 * 60 * 1000);
- });
- it('toMilliseconds, over SSS, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toMilliseconds('SSS')).to.equal('-' + 31 * 24 * 60 * 60 * 1000);
- });
- it('toSeconds, s', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toSeconds('s')).to.equal('0');
- });
- it('toSeconds, ss', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toSeconds('ss')).to.equal('00');
- });
- it('toSeconds, over ss', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toSeconds('ss')).to.equal('' + 31 * 24 * 60 * 60);
- });
- it('toSeconds, over ss, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toSeconds('ss')).to.equal('-' + 31 * 24 * 60 * 60);
- });
- it('toSeconds, over ss.SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 57, 790);
- expect(timeSpan(to, from).toSeconds('ss.SSS')).to.equal('01.001');
- });
- it('toSeconds, over ss.SSS, negative', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 790);
- const to = new Date(2019, 0, 1, 0, 34, 55, 789);
- expect(timeSpan(to, from).toSeconds('ss.SSS')).to.equal('-01.001');
- });
- it('toMinutes, m', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toMinutes('m')).to.equal('0');
- });
- it('toMinutes, mm', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toMinutes('mm')).to.equal('00');
- });
- it('toMinutes, over mm', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toMinutes('mm')).to.equal('' + 31 * 24 * 60);
- });
- it('toMinutes, over mm, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toMinutes('mm')).to.equal('-' + 31 * 24 * 60);
- });
- it('toMinutes, over mm:ss.SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 35, 57, 790);
- expect(timeSpan(to, from).toMinutes('mm:ss.SSS')).to.equal('01:01.001');
- });
- it('toMinutes, over mm:ss.SSS, negative', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 790);
- const to = new Date(2019, 0, 1, 0, 33, 55, 789);
- expect(timeSpan(to, from).toMinutes('mm:ss.SSS')).to.equal('-01:01.001');
- });
- it('toHours, H', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toHours('H')).to.equal('0');
- });
- it('toHours, HH', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toHours('HH')).to.equal('00');
- });
- it('toHours, over HH', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toHours('HH')).to.equal('' + 31 * 24);
- });
- it('toHours, over HH, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toHours('HH')).to.equal('-' + 31 * 24);
- });
- it('toHours, over HH:mm:ss.SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 1, 35, 57, 790);
- expect(timeSpan(to, from).toHours('HH:mm:ss.SSS')).to.equal('01:01:01.001');
- });
- it('toHours, over HH:mm:ss.SSS, negative', () => {
- const from = new Date(2019, 0, 1, 1, 34, 56, 790);
- const to = new Date(2019, 0, 1, 0, 33, 55, 789);
- expect(timeSpan(to, from).toHours('HH:mm:ss.SSS')).to.equal('-01:01:01.001');
- });
- it('toDays, D', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toDays('D')).to.equal('0');
- });
- it('toDays, DD', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(timeSpan(to, from).toDays('DD')).to.equal('00');
- });
- it('toDays, over DD', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toDays('DD')).to.equal('' + 31);
- });
- it('toDays, over DD, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(timeSpan(to, from).toDays('DD')).to.equal('-' + 31);
- });
- it('toDays, over DD HH:mm:ss.SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 2, 1, 35, 57, 790);
- expect(timeSpan(to, from).toDays('DD HH:mm:ss.SSS')).to.equal('01 01:01:01.001');
- });
- it('toDays, over DD HH:mm:ss.SSS, negative', () => {
- const from = new Date(2019, 0, 1, 1, 34, 56, 790);
- const to = new Date(2019, 0, 0, 0, 33, 55, 789);
- expect(timeSpan(to, from).toDays('DD HH:mm:ss.SSS')).to.equal('-01 01:01:01.001');
- });
- it('comments', () => {
- const from = new Date(2019, 0, 1, 1, 34, 56, 790);
- const to = new Date(2019, 0, 0, 0, 33, 55, 789);
- expect(timeSpan(to, from).toDays('[DD HH:mm:ss.SSS]')).to.equal('DD HH:mm:ss.SSS');
- });
-
- // timezone
-
- it('formatTZ UTC-8', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- const formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 UTC-0800');
- });
- it('formatTZ UTC-7 (Start of DST)', () => {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- const dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 3:00:00.000 UTC-0700');
- });
- it('formatTZ UTC-7 (End of DST)', () => {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- const dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:59:59.999 UTC-0700');
- });
- it('formatTZ UTC-8', () => {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- const dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:00:00.000 UTC-0800');
- });
- it('formatTZ UTC+9', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- const formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 18:59:59.999 UTC+0900');
- });
-
- it('parseTZ UTC-8', () => {
- // Mar 14 2021 1:59:59.999 => 2021-03-14T09:59:59.999Z
- const dateString = 'Mar 14 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Failure1', () => {
- // Mar 14 2021 2:00:00.000 => NaN
- const dateString = 'Mar 14 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles';
-
- expect(parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
- it('parseTZ Failure2', () => {
- // Mar 14 2021 2:59:59.999 => NaN
- const dateString = 'Mar 14 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles';
-
- expect(parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
- it('parseTZ UTC-7 (Start of DST)', () => {
- // Mar 14 2021 3:00:00.000 => 2021-03-14T10:00:00.000Z
- const dateString = 'Mar 14 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
- const dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-7 (End of DST)', () => {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T08:59:59.999Z
- const dateString = 'Nov 7 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
- const dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-8 with Z', () => {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T09:59:59.999Z
- const dateString = 'Nov 7 2021 1:59:59.999 -0800';
- const formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 10, 7, 9, 59, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-8', () => {
- // Nov 7 2021 2:00:00.000 => 2021-11-07T10:00:00.000Z
- const dateString = 'Nov 7 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 10, 7, 10, 0, 0, 0));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5', () => {
- // Oct 3 2021 1:59:59.999 => 2021-10-02T16:29:59.999Z
- const dateString = 'Oct 3 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 29, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Failure1', () => {
- // Oct 3 2021 2:00:00.000 => NaN
- const dateString = 'Oct 3 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide';
-
- expect(parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
- it('parseTZ Failure2', () => {
- // Oct 3 2021 2:59:59.999 => NaN
- const dateString = 'Oct 3 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide';
-
- expect(parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
- it('parseTZ UTC+10.5 (Start of DST)', () => {
- // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
- const dateString = 'Oct 3 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+10.5 DST
- const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+10.5 (End of DST)', () => {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T16:29:59.999Z
- const dateString = 'Apr 4 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+10.5 DST
- const dateObj = new Date(Date.UTC(2021, 3, 3, 16, 29, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5 with Z', () => {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T17:29:59.999Z
- const dateString = 'Apr 4 2021 2:59:59.999 +0930';
- const formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 3, 3, 17, 29, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5', () => {
- // Apr 4 2021 3:00:00.000 => 2021-04-03T17:30:00.000Z
- const dateString = 'Apr 4 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 3, 3, 17, 30, 0, 0));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('transformTZ EST to PST', () => {
- const dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- const dateString2 = 'November 7 2021 1:00:00.000';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EST to PDT (End of DST)', () => {
- const dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- const dateString2 = 'November 7 2021 1:59:59.999';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EDT to PST', () => {
- const dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- const dateString2 = 'March 14 2021 1:59:59.999';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EDT to PDT (Start of DST)', () => {
- const dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- const dateString2 = 'March 14 2021 3:00:00.000';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ PST to JST', () => {
- const dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- const dateString2 = 'March 14 2021 18:59:59.999';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ PDT to JST', () => {
- const dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- const dateString2 = 'March 14 2021 19:00:00.000';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- // two-digit-year
-
- it('YY', () => {
- const obj = ['YY', 'YY'];
- expect(compile('YY')).to.eql(obj);
- });
-
- it('YY-1', () => {
- const dt = { Y: 2000, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(preparse('00', 'YY')).to.eql(dt);
- });
- it('YY-2', () => {
- const dt = { Y: 2001, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(preparse('01', 'YY')).to.eql(dt);
- });
- it('YY-3', () => {
- const dt = { Y: 2010, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(preparse('10', 'YY')).to.eql(dt);
- });
- it('YY-4', () => {
- const dt = { Y: 2069, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(preparse('69', 'YY')).to.eql(dt);
- });
- it('YY-5', () => {
- const dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(preparse('70', 'YY')).to.eql(dt);
- });
- it('YY-6', () => {
- const dt = { Y: 1999, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(preparse('99', 'YY')).to.eql(dt);
- });
-
- it('YY-1', () => {
- const now = new Date(2000, 0, 1);
- expect(parse('00', 'YY')).to.eql(now);
- });
- it('YY-2', () => {
- const now = new Date(2001, 0, 1);
- expect(parse('01', 'YY')).to.eql(now);
- });
- it('YY-3', () => {
- const now = new Date(2010, 0, 1);
- expect(parse('10', 'YY')).to.eql(now);
- });
- it('YY-4', () => {
- const now = new Date(2069, 0, 1);
- expect(parse('69', 'YY')).to.eql(now);
- });
- it('YY-5', () => {
- const now = new Date(1970, 0, 1);
- expect(parse('70', 'YY')).to.eql(now);
- });
- it('YY-6', () => {
- const now = new Date(1999, 0, 1);
- expect(parse('99', 'YY')).to.eql(now);
- });
-});
-
-describe('Applying locale changes to plugins', () => {
- let formatTZ, parseTZ;
-
- before(() => {
- locale(es);
- plugin(day_of_week);
- plugin(timezone);
-
- ({ formatTZ, parseTZ } = date);
- });
-
- // day of week
-
- it('dd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(parse('ju', 'dd')).to.eql(now);
- });
- it('ddd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(parse('jue.', 'ddd')).to.eql(now);
- });
- it('dddd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(parse('jueves', 'dddd')).to.eql(now);
- });
-
- // timezone
-
- it('formatTZ UTC-8', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- const formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('marzo 14 2021 1:59:59.999 UTC-0800');
- });
- it('formatTZ UTC-7 (Start of DST)', () => {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- const dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('marzo 14 2021 3:00:00.000 UTC-0700');
- });
- it('formatTZ UTC-7 (End of DST)', () => {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- const dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('noviembre 7 2021 1:59:59.999 UTC-0700');
- });
- it('formatTZ UTC-8', () => {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- const dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('noviembre 7 2021 1:00:00.000 UTC-0800');
- });
- it('formatTZ UTC+9', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- const formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- expect(formatTZ(dateObj, formatString, tz)).to.equal('marzo 14 2021 18:59:59.999 UTC+0900');
- });
-
- it('parseTZ UTC-8', () => {
- // Mar 14 2021 1:59:59.999 => 2021-03-14T09:59:59.999Z
- const dateString = 'mar. 14 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Failure1', () => {
- // Mar 14 2021 2:00:00.000 => NaN
- const dateString = 'mar. 14 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles';
-
- expect(parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
- it('parseTZ Failure2', () => {
- // Mar 14 2021 2:59:59.999 => NaN
- const dateString = 'mar. 14 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles';
-
- expect(parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
- it('parseTZ UTC-7 (Start of DST)', () => {
- // Mar 14 2021 3:00:00.000 => 2021-03-14T10:00:00.000Z
- const dateString = 'mar. 14 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
- const dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-7 (End of DST)', () => {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T08:59:59.999Z
- const dateString = 'nov. 7 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
- const dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-8 with Z', () => {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T09:59:59.999Z
- const dateString = 'nov. 7 2021 1:59:59.999 -0800';
- const formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 10, 7, 9, 59, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC-8', () => {
- // Nov 7 2021 2:00:00.000 => 2021-11-07T10:00:00.000Z
- const dateString = 'nov. 7 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 10, 7, 10, 0, 0, 0));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5', () => {
- // Oct 3 2021 1:59:59.999 => 2021-10-02T16:29:59.999Z
- const dateString = 'oct. 3 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 29, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ Failure1', () => {
- // Oct 3 2021 2:00:00.000 => NaN
- const dateString = 'oct. 3 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide';
-
- expect(parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
- it('parseTZ Failure2', () => {
- // Oct 3 2021 2:59:59.999 => NaN
- const dateString = 'oct. 3 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide';
-
- expect(parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
- it('parseTZ UTC+10.5 (Start of DST)', () => {
- // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
- const dateString = 'oct. 3 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+10.5 DST
- const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+10.5 (End of DST)', () => {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T16:29:59.999Z
- const dateString = 'abr. 4 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+10.5 DST
- const dateObj = new Date(Date.UTC(2021, 3, 3, 16, 29, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5 with Z', () => {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T17:29:59.999Z
- const dateString = 'abr. 4 2021 2:59:59.999 +0930';
- const formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 3, 3, 17, 29, 59, 999));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('parseTZ UTC+9.5', () => {
- // Apr 4 2021 3:00:00.000 => 2021-04-03T17:30:00.000Z
- const dateString = 'abr. 4 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 3, 3, 17, 30, 0, 0));
-
- expect(parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- it('transformTZ EST to PST', () => {
- const dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- const dateString2 = 'noviembre 7 2021 1:00:00.000';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EST to PDT (End of DST)', () => {
- const dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- const dateString2 = 'noviembre 7 2021 1:59:59.999';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EDT to PST', () => {
- const dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- const dateString2 = 'marzo 14 2021 1:59:59.999';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ EDT to PDT (Start of DST)', () => {
- const dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- const dateString2 = 'marzo 14 2021 3:00:00.000';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ PST to JST', () => {
- const dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- const dateString2 = 'marzo 14 2021 18:59:59.999';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- it('transformTZ PDT to JST', () => {
- const dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- const dateString2 = 'marzo 14 2021 19:00:00.000';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- after(() => {
- locale(en);
- });
-});
-
-describe('Applying other plugins to formatTZ, parseTZ and transformTZ', () => {
- before(() => {
- date.plugin(meridiem);
- date.plugin(timezone);
- });
-
- it('formatTZ UTC-8', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY h:mm:ss.SSS AA [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 A.M. UTC-0800');
- });
-
- it('parseTZ UTC+10.5 (Start of DST)', () => {
- // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
- var dateString = 'Oct 3 2021 3:00:00.000 A.M.';
- var formatString = 'MMM D YYYY h:mm:ss.SSS AA';
- var tz = 'Australia/Adelaide'; // UTC+10.5 DST
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('transformTZ PDT to JST', () => {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY h:mm:ss.SSS AA';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 7:00:00.000 P.M.';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-});
diff --git a/test/esm/locale/ar.mjs b/test/esm/locale/ar.mjs
deleted file mode 100644
index bfaf95a..0000000
--- a/test/esm/locale/ar.mjs
+++ /dev/null
@@ -1,94 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import ar from 'date-and-time/locale/ar';
-
-import expect from 'expect.js';
-
-const MMMM = ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'];
-const MMM = ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'];
-const dddd = ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'];
-const ddd = ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'];
-const dd = ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'];
-const A = [
- 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص',
- 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م'
-];
-
-describe('format with "ar"', () => {
- before(() => date.locale(ar));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('numeric expression', () => {
- const now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '٢٠١٦٠١٠١٠٢٣٤٥٦٧٨٩';
- expect(date.format(now, 'YYYYMMDDHHmmssSSS')).to.equal(str);
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "ar"', () => {
- before(() => date.locale(ar));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
- it('numeric expression', () => {
- const now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '٢٠١٦٠١٠١٠٢٣٤٥٦٧٨٩';
- expect(date.parse(str, 'YYYYMMDDHHmmssSSS')).to.eql(now);
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/az.mjs b/test/esm/locale/az.mjs
deleted file mode 100644
index c87d301..0000000
--- a/test/esm/locale/az.mjs
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import az from 'date-and-time/locale/az';
-
-import expect from 'expect.js';
-
-const MMMM = ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'];
-const MMM = ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'];
-const dddd = ['Bazar', 'Bazar ertəsi', 'Çərşənbə axşamı', 'Çərşənbə', 'Cümə axşamı', 'Cümə', 'Şənbə'];
-const ddd = ['Baz', 'BzE', 'ÇAx', 'Çər', 'CAx', 'Cüm', 'Şən'];
-const dd = ['Bz', 'BE', 'ÇA', 'Çə', 'CA', 'Cü', 'Şə'];
-const A = [
- 'gecə', 'gecə', 'gecə', 'gecə', // 0 - 3
- 'səhər', 'səhər', 'səhər', 'səhər', 'səhər', 'səhər', 'səhər', 'səhər', // 4 - 11
- 'gündüz', 'gündüz', 'gündüz', 'gündüz', 'gündüz', // 12 - 16
- 'axşam', 'axşam', 'axşam', 'axşam', 'axşam', 'axşam', 'axşam' // 17 - 23
-];
-
-describe('format with "az"', () => {
- before(() => date.locale(az));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "az"', () => {
- before(() => date.locale(az));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/bn.mjs b/test/esm/locale/bn.mjs
deleted file mode 100644
index 577d83a..0000000
--- a/test/esm/locale/bn.mjs
+++ /dev/null
@@ -1,87 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import bn from 'date-and-time/locale/bn';
-
-import expect from 'expect.js';
-
-const MMMM = ['জানুয়ারী', 'ফেবুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'];
-const MMM = ['জানু', 'ফেব', 'মার্চ', 'এপর', 'মে', 'জুন', 'জুল', 'অগ', 'সেপ্ট', 'অক্টো', 'নভ', 'ডিসেম্'];
-const dddd = ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পত্তিবার', 'শুক্রবার', 'শনিবার'];
-const ddd = ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পত্তি', 'শুক্র', 'শনি'];
-const dd = ['রব', 'সম', 'মঙ্গ', 'বু', 'ব্রিহ', 'শু', 'শনি'];
-const A = [
- 'রাত', 'রাত', 'রাত', 'রাত', // 0 - 3
- 'সকাল', 'সকাল', 'সকাল', 'সকাল', 'সকাল', 'সকাল', // 4 - 9
- 'দুপুর', 'দুপুর', 'দুপুর', 'দুপুর', 'দুপুর', 'দুপুর', 'দুপুর', // 10 - 16
- 'বিকাল', 'বিকাল', 'বিকাল', // 17 - 19
- 'রাত', 'রাত', 'রাত', 'রাত' // 20 - 23
-];
-
-describe('format with "bn"', () => {
- before(() => date.locale(bn));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "bn"', () => {
- before(() => date.locale(bn));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/cs.mjs b/test/esm/locale/cs.mjs
deleted file mode 100644
index ad2a175..0000000
--- a/test/esm/locale/cs.mjs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import cs from 'date-and-time/locale/cs';
-
-import expect from 'expect.js';
-
-const MMMM = ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'];
-const MMM = ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'];
-const dddd = ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'];
-const ddd = ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'];
-const dd = ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'];
-
-describe('format with "cs"', () => {
- before(() => date.locale(cs));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "cs"', () => {
- before(() => date.locale(cs));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/de.mjs b/test/esm/locale/de.mjs
deleted file mode 100644
index fd71d20..0000000
--- a/test/esm/locale/de.mjs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import de from 'date-and-time/locale/de';
-
-import expect from 'expect.js';
-
-const MMMM = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
-const MMM = ['Jan.', 'Febr.', 'Mrz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'];
-const dddd = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'];
-const ddd = ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'];
-const dd = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'];
-const A = [
- 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags',
- 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens'
-];
-
-describe('format with "de"', () => {
- before(() => date.locale(de));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "de"', () => {
- before(() => date.locale(de));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/dk.mjs b/test/esm/locale/dk.mjs
deleted file mode 100644
index 12c3dbc..0000000
--- a/test/esm/locale/dk.mjs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import dk from 'date-and-time/locale/dk';
-
-import expect from 'expect.js';
-
-const MMMM = ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'];
-const MMM = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'];
-const dddd = ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'];
-const ddd = ['søn', 'man', 'tir', 'ons', 'tors', 'fre', 'lør'];
-const dd = ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'];
-
-describe('format with "dk"', () => {
- before(() => date.locale(dk));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "dk"', () => {
- before(() => date.locale(dk));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/el.mjs b/test/esm/locale/el.mjs
deleted file mode 100644
index dc71fe9..0000000
--- a/test/esm/locale/el.mjs
+++ /dev/null
@@ -1,123 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import el from 'date-and-time/locale/el';
-
-import expect from 'expect.js';
-
-const MMMM = {
- nominative: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
- genitive: ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
-};
-const MMM = ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'];
-const dddd = ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'];
-const ddd = ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'];
-const dd = ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'];
-const A = [
- 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ',
- 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ'
-];
-
-describe('format with "el"', () => {
- before(() => date.locale(el));
-
- MMMM.nominative.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMMM.genitive.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'DD MMMM')).to.equal('01 ' + m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('"hh" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('00');
- });
- it('"hh" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('00');
- });
- it('"hh" equals to "11"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('11');
- });
- it('"h" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('0');
- });
- it('"h" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('0');
- });
- it('"h" equals to "11"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('11');
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "el"', () => {
- before(() => date.locale(el));
-
- MMMM.nominative.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMMM.genitive.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse('01 ' + m, 'DD MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/es.mjs b/test/esm/locale/es.mjs
deleted file mode 100644
index 17ef6e6..0000000
--- a/test/esm/locale/es.mjs
+++ /dev/null
@@ -1,85 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import es from 'date-and-time/locale/es';
-
-import expect from 'expect.js';
-
-const MMMM = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
-const MMM = ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'];
-const dddd = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'];
-const ddd = ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'];
-const dd = ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'];
-const A = [
- 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', // 0 - 11
- 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', // 12 - 18
- 'de la noche', 'de la noche', 'de la noche', 'de la noche', 'de la noche' // 19 - 23
-];
-
-describe('format with "es"', () => {
- before(() => date.locale(es));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "es"', () => {
- before(() => date.locale(es));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/fa.mjs b/test/esm/locale/fa.mjs
deleted file mode 100644
index 7ce3433..0000000
--- a/test/esm/locale/fa.mjs
+++ /dev/null
@@ -1,94 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import fa from 'date-and-time/locale/fa';
-
-import expect from 'expect.js';
-
-const MMMM = ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'];
-const MMM = ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'];
-const dddd = ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'];
-const ddd = ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'];
-const dd = ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'];
-const A = [
- 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر',
- 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر'
-];
-
-describe('format with "fa"', () => {
- before(() => date.locale(fa));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('numeric expression', () => {
- const now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '۲۰۱۶۰۱۰۱۰۲۳۴۵۶۷۸۹';
- expect(date.format(now, 'YYYYMMDDHHmmssSSS')).to.equal(str);
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "fa"', () => {
- before(() => date.locale(fa));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
- it('numeric expression', () => {
- const now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '۲۰۱۶۰۱۰۱۰۲۳۴۵۶۷۸۹';
- expect(date.parse(str, 'YYYYMMDDHHmmssSSS')).to.eql(now);
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/fr.mjs b/test/esm/locale/fr.mjs
deleted file mode 100644
index d3e0db7..0000000
--- a/test/esm/locale/fr.mjs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import fr from 'date-and-time/locale/fr';
-
-import expect from 'expect.js';
-
-const MMMM = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'];
-const MMM = ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'];
-const dddd = ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'];
-const ddd = ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'];
-const dd = ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'];
-const A = [
- 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin',
- 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi'
-];
-
-describe('format with "fr"', () => {
- before(() => date.locale(fr));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "fr"', () => {
- before(() => date.locale(fr));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/hi.mjs b/test/esm/locale/hi.mjs
deleted file mode 100644
index d830168..0000000
--- a/test/esm/locale/hi.mjs
+++ /dev/null
@@ -1,87 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import hi from 'date-and-time/locale/hi';
-
-import expect from 'expect.js';
-
-const MMMM = ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'];
-const MMM = ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'];
-const dddd = ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'];
-const ddd = ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'];
-const dd = ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'];
-const A = [
- 'रात', 'रात', 'रात', 'रात', // 0 - 3
- 'सुबह', 'सुबह', 'सुबह', 'सुबह', 'सुबह', 'सुबह', // 4 - 9
- 'दोपहर', 'दोपहर', 'दोपहर', 'दोपहर', 'दोपहर', 'दोपहर', 'दोपहर', // 10 - 16
- 'शाम', 'शाम', 'शाम', // 17 - 19
- 'रात', 'रात', 'रात', 'रात' // 20 - 23
-];
-
-describe('format with "hi"', () => {
- before(() => date.locale(hi));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "hi"', () => {
- before(() => date.locale(hi));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/hu.mjs b/test/esm/locale/hu.mjs
deleted file mode 100644
index 832a8dd..0000000
--- a/test/esm/locale/hu.mjs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import hu from 'date-and-time/locale/hu';
-
-import expect from 'expect.js';
-
-const MMMM = ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'];
-const MMM = ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'];
-const dddd = ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'];
-const ddd = ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'];
-const dd = ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'];
-const A = [
- 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de',
- 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du'
-];
-
-describe('format with "hu"', () => {
- before(() => date.locale(hu));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "hu"', () => {
- before(() => date.locale(hu));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/id.mjs b/test/esm/locale/id.mjs
deleted file mode 100644
index 794a553..0000000
--- a/test/esm/locale/id.mjs
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import id from 'date-and-time/locale/id';
-
-import expect from 'expect.js';
-
-const MMMM = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
-const MMM = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'];
-const dddd = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'];
-const ddd = ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'];
-const dd = ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'];
-const A = [
- 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', // 0 - 10
- 'siang', 'siang', 'siang', 'siang', // 11 - 14
- 'sore', 'sore', 'sore', 'sore', // 15 - 18
- 'malam', 'malam', 'malam', 'malam', 'malam' // 19 - 23
-];
-
-describe('format with "id"', () => {
- before(() => date.locale(id));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "id"', () => {
- before(() => date.locale(id));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/it.mjs b/test/esm/locale/it.mjs
deleted file mode 100644
index cfb0cd7..0000000
--- a/test/esm/locale/it.mjs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import italian from 'date-and-time/locale/it';
-
-import expect from 'expect.js';
-
-const MMMM = ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'];
-const MMM = ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'];
-const dddd = ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'];
-const ddd = ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'];
-const dd = ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'];
-const A = [
- 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina',
- 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio'
-];
-
-describe('format with "it"', () => {
- before(() => date.locale(italian));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "it"', () => {
- before(() => date.locale(italian));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/ja.mjs b/test/esm/locale/ja.mjs
deleted file mode 100644
index 935dfcc..0000000
--- a/test/esm/locale/ja.mjs
+++ /dev/null
@@ -1,108 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import ja from 'date-and-time/locale/ja';
-
-import expect from 'expect.js';
-
-const MMMM = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
-const MMM = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
-const dddd = ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'];
-const ddd = ['日', '月', '火', '水', '木', '金', '土'];
-const dd = ['日', '月', '火', '水', '木', '金', '土'];
-const A = [
- '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前',
- '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後'
-];
-
-describe('format with "ja"', () => {
- before(() => date.locale(ja));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('"hh" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('00');
- });
- it('"hh" equals to "00"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('00');
- });
- it('"hh" equals to "11"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('11');
- });
- it('"h" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('0');
- });
- it('"h" equals to "0"', () => {
- const now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('0');
- });
- it('"h" equals to "11"', () => {
- const now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('11');
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "ja"', () => {
- before(() => date.locale(ja));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/jv.mjs b/test/esm/locale/jv.mjs
deleted file mode 100644
index cf6cf35..0000000
--- a/test/esm/locale/jv.mjs
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import jv from 'date-and-time/locale/jv';
-
-import expect from 'expect.js';
-
-const MMMM = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'];
-const MMM = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'];
-const dddd = ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'];
-const ddd = ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'];
-const dd = ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'];
-const A = [
- 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', // 0 - 10
- 'siyang', 'siyang', 'siyang', 'siyang', // 11 - 14
- 'sonten', 'sonten', 'sonten', 'sonten', // 15 - 18
- 'ndalu', 'ndalu', 'ndalu', 'ndalu', 'ndalu' // 19 - 23
-];
-
-describe('format with "jv"', () => {
- before(() => date.locale(jv));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "jv"', () => {
- before(() => date.locale(jv));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/ko.mjs b/test/esm/locale/ko.mjs
deleted file mode 100644
index 363821d..0000000
--- a/test/esm/locale/ko.mjs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import ko from 'date-and-time/locale/ko';
-
-import expect from 'expect.js';
-
-const MMMM = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'];
-const MMM = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'];
-const dddd = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'];
-const ddd = ['일', '월', '화', '수', '목', '금', '토'];
-const dd = ['일', '월', '화', '수', '목', '금', '토'];
-const A = [
- '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전',
- '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후'
-];
-
-describe('format with "ko"', function () {
- before(() => date.locale(ko));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "ko"', function () {
- before(() => date.locale(ko));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/my.mjs b/test/esm/locale/my.mjs
deleted file mode 100644
index 037bb93..0000000
--- a/test/esm/locale/my.mjs
+++ /dev/null
@@ -1,78 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import my from 'date-and-time/locale/my';
-
-import expect from 'expect.js';
-
-const MMMM = ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'];
-const MMM = ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'];
-const dddd = ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'];
-const ddd = ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'];
-const dd = ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'];
-
-describe('format with "my"', () => {
- before(() => date.locale(my));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- it('numeric expression', () => {
- const now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '၂၀၁၆၀၁၀၁၀၂၃၄၅၆၇၈၉';
- expect(date.format(now, 'YYYYMMDDHHmmssSSS')).to.equal(str);
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "my"', () => {
- before(() => date.locale(my));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- it('numeric expression', () => {
- const now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '၂၀၁၆၀၁၀၁၀၂၃၄၅၆၇၈၉';
- expect(date.parse(str, 'YYYYMMDDHHmmssSSS')).to.eql(now);
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/nl.mjs b/test/esm/locale/nl.mjs
deleted file mode 100644
index cc5589c..0000000
--- a/test/esm/locale/nl.mjs
+++ /dev/null
@@ -1,83 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import nl from 'date-and-time/locale/nl';
-
-import expect from 'expect.js';
-
-const MMMM = ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'];
-const MMM = {
- withdots: ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
- withoutdots: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
-};
-const dddd = ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'];
-const ddd = ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'];
-const dd = ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'];
-
-describe('format with "nl"', () => {
- before(() => date.locale(nl));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.withdots.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- MMM.withoutdots.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, '-MMM-')).to.equal('-' + m + '-');
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "nl"', () => {
- before(() => date.locale(nl));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.withdots.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- MMM.withoutdots.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse('-' + m + '-', '-MMM-')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/pa-in.mjs b/test/esm/locale/pa-in.mjs
deleted file mode 100644
index 49acdc1..0000000
--- a/test/esm/locale/pa-in.mjs
+++ /dev/null
@@ -1,97 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import pa_in from 'date-and-time/locale/pa-in';
-
-import expect from 'expect.js';
-
-const MMMM = ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'];
-const MMM = ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'];
-const dddd = ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'];
-const ddd = ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'];
-const dd = ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'];
-const A = [
- 'ਰਾਤ', 'ਰਾਤ', 'ਰਾਤ', 'ਰਾਤ', // 0 - 3
- 'ਸਵੇਰ', 'ਸਵੇਰ', 'ਸਵੇਰ', 'ਸਵੇਰ', 'ਸਵੇਰ', 'ਸਵੇਰ', // 4 - 9
- 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', // 10 - 16
- 'ਸ਼ਾਮ', 'ਸ਼ਾਮ', 'ਸ਼ਾਮ', // 17 - 19
- 'ਰਾਤ', 'ਰਾਤ', 'ਰਾਤ', 'ਰਾਤ' // 20 - 23
-];
-
-describe('format with "pa-in"', function () {
- before(() => date.locale(pa_in));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '੨੦੧੬੦੧੦੧੦੨੩੪੫੬੭੮੯';
- expect(date.format(now, 'YYYYMMDDHHmmssSSS')).to.equal(str);
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "pa-in"', function () {
- before(() => date.locale(pa_in));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '੨੦੧੬੦੧੦੧੦੨੩੪੫੬੭੮੯';
- expect(date.parse(str, 'YYYYMMDDHHmmssSSS')).to.eql(now);
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/pl.mjs b/test/esm/locale/pl.mjs
deleted file mode 100644
index 9d28f5e..0000000
--- a/test/esm/locale/pl.mjs
+++ /dev/null
@@ -1,83 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import pl from 'date-and-time/locale/pl';
-
-import expect from 'expect.js';
-
-const MMMM = {
- nominative: ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'],
- subjective: ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia']
-};
-const MMM = ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'];
-const dddd = ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'];
-const ddd = ['nie', 'pon', 'wt', 'śr', 'czw', 'pt', 'sb'];
-const dd = ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'];
-
-describe('format with "pl"', () => {
- before(() => date.locale(pl));
-
- MMMM.nominative.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMMM.subjective.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'DD MMMM')).to.equal('01 ' + m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "pl"', () => {
- before(() => date.locale(pl));
-
- MMMM.nominative.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMMM.subjective.forEach((m, i) => {
- it('"DD MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse('01 ' + m, 'DD MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/pt.mjs b/test/esm/locale/pt.mjs
deleted file mode 100644
index b2b50f0..0000000
--- a/test/esm/locale/pt.mjs
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import pt from 'date-and-time/locale/pt';
-
-import expect from 'expect.js';
-
-const MMMM = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'];
-const MMM = ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'];
-const dddd = ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado'];
-const ddd = ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'];
-const dd = ['Dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sáb'];
-const A = [
- 'da madrugada', 'da madrugada', 'da madrugada', 'da madrugada', 'da madrugada', // 0 - 4
- 'da manhã', 'da manhã', 'da manhã', 'da manhã', 'da manhã', 'da manhã', 'da manhã', // 5 - 11
- 'da tarde', 'da tarde', 'da tarde', 'da tarde', 'da tarde', 'da tarde', 'da tarde', // 12 - 18
- 'da noite', 'da noite', 'da noite', 'da noite', 'da noite' // 19 - 23
-];
-
-describe('format with "pt"', () => {
- before(() => date.locale(pt));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "pt"', () => {
- before(() => date.locale(pt));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/ro.mjs b/test/esm/locale/ro.mjs
deleted file mode 100644
index 6bb3e4d..0000000
--- a/test/esm/locale/ro.mjs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import ro from 'date-and-time/locale/ro';
-
-import expect from 'expect.js';
-
-const MMMM = ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'];
-const MMM = ['ian.', 'febr.', 'mart.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'];
-const dddd = ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'];
-const ddd = ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'];
-const dd = ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ'];
-
-describe('format with "ro"', () => {
- before(() => date.locale(ro));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "ro"', () => {
- before(() => date.locale(ro));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/ru.mjs b/test/esm/locale/ru.mjs
deleted file mode 100644
index 9cdcb08..0000000
--- a/test/esm/locale/ru.mjs
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import ru from 'date-and-time/locale/ru';
-
-import expect from 'expect.js';
-
-const MMMM = ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'];
-const MMM = ['янв', 'фев', 'мар', 'апр', 'мая', 'июня', 'июля', 'авг', 'сен', 'окт', 'ноя', 'дек'];
-const dddd = ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'];
-const ddd = ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'];
-const dd = ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'];
-const A = [
- 'ночи', 'ночи', 'ночи', 'ночи', // 0 - 3
- 'утра', 'утра', 'утра', 'утра', 'утра', 'утра', 'утра', 'утра', // 4 - 11
- 'дня', 'дня', 'дня', 'дня', 'дня', // 12 - 17
- 'вечера', 'вечера', 'вечера', 'вечера', 'вечера', 'вечера', 'вечера' // 18 - 23
-];
-
-describe('format with "ru"', () => {
- before(() => date.locale(ru));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "ru"', () => {
- before(() => date.locale(ru));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/rw.mjs b/test/esm/locale/rw.mjs
deleted file mode 100644
index 387b342..0000000
--- a/test/esm/locale/rw.mjs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import rw from 'date-and-time/locale/rw';
-
-import expect from 'expect.js';
-
-const MMMM = ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'];
-const MMM = ['Mtr', 'Gas', 'Wer', 'Mta', 'Gic', 'Kmn', 'Nyk', 'Knm', 'Nze', 'Ukw', 'Ugu', 'Uku'];
-const dddd = ['Ku cyumweru', 'Ku wambere', 'Ku wakabiri', 'Ku wagatatu', 'Ku wakane', 'Ku wagatanu', 'Ku wagatandatu'];
-const ddd = ['Cyu', 'Mbe', 'Kbr', 'Gtt', 'Kne', 'Gtn', 'Gtd'];
-const dd = ['Cy', 'Mb', 'Kb', 'Gt', 'Kn', 'Gn', 'Gd'];
-
-describe('format with "rw"', () => {
- before(() => date.locale(rw));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "rw"', () => {
- before(() => date.locale(rw));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/sr.mjs b/test/esm/locale/sr.mjs
deleted file mode 100644
index d421dae..0000000
--- a/test/esm/locale/sr.mjs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import sr from 'date-and-time/locale/sr';
-
-import expect from 'expect.js';
-
-const MMMM = ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'];
-const MMM = ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'];
-const dddd = ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'];
-const ddd = ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'];
-const dd = ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'];
-
-describe('format with "sr"', () => {
- before(() => date.locale(sr));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "sr"', () => {
- before(() => date.locale(sr));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/sv.mjs b/test/esm/locale/sv.mjs
deleted file mode 100644
index 186757e..0000000
--- a/test/esm/locale/sv.mjs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import sv from 'date-and-time/locale/sv';
-
-import expect from 'expect.js';
-
-const MMMM = ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'];
-const MMM = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'];
-const dddd = ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'];
-const ddd = ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'];
-const dd = ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö'];
-
-describe('format with "sv"', () => {
- before(() => date.locale(sv));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "sv"', () => {
- before(() => date.locale(sv));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/th.mjs b/test/esm/locale/th.mjs
deleted file mode 100644
index dfb5d1d..0000000
--- a/test/esm/locale/th.mjs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import th from 'date-and-time/locale/th';
-
-import expect from 'expect.js';
-
-const MMMM = ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'];
-const MMM = ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'];
-const dddd = ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'];
-const ddd = ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'];
-const dd = ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'];
-const A = [
- 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง',
- 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง'
-];
-
-describe('format with "th"', () => {
- before(() => date.locale(th));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "th"', () => {
- before(() => date.locale(th));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/tr.mjs b/test/esm/locale/tr.mjs
deleted file mode 100644
index 6faeaa3..0000000
--- a/test/esm/locale/tr.mjs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import tr from 'date-and-time/locale/tr';
-
-import expect from 'expect.js';
-
-const MMMM = ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'];
-const MMM = ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'];
-const dddd = ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'];
-const ddd = ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'];
-const dd = ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'];
-
-describe('format with "tr"', () => {
- before(() => date.locale(tr));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "tr"', () => {
- before(() => date.locale(tr));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/uk.mjs b/test/esm/locale/uk.mjs
deleted file mode 100644
index 3b62407..0000000
--- a/test/esm/locale/uk.mjs
+++ /dev/null
@@ -1,102 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import uk from 'date-and-time/locale/uk';
-
-import expect from 'expect.js';
-
-const MMMM = ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'];
-const MMM = ['січ', 'лют', 'бер', 'квіт', 'трав', 'черв', 'лип', 'серп', 'вер', 'жовт', 'лист', 'груд'];
-const dddd = {
- nominative: ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'],
- accusative: ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'],
- genitive: ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи']
-};
-const ddd = ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'];
-const dd = ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'];
-const A = [
- 'ночі', 'ночі', 'ночі', 'ночі', // 0 - 3
- 'ранку', 'ранку', 'ранку', 'ранку', 'ранку', 'ранку', 'ранку', 'ранку', // 4 - 11
- 'дня', 'дня', 'дня', 'дня', 'дня', // 12 - 16
- 'вечора', 'вечора', 'вечора', 'вечора', 'вечора', 'вечора', 'вечора' // 17 - 23
-];
-
-describe('format with "uk"', () => {
- before(() => date.locale(uk));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.accusative.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, '[В] dddd')).to.equal('В ' + d);
- });
- });
- dddd.genitive.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, '[минулої] dddd')).to.equal('минулої ' + d);
- });
- });
- dddd.nominative.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "uk"', () => {
- before(() => date.locale(uk));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/uz.mjs b/test/esm/locale/uz.mjs
deleted file mode 100644
index 00571e3..0000000
--- a/test/esm/locale/uz.mjs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import uz from 'date-and-time/locale/uz';
-
-import expect from 'expect.js';
-
-const MMMM = ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'];
-const MMM = ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'];
-const dddd = ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'];
-const ddd = ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'];
-const dd = ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша'];
-
-describe('format with "uz"', () => {
- before(() => date.locale(uz));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "uz"', () => {
- before(() => date.locale(uz));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/vi.mjs b/test/esm/locale/vi.mjs
deleted file mode 100644
index da463aa..0000000
--- a/test/esm/locale/vi.mjs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import vi from 'date-and-time/locale/vi';
-
-import expect from 'expect.js';
-
-const MMMM = ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'];
-const MMM = ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'];
-const dddd = ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'];
-const ddd = ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'];
-const dd = ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'];
-const A = [
- 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa',
- 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch'
-];
-
-describe('format with "vi"', () => {
- before(() => date.locale(vi));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "vi"', () => {
- before(() => date.locale(vi));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/zh-cn.mjs b/test/esm/locale/zh-cn.mjs
deleted file mode 100644
index ada4268..0000000
--- a/test/esm/locale/zh-cn.mjs
+++ /dev/null
@@ -1,88 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import zh_cn from 'date-and-time/locale/zh-cn';
-
-import expect from 'expect.js';
-
-const MMMM = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
-const MMM = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
-const dddd = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
-const ddd = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
-const dd = ['日', '一', '二', '三', '四', '五', '六'];
-const A = [
- '凌晨', '凌晨', '凌晨', '凌晨', '凌晨', '凌晨', // 0 - 5
- '早上', '早上', '早上', // 6 - 8
- '上午', '上午', // 9 - 11:29
- '中午', // 11:30 - 12:29
- '下午', '下午', '下午', '下午', '下午', '下午', // 12:30 - 17
- '晚上', '晚上', '晚上', '晚上', '晚上', '晚上' // 18 - 23
-];
-
-describe('format with "zh-cn"', () => {
- before(() => date.locale(zh_cn));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "zh-cn"', () => {
- before(() => date.locale(zh_cn));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h:m A', () => {
- const now = new Date(1970, 0, 1, i, 30);
- expect(date.parse((i > 11 ? i - 12 : i) + ':30 ' + a, 'h:m A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/locale/zh-tw.mjs b/test/esm/locale/zh-tw.mjs
deleted file mode 100644
index 39f9cab..0000000
--- a/test/esm/locale/zh-tw.mjs
+++ /dev/null
@@ -1,87 +0,0 @@
-/*global describe, before, it, after */
-import date from 'date-and-time';
-import en from 'date-and-time/locale/en';
-import zh_tw from 'date-and-time/locale/zh-tw';
-
-import expect from 'expect.js';
-
-const MMMM = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
-const MMM = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
-const dddd = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
-const ddd = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
-const dd = ['日', '一', '二', '三', '四', '五', '六'];
-const A = [
- '早上', '早上', '早上', '早上', '早上', '早上', '早上', '早上', '早上', // 0 - 8
- '上午', '上午', // 9 - 11:29
- '中午', // 11:30 - 12:29
- '下午', '下午', '下午', '下午', '下午', '下午', // 12:30 - 17
- '晚上', '晚上', '晚上', '晚上', '晚上', '晚上' // 18 - 23
-];
-
-describe('format with "zh-tw"', () => {
- before(() => date.locale(zh_tw));
-
- MMMM.forEach((m, i) => {
- it('"MMMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM" equals to "' + m + '"', () => {
- const now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- dddd.forEach((d, i) => {
- it('"dddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- ddd.forEach((d, i) => {
- it('"ddd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- dd.forEach((d, i) => {
- it('"dd" equals to "' + d + '"', () => {
- const now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- A.forEach((a, i) => {
- it('"A" equals to "' + a + '"', () => {
- const now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(() => date.locale(en));
-});
-
-describe('parse with "zh-tw"', () => {
- before(() => date.locale(zh_tw));
-
- MMMM.forEach((m, i) => {
- it('"MMMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- MMM.forEach((m, i) => {
- it('"MMM"', () => {
- const now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- A.forEach((a, i) => {
- it('h A', () => {
- const now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(() => date.locale(en));
-});
diff --git a/test/esm/plugin/day-of-week.mjs b/test/esm/plugin/day-of-week.mjs
deleted file mode 100644
index 57df9e7..0000000
--- a/test/esm/plugin/day-of-week.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/*global describe, before, it */
-import date from 'date-and-time';
-import day_of_week from 'date-and-time/plugin/day-of-week';
-
-import expect from 'expect.js';
-
-describe('day of week', () => {
- before(() => date.plugin(day_of_week));
-
- it('dd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Fr', 'dd')).to.eql(now);
- });
- it('ddd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Fri', 'ddd')).to.eql(now);
- });
- it('dddd', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Friday', 'dddd')).to.eql(now);
- });
-});
diff --git a/test/esm/plugin/meridiem.mjs b/test/esm/plugin/meridiem.mjs
deleted file mode 100644
index e9497f3..0000000
--- a/test/esm/plugin/meridiem.mjs
+++ /dev/null
@@ -1,79 +0,0 @@
-/*global describe, before, it */
-import date from 'date-and-time';
-import meridiem from 'date-and-time/plugin/meridiem';
-
-import expect from 'expect.js';
-
-const A = ['AM', 'PM'];
-const AA = ['A.M.', 'P.M.'];
-const a = ['am', 'pm'];
-const aa = ['a.m.', 'p.m.'];
-
-describe('meridiem', () => {
- before(() => date.plugin(meridiem));
-
- it('A, ante meridiem', () => {
- const now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(A[0]);
- });
- it('A, post meridiem', () => {
- const now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(A[1]);
- });
- it('a, ante meridiem', () => {
- const now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'a')).to.equal(a[0]);
- });
- it('a, post meridiem', () => {
- const now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'a')).to.equal(a[1]);
- });
- it('AA, ante meridiem', () => {
- const now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'AA')).to.equal(AA[0]);
- });
- it('AA, post meridiem', () => {
- const now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'AA')).to.equal(AA[1]);
- });
- it('aa, ante meridiem', () => {
- const now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'aa')).to.equal(aa[0]);
- });
- it('aa, post meridiem', () => {
- const now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'aa')).to.equal(aa[1]);
- });
- it('parse a.m.', () => {
- const now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 a.m.', 'hh:mm aa')).to.eql(now);
- });
- it('parse p.m.', () => {
- const now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 p.m.', 'hh:mm aa')).to.eql(now);
- });
- it('parse A.M.', () => {
- const now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 A.M.', 'hh:mm AA')).to.eql(now);
- });
- it('parse P.M.', () => {
- const now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 P.M.', 'hh:mm AA')).to.eql(now);
- });
- it('parse AM', () => {
- const now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 AM', 'hh:mm A')).to.eql(now);
- });
- it('parse PM', () => {
- const now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 PM', 'hh:mm A')).to.eql(now);
- });
- it('parse am', () => {
- const now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 am', 'hh:mm a')).to.eql(now);
- });
- it('parse pm', () => {
- const now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 pm', 'hh:mm a')).to.eql(now);
- });
-});
diff --git a/test/esm/plugin/microsecond.mjs b/test/esm/plugin/microsecond.mjs
deleted file mode 100644
index 867558e..0000000
--- a/test/esm/plugin/microsecond.mjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/*global describe, before, it */
-import date from 'date-and-time';
-import microsecond from 'date-and-time/plugin/microsecond';
-
-import expect from 'expect.js';
-
-describe('microsecond', () => {
- before(() => date.plugin(microsecond));
-
- it('SSSS', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 123);
- expect(date.parse('0.1234', '0.SSSS')).to.eql(now);
- });
- it('SSSSS', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 12);
- expect(date.parse('0.01234', '0.SSSSS')).to.eql(now);
- });
- it('SSSSSS', () => {
- const now = new Date(1970, 0, 1, 0, 0, 0, 1);
- expect(date.parse('0.001234', '0.SSSSSS')).to.eql(now);
- });
-});
diff --git a/test/esm/plugin/ordinal.mjs b/test/esm/plugin/ordinal.mjs
deleted file mode 100644
index 0a30874..0000000
--- a/test/esm/plugin/ordinal.mjs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*global describe, before, it */
-import date from 'date-and-time';
-import ordinal from 'date-and-time/plugin/ordinal';
-
-import expect from 'expect.js';
-
-describe('ordinal number', () => {
- before(() => date.plugin(ordinal));
-
- it('Jan. XX, 2019', () => {
- for (let i = 1, d, now; i <= 31; i++) {
- now = new Date(2019, 0, i, 12, 34, 56, 789);
- switch (i) {
- case 1:
- case 21:
- case 31:
- d = i + 'st';
- break;
- case 2:
- case 22:
- d = i + 'nd';
- break;
- case 3:
- case 23:
- d = i + 'rd';
- break;
- default:
- d = i + 'th';
- break;
- }
- expect(date.format(now, 'MMM. DDD, YYYY')).to.equal('Jan. ' + d + ', 2019');
- }
- });
-});
diff --git a/test/esm/plugin/timespan.mjs b/test/esm/plugin/timespan.mjs
deleted file mode 100644
index 956bb5e..0000000
--- a/test/esm/plugin/timespan.mjs
+++ /dev/null
@@ -1,160 +0,0 @@
-/*global describe, before, it */
-import date from 'date-and-time';
-import timespan from 'date-and-time/plugin/timespan';
-
-import expect from 'expect.js';
-
-describe('timespan', () => {
- before(() => date.plugin(timespan));
-
- it('toMilliseconds, S', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('S')).to.equal('1');
- });
- it('toMilliseconds, SS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('SS')).to.equal('01');
- });
- it('toMilliseconds, SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('001');
- });
- it('toMilliseconds, over SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('' + 31 * 24 * 60 * 60 * 1000);
- });
- it('toMilliseconds, over SSS, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('-' + 31 * 24 * 60 * 60 * 1000);
- });
- it('toSeconds, s', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toSeconds('s')).to.equal('0');
- });
- it('toSeconds, ss', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('00');
- });
- it('toSeconds, over ss', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('' + 31 * 24 * 60 * 60);
- });
- it('toSeconds, over ss, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('-' + 31 * 24 * 60 * 60);
- });
- it('toSeconds, over ss.SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 57, 790);
- expect(date.timeSpan(to, from).toSeconds('ss.SSS')).to.equal('01.001');
- });
- it('toSeconds, over ss.SSS, negative', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 790);
- const to = new Date(2019, 0, 1, 0, 34, 55, 789);
- expect(date.timeSpan(to, from).toSeconds('ss.SSS')).to.equal('-01.001');
- });
- it('toMinutes, m', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMinutes('m')).to.equal('0');
- });
- it('toMinutes, mm', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('00');
- });
- it('toMinutes, over mm', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('' + 31 * 24 * 60);
- });
- it('toMinutes, over mm, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('-' + 31 * 24 * 60);
- });
- it('toMinutes, over mm:ss.SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 35, 57, 790);
- expect(date.timeSpan(to, from).toMinutes('mm:ss.SSS')).to.equal('01:01.001');
- });
- it('toMinutes, over mm:ss.SSS, negative', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 790);
- const to = new Date(2019, 0, 1, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toMinutes('mm:ss.SSS')).to.equal('-01:01.001');
- });
- it('toHours, H', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toHours('H')).to.equal('0');
- });
- it('toHours, HH', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('00');
- });
- it('toHours, over HH', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('' + 31 * 24);
- });
- it('toHours, over HH, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('-' + 31 * 24);
- });
- it('toHours, over HH:mm:ss.SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 1, 35, 57, 790);
- expect(date.timeSpan(to, from).toHours('HH:mm:ss.SSS')).to.equal('01:01:01.001');
- });
- it('toHours, over HH:mm:ss.SSS, negative', () => {
- const from = new Date(2019, 0, 1, 1, 34, 56, 790);
- const to = new Date(2019, 0, 1, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toHours('HH:mm:ss.SSS')).to.equal('-01:01:01.001');
- });
- it('toDays, D', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toDays('D')).to.equal('0');
- });
- it('toDays, DD', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('00');
- });
- it('toDays, over DD', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('' + 31);
- });
- it('toDays, over DD, negative', () => {
- const from = new Date(2019, 1, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('-' + 31);
- });
- it('toDays, over DD HH:mm:ss.SSS', () => {
- const from = new Date(2019, 0, 1, 0, 34, 56, 789);
- const to = new Date(2019, 0, 2, 1, 35, 57, 790);
- expect(date.timeSpan(to, from).toDays('DD HH:mm:ss.SSS')).to.equal('01 01:01:01.001');
- });
- it('toDays, over DD HH:mm:ss.SSS, negative', () => {
- const from = new Date(2019, 0, 1, 1, 34, 56, 790);
- const to = new Date(2019, 0, 0, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toDays('DD HH:mm:ss.SSS')).to.equal('-01 01:01:01.001');
- });
- it('comments', () => {
- const from = new Date(2019, 0, 1, 1, 34, 56, 790);
- const to = new Date(2019, 0, 0, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toDays('[DD HH:mm:ss.SSS]')).to.equal('DD HH:mm:ss.SSS');
- });
-});
diff --git a/test/esm/plugin/timezone.mjs b/test/esm/plugin/timezone.mjs
deleted file mode 100644
index 8a5d508..0000000
--- a/test/esm/plugin/timezone.mjs
+++ /dev/null
@@ -1,894 +0,0 @@
-/*global describe, before, it */
-import date from 'date-and-time';
-import timezone from 'date-and-time/plugin/timezone';
-
-import expect from 'expect.js';
-
-describe('timezone', () => {
- before(() => date.plugin(timezone));
-
- describe('formatTZ', () => {
- it('formatTZ UTC-8', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- const formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 UTC-0800');
- });
-
- it('formatTZ UTC-7 (Start of DST)', () => {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- const dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 3:00:00.000 UTC-0700');
- });
-
- it('formatTZ UTC-7 (End of DST)', () => {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- const dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:59:59.999 UTC-0700');
- });
-
- it('formatTZ UTC-8', () => {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- const dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- const formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:00:00.000 UTC-0800');
- });
-
- it('formatTZ UTC+9', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- const formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 18:59:59.999 UTC+0900');
- });
- });
-
- describe('parseTZ', () => {
- it('parseTZ UTC', () => {
- // Mar 14 2021 1:59:59.999 => 2021-03-14T01:59:59.999Z
- const dateString = 'Mar 14 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'UTC';
- const dateObj = new Date(Date.UTC(2021, 2, 14, 1, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-8', () => {
- // Mar 14 2021 1:59:59.999 => 2021-03-14T09:59:59.999Z
- const dateString = 'Mar 14 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ Failure1', () => {
- // Mar 14 2021 2:00:00.000 => NaN
- const dateString = 'Mar 14 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles';
-
- expect(date.parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
-
- it('parseTZ Failure2', () => {
- // Mar 14 2021 2:59:59.999 => NaN
- const dateString = 'Mar 14 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles';
-
- expect(date.parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
-
- it('parseTZ UTC-7 (Start of DST)', () => {
- // Mar 14 2021 3:00:00.000 => 2021-03-14T10:00:00.000Z
- const dateString = 'Mar 14 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
- const dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-7 (End of DST)', () => {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T08:59:59.999Z
- const dateString = 'Nov 7 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
- const dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-8 with Z', () => {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T09:59:59.999Z
- const dateString = 'Nov 7 2021 1:59:59.999 -0800';
- const formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 10, 7, 9, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-8', () => {
- // Nov 7 2021 2:00:00.000 => 2021-11-07T10:00:00.000Z
- const dateString = 'Nov 7 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
- const dateObj = new Date(Date.UTC(2021, 10, 7, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+9.5', () => {
- // Oct 3 2021 1:59:59.999 => 2021-10-02T16:29:59.999Z
- const dateString = 'Oct 3 2021 1:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ Failure1', () => {
- // Oct 3 2021 2:00:00.000 => NaN
- const dateString = 'Oct 3 2021 2:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide';
-
- expect(date.parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
-
- it('parseTZ Failure2', () => {
- // Oct 3 2021 2:59:59.999 => NaN
- const dateString = 'Oct 3 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide';
-
- expect(date.parseTZ(dateString, formatString, tz)).not.to.equal(NaN);
- });
-
- it('parseTZ UTC+10.5 (Start of DST)', () => {
- // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
- const dateString = 'Oct 3 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+10.5 DST
- const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+10.5 (End of DST)', () => {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T16:29:59.999Z
- const dateString = 'Apr 4 2021 2:59:59.999';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+10.5 DST
- const dateObj = new Date(Date.UTC(2021, 3, 3, 16, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+9.5 with Z', () => {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T17:29:59.999Z
- const dateString = 'Apr 4 2021 2:59:59.999 +0930';
- const formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 3, 3, 17, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+9.5', () => {
- // Apr 4 2021 3:00:00.000 => 2021-04-03T17:30:00.000Z
- const dateString = 'Apr 4 2021 3:00:00.000';
- const formatString = 'MMM D YYYY H:mm:ss.SSS';
- const tz = 'Australia/Adelaide'; // UTC+9.5
- const dateObj = new Date(Date.UTC(2021, 3, 3, 17, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- });
-
- it('transformTZ', () => {
- it('transformTZ EST to PST', () => {
- const dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- const dateString2 = 'November 7 2021 1:00:00.000';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EST to PDT (End of DST)', () => {
- const dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- const dateString2 = 'November 7 2021 1:59:59.999';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to PST', () => {
- const dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-8
-
- const dateString2 = 'March 14 2021 1:59:59.999';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to PDT (Start of DST)', () => {
- const dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'America/Los_Angeles'; // UTC-7 DST
-
- const dateString2 = 'March 14 2021 3:00:00.000';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PST to JST', () => {
- const dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- const dateString2 = 'March 14 2021 18:59:59.999';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PDT to JST', () => {
- const dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- const dateString2 = 'March 14 2021 19:00:00.000';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ UTC to JST', () => {
- const dateString1 = '2021-03-14T03:00:00.000 UTC+0000';
- const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- const tz = 'Asia/Tokyo'; // UTC+9
-
- const dateString2 = 'March 14 2021 12:00:00.000';
-
- // 2021-03-14T03:00:00.000 UTC+0000 => March 14 2021 12:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- });
-
- describe('addYearsTZ', () => {
- it('One year after 2024', () => {
- const date1 = new Date(Date.UTC(2024, 1, 29, 10));
- const date2 = new Date(Date.UTC(2025, 1, 28, 10));
-
- expect(date.addYearsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One year before 2024', () => {
- const date1 = new Date(Date.UTC(2024, 1, 29, 10));
- const date2 = new Date(Date.UTC(2023, 1, 28, 10));
-
- expect(date.addYearsTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('Four years after 2024', () => {
- const date1 = new Date(Date.UTC(2024, 1, 29, 10));
- const date2 = new Date(Date.UTC(2028, 1, 29, 10));
-
- expect(date.addYearsTZ(date1, 4, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('Four years before 2024', () => {
- const date1 = new Date(Date.UTC(2024, 1, 29, 10));
- const date2 = new Date(Date.UTC(2020, 1, 29, 10));
-
- expect(date.addYearsTZ(date1, -4, 'America/Los_Angeles')).to.eql(date2);
- });
- });
-
- describe('addMonthsTZ', () => {
- it('One month after 2:00 AM on January 31, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 0, 31, 10));
- const date2 = new Date(Date.UTC(2024, 1, 29, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('Two months after 2:00 AM on January 31, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 0, 31, 10));
- const date2 = new Date(Date.UTC(2024, 2, 31, 9));
-
- expect(date.addMonthsTZ(date1, 2, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('Three months after 2:00 AM on January 31, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 0, 31, 10));
- const date2 = new Date(Date.UTC(2024, 3, 30, 9));
-
- expect(date.addMonthsTZ(date1, 3, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 1:00 AM on February 10, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 1, 10, 9));
- const date2 = new Date(Date.UTC(2024, 2, 10, 9));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 2:00 AM on February 10, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 1, 10, 10));
- const date2 = new Date(Date.UTC(2024, 2, 10, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 3:00 AM on February 10, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 1, 10, 11));
- const date2 = new Date(Date.UTC(2024, 2, 10, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month before 1:00 AM on December 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 11, 3, 8));
- const date2 = new Date(Date.UTC(2024, 10, 3, 7));
-
- expect(date.addMonthsTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month before 2:00 AM on December 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 11, 3, 9));
- const date2 = new Date(Date.UTC(2024, 10, 3, 8));
-
- expect(date.addMonthsTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month before 3:00 AM on December 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 11, 3, 10));
- const date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addMonthsTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 1:00 AM on November 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 3, 8));
- const date2 = new Date(Date.UTC(2024, 11, 3, 9));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 1:00 AM PST on November 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 3, 9));
- const date2 = new Date(Date.UTC(2024, 11, 3, 9));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 2:00 AM on November 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 3, 10));
- const date2 = new Date(Date.UTC(2024, 11, 3, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 1:00 AM on October 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 9, 3, 8));
- const date2 = new Date(Date.UTC(2024, 10, 3, 8));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 2:00 AM on October 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 9, 3, 9));
- const date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 3:00 AM on October 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 9, 3, 10));
- const date2 = new Date(Date.UTC(2024, 10, 3, 11));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
- });
-
- describe('addDaysTZ', () => {
- it('One day after 1:00 AM on March 9, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 2, 9, 9));
- const date2 = new Date(Date.UTC(2024, 2, 10, 9));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 2:00 AM on March 9, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 2, 9, 10));
- const date2 = new Date(Date.UTC(2024, 2, 10, 10));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 3:00 AM on March 9, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 2, 9, 11));
- const date2 = new Date(Date.UTC(2024, 2, 10, 10));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 1:00 AM on March 10, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 2, 10, 9));
- const date2 = new Date(Date.UTC(2024, 2, 9, 9));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 3:00 AM on March 10, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 2, 10, 10));
- const date2 = new Date(Date.UTC(2024, 2, 9, 11));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 4:00 AM on March 10, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 2, 10, 11));
- const date2 = new Date(Date.UTC(2024, 2, 9, 12));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 1:00 AM on November 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 3, 8));
- const date2 = new Date(Date.UTC(2024, 10, 2, 8));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 1:00 AM PST on November 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 3, 9));
- const date2 = new Date(Date.UTC(2024, 10, 2, 8));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 2:00 AM on November 3, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 3, 10));
- const date2 = new Date(Date.UTC(2024, 10, 2, 9));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 1:00 AM on November 2, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 2, 8));
- const date2 = new Date(Date.UTC(2024, 10, 3, 8));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 2:00 AM on November 2, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 2, 9));
- const date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 3:00 AM on November 2, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 2, 10));
- const date2 = new Date(Date.UTC(2024, 10, 3, 11));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 1:00 AM on November 4, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 4, 9));
- const date2 = new Date(Date.UTC(2024, 10, 3, 8));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 2:00 AM on November 4, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 4, 10));
- const date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 3:00 AM on November 4, 2024', () => {
- const date1 = new Date(Date.UTC(2024, 10, 4, 10));
- const date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
- });
-
- describe('additional tokens', () => {
- it('formatTZ PST', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 PST');
- });
-
- it('formatTZ PDT (Start of DST)', () => {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 3:00:00.000 PDT');
- });
-
- it('formatTZ PDT (End of DST)', () => {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:59:59.999 PDT');
- });
-
- it('formatTZ PST', () => {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:00:00.000 PST');
- });
-
- it('formatTZ JST', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS z';
- var tz = 'Asia/Tokyo';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 18:59:59.999 JST');
- });
-
- it('formatTZ Pacific Standard Time', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 Pacific Standard Time');
- });
-
- it('formatTZ Pacific Daylight Time (Start of DST)', () => {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 3:00:00.000 Pacific Daylight Time');
- });
-
- it('formatTZ Pacific Daylight Time (End of DST)', () => {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:59:59.999 Pacific Daylight Time');
- });
-
- it('formatTZ Pacific Standard Time', () => {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:00:00.000 Pacific Standard Time');
- });
-
- it('formatTZ Japan Standard Time', () => {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS zz';
- var tz = 'Asia/Tokyo';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 18:59:59.999 Japan Standard Time');
- });
-
- it('transformTZ EST to PST', () => {
- var dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'November 7 2021 1:00:00.000 PST';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000 PST
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EST to PDT (End of DST)', () => {
- var dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'November 7 2021 1:59:59.999 PDT';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to PST', () => {
- var dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'March 14 2021 1:59:59.999 PST';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to PDT (Start of DST)', () => {
- var dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'March 14 2021 3:00:00.000 PDT';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PST to JST', () => {
- var dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 18:59:59.999 JST';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PDT to JST', () => {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 19:00:00.000 JST';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ UTC to JST', () => {
- var dateString1 = '2021-03-14T03:00:00.000 UTC+0000';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 12:00:00.000 JST';
-
- // 2021-03-14T03:00:00.000 UTC+0000 => March 14 2021 12:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EST to Pacific Standard Time', () => {
- var dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'November 7 2021 1:00:00.000 Pacific Standard Time';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000 PST
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EST to Pacific Daylight Time (End of DST)', () => {
- var dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'November 7 2021 1:59:59.999 Pacific Daylight Time';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to Pacific Standard Time', () => {
- var dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'March 14 2021 1:59:59.999 Pacific Standard Time';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to Pacific Daylight Time (Start of DST)', () => {
- var dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'March 14 2021 3:00:00.000 Pacific Daylight Time';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PST to Japan Standard Time', () => {
- var dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 18:59:59.999 Japan Standard Time';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PDT to Japan Standard Time', () => {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 19:00:00.000 Japan Standard Time';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ UTC to Japan Standard Time', () => {
- var dateString1 = '2021-03-14T03:00:00.000 UTC+0000';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 12:00:00.000 Japan Standard Time';
-
- // 2021-03-14T03:00:00.000 UTC+0000 => March 14 2021 12:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- });
-
- describe('format', () => {
- before(() => {
- process.env.TZ = 'America/Los_Angeles';
- });
-
- it('"z" equals to "PST"', () => {
- // Before the start of daylight saving time
- var now = new Date(2024, 2, 10, 1, 59, 59, 999);
- expect(date.format(now, 'z')).to.equal('PST');
- });
-
- it('"z" equals to "PDT"', () => {
- // Daylight saving time started
- var now = new Date(2024, 2, 10, 2, 0, 0, 0);
- expect(date.format(now, 'z')).to.equal('PDT');
- });
-
- it('"z" equals to "PDT"', () => {
- // Before the end of daylight saving time
- var now = new Date(2024, 10, 3, 1, 0, 0, 0);
- expect(date.format(now, 'z')).to.equal('PDT');
- });
-
- it('"z" equals to "PST"', () => {
- // Daylight saving time ends
- var now = new Date(2024, 10, 3, 2, 0, 0, 0);
- expect(date.format(now, 'z')).to.equal('PST');
- });
-
- it('"zz" equals to "Pacific Standard Time"', () => {
- // Before the start of daylight saving time
- var now = new Date(2024, 2, 10, 1, 59, 59, 999);
- expect(date.format(now, 'zz')).to.equal('Pacific Standard Time');
- });
-
- it('"zz" equals to "Pacific Daylight Time"', () => {
- // Daylight saving time started
- var now = new Date(2024, 2, 10, 2, 0, 0, 0);
- expect(date.format(now, 'zz')).to.equal('Pacific Daylight Time');
- });
-
- it('"zz" equals to "Pacific Daylight Time"', () => {
- // Before the end of daylight saving time
- var now = new Date(2024, 10, 3, 1, 0, 0, 0);
- expect(date.format(now, 'zz')).to.equal('Pacific Daylight Time');
- });
-
- it('"zz" equals to "Pacific Standard Time"', () => {
- // Daylight saving time ends
- var now = new Date(2024, 10, 3, 2, 0, 0, 0);
- expect(date.format(now, 'zz')).to.equal('Pacific Standard Time');
- });
- });
-
- describe('transform', () => {
- before(() => {
- process.env.TZ = 'America/Los_Angeles';
- });
-
- it('"z" equals to "PST"', () => {
- // Before the start of daylight saving time
- expect(date.transform('10 March 2024, 01:59:59.999', 'D MMMM YYYY, HH:mm:ss.SSS', 'z')).to.equal('PST');
- });
-
- it('"z" equals to "PDT"', () => {
- // Daylight saving time started
- expect(date.transform('10 March 2024, 02:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'z')).to.equal('PDT');
- });
-
- it('"z" equals to "PDT"', () => {
- // Before the end of daylight saving time
- expect(date.transform('3 November 2024, 01:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'z')).to.equal('PDT');
- });
-
- it('"z" equals to "PST"', () => {
- // Daylight saving time ends
- expect(date.transform('3 November 2024, 02:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'z')).to.equal('PST');
- });
-
- it('"zz" equals to "Pacific Standard Time"', () => {
- // Before the start of daylight saving time
- expect(date.transform('10 March 2024, 01:59:59.999', 'D MMMM YYYY, HH:mm:ss.SSS', 'zz')).to.equal('Pacific Standard Time');
- });
-
- it('"zz" equals to "Pacific Daylight Time"', () => {
- // Daylight saving time started
- expect(date.transform('10 March 2024, 02:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'zz')).to.equal('Pacific Daylight Time');
- });
-
- it('"zz" equals to "Pacific Daylight Time"', () => {
- // Before the end of daylight saving time
- expect(date.transform('3 November 2024, 01:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'zz')).to.equal('Pacific Daylight Time');
- });
-
- it('"zz" equals to "Pacific Standard Time"', () => {
- // Daylight saving time ends
- expect(date.transform('3 November 2024, 02:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'zz')).to.equal('Pacific Standard Time');
- });
- });
-});
diff --git a/test/esm/plugin/two-digit-year.mjs b/test/esm/plugin/two-digit-year.mjs
deleted file mode 100644
index afc2c0c..0000000
--- a/test/esm/plugin/two-digit-year.mjs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*global describe, before, it */
-import date from 'date-and-time';
-import two_digit_year from 'date-and-time/plugin/two-digit-year';
-
-import expect from 'expect.js';
-
-describe('compile (two-digit-year)', () => {
- before(() => date.plugin(two_digit_year));
-
- it('YY', () => {
- const obj = ['YY', 'YY'];
- expect(date.compile('YY')).to.eql(obj);
- });
-});
-
-describe('preparse (two-digit-year)', () => {
- before(() => date.plugin(two_digit_year));
-
- it('YY-1', () => {
- const dt = { Y: 2000, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('00', 'YY')).to.eql(dt);
- });
- it('YY-2', () => {
- const dt = { Y: 2001, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('01', 'YY')).to.eql(dt);
- });
- it('YY-3', () => {
- const dt = { Y: 2010, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('10', 'YY')).to.eql(dt);
- });
- it('YY-4', () => {
- const dt = { Y: 2069, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('69', 'YY')).to.eql(dt);
- });
- it('YY-5', () => {
- const dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('70', 'YY')).to.eql(dt);
- });
- it('YY-6', () => {
- const dt = { Y: 1999, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('99', 'YY')).to.eql(dt);
- });
-});
-
-describe('parse (two-digit-year)', () => {
- before(() => date.plugin(two_digit_year));
-
- it('YY-1', () => {
- const now = new Date(2000, 0, 1);
- expect(date.parse('00', 'YY')).to.eql(now);
- });
- it('YY-2', () => {
- const now = new Date(2001, 0, 1);
- expect(date.parse('01', 'YY')).to.eql(now);
- });
- it('YY-3', () => {
- const now = new Date(2010, 0, 1);
- expect(date.parse('10', 'YY')).to.eql(now);
- });
- it('YY-4', () => {
- const now = new Date(2069, 0, 1);
- expect(date.parse('69', 'YY')).to.eql(now);
- });
- it('YY-5', () => {
- const now = new Date(1970, 0, 1);
- expect(date.parse('70', 'YY')).to.eql(now);
- });
- it('YY-6', () => {
- const now = new Date(1999, 0, 1);
- expect(date.parse('99', 'YY')).to.eql(now);
- });
-});
diff --git a/test/locale/ar.js b/test/locale/ar.js
deleted file mode 100644
index 0bfdeb8..0000000
--- a/test/locale/ar.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- MMM = ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر'],
- dddd = ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
- ddd = ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
- dd = ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
- A = ['ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', 'ص', // 00 - 11
- 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م', 'م']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/ar') : 'ar';
-
- describe('format with "ar"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '٢٠١٦٠١٠١٠٢٣٤٥٦٧٨٩';
- expect(date.format(now, 'YYYYMMDDHHmmssSSS')).to.equal(str);
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "ar"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '٢٠١٦٠١٠١٠٢٣٤٥٦٧٨٩';
- expect(date.parse(str, 'YYYYMMDDHHmmssSSS')).to.eql(now);
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/az.js b/test/locale/az.js
deleted file mode 100644
index 9e11513..0000000
--- a/test/locale/az.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
- MMM = ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
- dddd = ['Bazar', 'Bazar ertəsi', 'Çərşənbə axşamı', 'Çərşənbə', 'Cümə axşamı', 'Cümə', 'Şənbə'],
- ddd = ['Baz', 'BzE', 'ÇAx', 'Çər', 'CAx', 'Cüm', 'Şən'],
- dd = ['Bz', 'BE', 'ÇA', 'Çə', 'CA', 'Cü', 'Şə'],
- A = ['gecə', 'gecə', 'gecə', 'gecə', // 0 - 3
- 'səhər', 'səhər', 'səhər', 'səhər', 'səhər', 'səhər', 'səhər', 'səhər', // 4 - 11
- 'gündüz', 'gündüz', 'gündüz', 'gündüz', 'gündüz', // 12 - 16
- 'axşam', 'axşam', 'axşam', 'axşam', 'axşam', 'axşam', 'axşam']; // 17 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/az') : 'az';
-
- describe('format with "az"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "az"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/bn.js b/test/locale/bn.js
deleted file mode 100644
index 80455ce..0000000
--- a/test/locale/bn.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['জানুয়ারী', 'ফেবুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
- MMM = ['জানু', 'ফেব', 'মার্চ', 'এপর', 'মে', 'জুন', 'জুল', 'অগ', 'সেপ্ট', 'অক্টো', 'নভ', 'ডিসেম্'],
- dddd = ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পত্তিবার', 'শুক্রবার', 'শনিবার'],
- ddd = ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পত্তি', 'শুক্র', 'শনি'],
- dd = ['রব', 'সম', 'মঙ্গ', 'বু', 'ব্রিহ', 'শু', 'শনি'],
- A = ['রাত', 'রাত', 'রাত', 'রাত', // 0 - 3
- 'সকাল', 'সকাল', 'সকাল', 'সকাল', 'সকাল', 'সকাল', // 4 - 9
- 'দুপুর', 'দুপুর', 'দুপুর', 'দুপুর', 'দুপুর', 'দুপুর', 'দুপুর', // 10 - 16
- 'বিকাল', 'বিকাল', 'বিকাল', // 17 - 19
- 'রাত', 'রাত', 'রাত', 'রাত']; // 20 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/bn') : 'bn';
-
- describe('format with "bn"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "bn"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/cs.js b/test/locale/cs.js
deleted file mode 100644
index 4324ed6..0000000
--- a/test/locale/cs.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
- MMM = ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'],
- dddd = ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
- ddd = ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
- dd = ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/cs') : 'cs';
-
- describe('format with "cs"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "cs"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/de.js b/test/locale/de.js
deleted file mode 100644
index 1a1df98..0000000
--- a/test/locale/de.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
- MMM = ['Jan.', 'Febr.', 'Mrz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'],
- dddd = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
- ddd = ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
- dd = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
- A = ['Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', 'Uhr nachmittags', // 0 - 11
- 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens', 'Uhr morgens']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/de') : 'de';
-
- describe('format with "de"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "de"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/dk.js b/test/locale/dk.js
deleted file mode 100644
index 13a37a4..0000000
--- a/test/locale/dk.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
- MMM = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd = ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
- ddd = ['søn', 'man', 'tir', 'ons', 'tors', 'fre', 'lør'],
- dd = ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/dk') : 'dk';
-
- describe('format with "dk"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "dk"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/el.js b/test/locale/el.js
deleted file mode 100644
index 2e3ff82..0000000
--- a/test/locale/el.js
+++ /dev/null
@@ -1,139 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = {
- nominative: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
- genitive: ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
- },
- MMM = ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
- dddd = ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
- ddd = ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
- dd = ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
- A = ['πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ', 'πμ',
- 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ', 'μμ'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/el') : 'el';
-
- describe('format with "el"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM.nominative, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMMM.genitive, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'DD MMMM')).to.equal('01 ' + m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('"hh" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('00');
- });
- it('"hh" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('00');
- });
- it('"hh" equals to "11"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('11');
- });
- it('"h" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('0');
- });
- it('"h" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('0');
- });
- it('"h" equals to "11"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('11');
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "el"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM.nominative, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMMM.genitive, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse('01 ' + m, 'DD MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/es.js b/test/locale/es.js
deleted file mode 100644
index 1410845..0000000
--- a/test/locale/es.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
- MMM = ['ene.', 'feb.', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'],
- dddd = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
- ddd = ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'],
- dd = ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
- A = ['de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', 'de la mañana', // 0 - 11
- 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', 'de la tarde', // 12 - 18
- 'de la noche', 'de la noche', 'de la noche', 'de la noche', 'de la noche']; // 19 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/es') : 'es';
-
- describe('format with "es"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "es"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/fa.js b/test/locale/fa.js
deleted file mode 100644
index b2ba2e8..0000000
--- a/test/locale/fa.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- MMM = ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
- dddd = ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- ddd = ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
- dd = ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
- A = ['قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', 'قبل از ظهر', // 0 - 11
- 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر', 'بعد از ظهر']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/fa') : 'fa';
-
- describe('format with "fa"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '۲۰۱۶۰۱۰۱۰۲۳۴۵۶۷۸۹';
- expect(date.format(now, 'YYYYMMDDHHmmssSSS')).to.equal(str);
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "fa"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '۲۰۱۶۰۱۰۱۰۲۳۴۵۶۷۸۹';
- expect(date.parse(str, 'YYYYMMDDHHmmssSSS')).to.eql(now);
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/fr.js b/test/locale/fr.js
deleted file mode 100644
index 916be1b..0000000
--- a/test/locale/fr.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
- MMM = ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
- dddd = ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
- ddd = ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
- dd = ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
- A = ['matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', 'matin', // 0 - 11
- 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi', 'l\'après-midi']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/fr') : 'fr';
-
- describe('format with "fr"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "fr"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/hi.js b/test/locale/hi.js
deleted file mode 100644
index 1c4b90d..0000000
--- a/test/locale/hi.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'],
- MMM = ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'],
- dddd = ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'],
- ddd = ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'],
- dd = ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
- A = ['रात', 'रात', 'रात', 'रात', // 0 - 3
- 'सुबह', 'सुबह', 'सुबह', 'सुबह', 'सुबह', 'सुबह', // 4 - 9
- 'दोपहर', 'दोपहर', 'दोपहर', 'दोपहर', 'दोपहर', 'दोपहर', 'दोपहर', // 10 - 16
- 'शाम', 'शाम', 'शाम', // 17 - 19
- 'रात', 'रात', 'रात', 'रात']; // 20 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/hi') : 'hi';
-
- describe('format with "hi"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "hi"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/hu.js b/test/locale/hu.js
deleted file mode 100644
index 2940a67..0000000
--- a/test/locale/hu.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'],
- MMM = ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'],
- dddd = ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'],
- ddd = ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'],
- dd = ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'],
- A = ['de', 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de', 'de',
- 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du', 'du'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/hu') : 'hu';
-
- describe('format with "hu"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "hu"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/id.js b/test/locale/id.js
deleted file mode 100644
index 7d817b8..0000000
--- a/test/locale/id.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
- MMM = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'],
- dddd = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
- ddd = ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
- dd = ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'],
- A = ['pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', 'pagi', // 0 - 10
- 'siang', 'siang', 'siang', 'siang', // 11 - 14
- 'sore', 'sore', 'sore', 'sore', // 15 - 18
- 'malam', 'malam', 'malam', 'malam', 'malam']; // 19 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/id') : 'id';
-
- describe('format with "id"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "id"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/it.js b/test/locale/it.js
deleted file mode 100644
index 606a30f..0000000
--- a/test/locale/it.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],
- MMM = ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
- dddd = ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
- ddd = ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
- dd = ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
- A = ['di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', 'di mattina', // 0 - 11
- 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio', 'di pomerrigio']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/it') : 'it';
-
- describe('format with "it"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "it"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/ja.js b/test/locale/ja.js
deleted file mode 100644
index e2344c4..0000000
--- a/test/locale/ja.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- MMM = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd = ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
- ddd = ['日', '月', '火', '水', '木', '金', '土'],
- dd = ['日', '月', '火', '水', '木', '金', '土'],
- A = ['午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', '午前', // 0 - 11
- '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後', '午後']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/ja') : 'ja';
-
- describe('format with "ja"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('"hh" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('00');
- });
- it('"hh" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('00');
- });
- it('"hh" equals to "11"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'hh')).to.equal('11');
- });
- it('"h" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('0');
- });
- it('"h" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('0');
- });
- it('"h" equals to "11"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'h')).to.equal('11');
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "ja"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/jv.js b/test/locale/jv.js
deleted file mode 100644
index 42860be..0000000
--- a/test/locale/jv.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'],
- MMM = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'],
- dddd = ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'],
- ddd = ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'],
- dd = ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'],
- A = ['enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', 'enjing', // 0 - 10
- 'siyang', 'siyang', 'siyang', 'siyang', // 11 - 14
- 'sonten', 'sonten', 'sonten', 'sonten', // 15 - 18
- 'ndalu', 'ndalu', 'ndalu', 'ndalu', 'ndalu']; // 19 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/jv') : 'jv';
-
- describe('format with "jv"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "jv"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/ko.js b/test/locale/ko.js
deleted file mode 100644
index 861622e..0000000
--- a/test/locale/ko.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- MMM = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
- dddd = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
- ddd = ['일', '월', '화', '수', '목', '금', '토'],
- dd = ['일', '월', '화', '수', '목', '금', '토'],
- A = ['오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', '오전', // 0 - 11
- '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후', '오후']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/ko') : 'ko';
-
- describe('format with "ko"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "ko"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/my.js b/test/locale/my.js
deleted file mode 100644
index e47cdd4..0000000
--- a/test/locale/my.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'],
- MMM = ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'],
- dddd = ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
- ddd = ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'],
- dd = ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/my') : 'my';
-
- describe('format with "my"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '၂၀၁၆၀၁၀၁၀၂၃၄၅၆၇၈၉';
- expect(date.format(now, 'YYYYMMDDHHmmssSSS')).to.equal(str);
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "my"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '၂၀၁၆၀၁၀၁၀၂၃၄၅၆၇၈၉';
- expect(date.parse(str, 'YYYYMMDDHHmmssSSS')).to.eql(now);
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/nl.js b/test/locale/nl.js
deleted file mode 100644
index 7ff91fe..0000000
--- a/test/locale/nl.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
- MMM = {
- withdots: ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
- withoutdots: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
- },
- dddd = ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
- ddd = ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'],
- dd = ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/nl') : 'nl';
-
- describe('format with "nl"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM.withdots, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(MMM.withoutdots, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, '-MMM-')).to.equal('-' + m + '-');
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "nl"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM.withdots, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(MMM.withoutdots, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse('-' + m + '-', '-MMM-')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/pa-in.js b/test/locale/pa-in.js
deleted file mode 100644
index 3a0edde..0000000
--- a/test/locale/pa-in.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- MMM = ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'],
- dddd = ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'],
- ddd = ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- dd = ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'],
- A = ['ਰਾਤ', 'ਰਾਤ', 'ਰਾਤ', 'ਰਾਤ', // 0 - 3
- 'ਸਵੇਰ', 'ਸਵੇਰ', 'ਸਵੇਰ', 'ਸਵੇਰ', 'ਸਵੇਰ', 'ਸਵੇਰ', // 4 - 9
- 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', 'ਦੁਪਹਿਰ', // 10 - 16
- 'ਸ਼ਾਮ', 'ਸ਼ਾਮ', 'ਸ਼ਾਮ', // 17 - 19
- 'ਰਾਤ', 'ਰਾਤ', 'ਰਾਤ', 'ਰਾਤ']; // 20 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/pa-in') : 'pa-in';
-
- describe('format with "pa-in"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '੨੦੧੬੦੧੦੧੦੨੩੪੫੬੭੮੯';
- expect(date.format(now, 'YYYYMMDDHHmmssSSS')).to.equal(str);
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "pa-in"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
- it('numeric expression', function () {
- var now = new Date(2016, 0, 1, 2, 34, 56, 789),
- str = '੨੦੧੬੦੧੦੧੦੨੩੪੫੬੭੮੯';
- expect(date.parse(str, 'YYYYMMDDHHmmssSSS')).to.eql(now);
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/pl.js b/test/locale/pl.js
deleted file mode 100644
index 552b9f4..0000000
--- a/test/locale/pl.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = {
- nominative: ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'],
- subjective: ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia']
- },
- MMM = ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
- dddd = ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'],
- ddd = ['nie', 'pon', 'wt', 'śr', 'czw', 'pt', 'sb'],
- dd = ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/pl') : 'pl';
-
- describe('format with "pl"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM.nominative, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMMM.subjective, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'DD MMMM')).to.equal('01 ' + m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "pl"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM.nominative, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMMM.subjective, function (m, i) {
- it('"DD MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse('01 ' + m, 'DD MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/pt.js b/test/locale/pt.js
deleted file mode 100644
index 397dfa9..0000000
--- a/test/locale/pt.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
- MMM = ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
- dddd = ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado'],
- ddd = ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
- dd = ['Dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sáb'],
- A = ['da madrugada', 'da madrugada', 'da madrugada', 'da madrugada', 'da madrugada', // 0 - 4
- 'da manhã', 'da manhã', 'da manhã', 'da manhã', 'da manhã', 'da manhã', 'da manhã', // 5 - 11
- 'da tarde', 'da tarde', 'da tarde', 'da tarde', 'da tarde', 'da tarde', 'da tarde', // 12 - 18
- 'da noite', 'da noite', 'da noite', 'da noite', 'da noite']; // 19 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/pt') : 'pt';
-
- describe('format with "pt"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "pt"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/ro.js b/test/locale/ro.js
deleted file mode 100644
index c895782..0000000
--- a/test/locale/ro.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use sroict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'],
- MMM = ['ian.', 'febr.', 'mart.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'],
- dddd = ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'],
- ddd = ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'],
- dd = ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/ro') : 'ro';
-
- describe('format with "ro"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "ro"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/ru.js b/test/locale/ru.js
deleted file mode 100644
index 60d927c..0000000
--- a/test/locale/ru.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'],
- MMM = ['янв', 'фев', 'мар', 'апр', 'мая', 'июня', 'июля', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd = ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
- ddd = ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- dd = ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
- A = ['ночи', 'ночи', 'ночи', 'ночи', // 0 - 3
- 'утра', 'утра', 'утра', 'утра', 'утра', 'утра', 'утра', 'утра', // 4 - 11
- 'дня', 'дня', 'дня', 'дня', 'дня', // 12 - 17
- 'вечера', 'вечера', 'вечера', 'вечера', 'вечера', 'вечера', 'вечера']; // 18 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/ru') : 'ru';
-
- describe('format with "ru"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "ru"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/rw.js b/test/locale/rw.js
deleted file mode 100644
index a74acaf..0000000
--- a/test/locale/rw.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'],
- MMM = ['Mtr', 'Gas', 'Wer', 'Mta', 'Gic', 'Kmn', 'Nyk', 'Knm', 'Nze', 'Ukw', 'Ugu', 'Uku'],
- dddd = ['Ku cyumweru', 'Ku wambere', 'Ku wakabiri', 'Ku wagatatu', 'Ku wakane', 'Ku wagatanu', 'Ku wagatandatu'],
- ddd = ['Cyu', 'Mbe', 'Kbr', 'Gtt', 'Kne', 'Gtn', 'Gtd'],
- dd = ['Cy', 'Mb', 'Kb', 'Gt', 'Kn', 'Gn', 'Gd'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/rw') : 'rw';
-
- describe('format with "rw"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "rw"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/sr.js b/test/locale/sr.js
deleted file mode 100644
index 8103912..0000000
--- a/test/locale/sr.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
- MMM = ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
- dddd = ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
- ddd = ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
- dd = ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/sr') : 'sr';
-
- describe('format with "sr"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "sr"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/sv.js b/test/locale/sv.js
deleted file mode 100644
index 6b73ed8..0000000
--- a/test/locale/sv.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
- MMM = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
- dddd = ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
- ddd = ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
- dd = ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/sv') : 'sv';
-
- describe('format with "sv"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "sv"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/th.js b/test/locale/th.js
deleted file mode 100644
index 9ccffac..0000000
--- a/test/locale/th.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'],
- MMM = ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'],
- dddd = ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'],
- ddd = ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'],
- dd = ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
- A = ['ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', 'ก่อนเที่ยง', // 0 - 11
- 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง', 'หลังเที่ยง']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/th') : 'th';
-
- describe('format with "th"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "th"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/tr.js b/test/locale/tr.js
deleted file mode 100644
index 5b2ef36..0000000
--- a/test/locale/tr.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
- MMM = ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
- dddd = ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
- ddd = ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'],
- dd = ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/tr') : 'tr';
-
- describe('format with "tr"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "tr"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/uk.js b/test/locale/uk.js
deleted file mode 100644
index 232734f..0000000
--- a/test/locale/uk.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'],
- MMM = ['січ', 'лют', 'бер', 'квіт', 'трав', 'черв', 'лип', 'серп', 'вер', 'жовт', 'лист', 'груд'],
- dddd = {
- nominative: ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'],
- accusative: ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'],
- genitive: ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи']
- },
- ddd = ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- dd = ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
- A = ['ночі', 'ночі', 'ночі', 'ночі', // 0 - 3
- 'ранку', 'ранку', 'ранку', 'ранку', 'ранку', 'ранку', 'ранку', 'ранку', // 4 - 11
- 'дня', 'дня', 'дня', 'дня', 'дня', // 12 - 16
- 'вечора', 'вечора', 'вечора', 'вечора', 'вечора', 'вечора', 'вечора']; // 17 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/uk') : 'uk';
-
- describe('format with "uk"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd.accusative, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, '[В] dddd')).to.equal('В ' + d);
- });
- });
- forEach(dddd.genitive, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, '[минулої] dddd')).to.equal('минулої ' + d);
- });
- });
- forEach(dddd.nominative, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "uk"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/uz.js b/test/locale/uz.js
deleted file mode 100644
index 1348140..0000000
--- a/test/locale/uz.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'],
- MMM = ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'],
- dddd = ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'],
- ddd = ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'],
- dd = ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша'];
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/uz') : 'uz';
-
- describe('format with "uz"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "uz"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/vi.js b/test/locale/vi.js
deleted file mode 100644
index 5376f31..0000000
--- a/test/locale/vi.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'],
- MMM = ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'],
- dddd = ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'],
- ddd = ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- dd = ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- A = ['sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', 'sa', // 0 - 11
- 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch', 'ch']; // 12 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/vi') : 'vi';
-
- describe('format with "vi"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "vi"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/zh-cn.js b/test/locale/zh-cn.js
deleted file mode 100644
index b9f5225..0000000
--- a/test/locale/zh-cn.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd = ['日', '一', '二', '三', '四', '五', '六'],
- A = ['凌晨', '凌晨', '凌晨', '凌晨', '凌晨', '凌晨', // 0 - 5
- '早上', '早上', '早上', // 6 - 8
- '上午', '上午', // 9 - 11:29
- '中午', // 11:30 - 12:29
- '下午', '下午', '下午', '下午', '下午', '下午', // 12:30 - 17
- '晚上', '晚上', '晚上', '晚上', '晚上', '晚上']; // 18 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/zh-cn') : 'zh-cn';
-
- describe('format with "zh-cn"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "zh-cn"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h:m A', function () {
- var now = new Date(1970, 0, 1, i, 30);
- expect(date.parse((i > 11 ? i - 12 : i) + ':30 ' + a, 'h:m A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/locale/zh-tw.js b/test/locale/zh-tw.js
deleted file mode 100644
index a1abfe6..0000000
--- a/test/locale/zh-tw.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/*global describe, before, it, after */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- forEach = function (array, fn) {
- for (var i = 0, len = array.length; i < len; i++) {
- if (fn(array[i], i) === 0) {
- break;
- }
- }
- },
- MMMM = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
- MMM = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- dddd = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
- ddd = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- dd = ['日', '一', '二', '三', '四', '五', '六'],
- A = ['早上', '早上', '早上', '早上', '早上', '早上', '早上', '早上', '早上', // 0 - 8
- '上午', '上午', // 9 - 11:29
- '中午', // 11:30 - 12:29
- '下午', '下午', '下午', '下午', '下午', '下午', // 12:30 - 17
- '晚上', '晚上', '晚上', '晚上', '晚上', '晚上']; // 18 - 23
-
- var locale = typeof require === 'function' ? require('date-and-time/locale/zh-tw') : 'zh-tw';
-
- describe('format with "zh-tw"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal(m);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM" equals to "' + m + '"', function () {
- var now = new Date(2015, i, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal(m);
- });
- });
- forEach(dddd, function (d, i) {
- it('"dddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal(d);
- });
- });
- forEach(ddd, function (d, i) {
- it('"ddd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal(d);
- });
- });
- forEach(dd, function (d, i) {
- it('"dd" equals to "' + d + '"', function () {
- var now = new Date(2016, 0, i + 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal(d);
- });
- });
- forEach(A, function (a, i) {
- it('"A" equals to "' + a + '"', function () {
- var now = new Date(2016, 0, 1, i, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(a);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
- describe('parse with "zh-tw"', function () {
- before(function () {
- date.locale(locale);
- });
-
- forEach(MMMM, function (m, i) {
- it('"MMMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMMM')).to.eql(now);
- });
- });
- forEach(MMM, function (m, i) {
- it('"MMM"', function () {
- var now = new Date(1970, i, 1);
- expect(date.parse(m, 'MMM')).to.eql(now);
- });
- });
- forEach(A, function (a, i) {
- it('h A', function () {
- var now = new Date(1970, 0, 1, i);
- expect(date.parse((i > 11 ? i - 12 : i) + ' ' + a, 'h A')).to.eql(now);
- });
- });
-
- after(function () {
- date.locale(typeof require === 'function' ? require('../../locale/en') : 'en');
- });
- });
-
-}(this));
diff --git a/test/plugin/day-of-week.js b/test/plugin/day-of-week.js
deleted file mode 100644
index d9ff72c..0000000
--- a/test/plugin/day-of-week.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*global describe, before, it */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time');
-
- var plugin = 'day-of-week';
-
- if (typeof require === 'function') {
- plugin = require('date-and-time/plugin/day-of-week');
- }
-
- describe('day of week', function () {
- before(function () {
- date.plugin(plugin);
- });
-
- it('dd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Fr', 'dd')).to.eql(now);
- });
- it('ddd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Fri', 'ddd')).to.eql(now);
- });
- it('dddd', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 0);
- expect(date.parse('Friday', 'dddd')).to.eql(now);
- });
- });
-
-}(this));
diff --git a/test/plugin/meridiem.js b/test/plugin/meridiem.js
deleted file mode 100644
index 17863ba..0000000
--- a/test/plugin/meridiem.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*global describe, before, it */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time'),
- A = ['AM', 'PM'],
- AA = ['A.M.', 'P.M.'],
- a = ['am', 'pm'],
- aa = ['a.m.', 'p.m.'];
-
- var plugin = 'meridiem';
-
- if (typeof require === 'function') {
- plugin = require('date-and-time/plugin/meridiem');
- }
-
- describe('meridiem', function () {
- before(function () {
- date.plugin(plugin);
- });
-
- it('A, ante meridiem', function () {
- var now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(A[0]);
- });
- it('A, post meridiem', function () {
- var now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'A')).to.equal(A[1]);
- });
- it('a, ante meridiem', function () {
- var now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'a')).to.equal(a[0]);
- });
- it('a, post meridiem', function () {
- var now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'a')).to.equal(a[1]);
- });
- it('AA, ante meridiem', function () {
- var now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'AA')).to.equal(AA[0]);
- });
- it('AA, post meridiem', function () {
- var now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'AA')).to.equal(AA[1]);
- });
- it('aa, ante meridiem', function () {
- var now = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'aa')).to.equal(aa[0]);
- });
- it('aa, post meridiem', function () {
- var now = new Date(2019, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'aa')).to.equal(aa[1]);
- });
- it('parse a.m.', function () {
- var now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 a.m.', 'hh:mm aa')).to.eql(now);
- });
- it('parse p.m.', function () {
- var now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 p.m.', 'hh:mm aa')).to.eql(now);
- });
- it('parse A.M.', function () {
- var now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 A.M.', 'hh:mm AA')).to.eql(now);
- });
- it('parse P.M.', function () {
- var now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 P.M.', 'hh:mm AA')).to.eql(now);
- });
- it('parse AM', function () {
- var now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 AM', 'hh:mm A')).to.eql(now);
- });
- it('parse PM', function () {
- var now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 PM', 'hh:mm A')).to.eql(now);
- });
- it('parse am', function () {
- var now = new Date(1970, 0, 1, 0, 34);
- expect(date.parse('00:34 am', 'hh:mm a')).to.eql(now);
- });
- it('parse pm', function () {
- var now = new Date(1970, 0, 1, 12, 34);
- expect(date.parse('00:34 pm', 'hh:mm a')).to.eql(now);
- });
- });
-
-}(this));
diff --git a/test/plugin/microsecond.js b/test/plugin/microsecond.js
deleted file mode 100644
index d318030..0000000
--- a/test/plugin/microsecond.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*global describe, before, it */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time');
-
- var plugin = 'microsecond';
-
- if (typeof require === 'function') {
- plugin = require('date-and-time/plugin/microsecond');
- }
-
- describe('microsecond', function () {
- before(function () {
- date.plugin(plugin);
- });
-
- it('SSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 123);
- expect(date.parse('0.1234', '0.SSSS')).to.eql(now);
- });
- it('SSSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 12);
- expect(date.parse('0.01234', '0.SSSSS')).to.eql(now);
- });
- it('SSSSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 1);
- expect(date.parse('0.001234', '0.SSSSSS')).to.eql(now);
- });
- });
-
-}(this));
diff --git a/test/plugin/ordinal.js b/test/plugin/ordinal.js
deleted file mode 100644
index acf7173..0000000
--- a/test/plugin/ordinal.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*global describe, before, it */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time');
-
- var plugin = 'ordinal';
-
- if (typeof require === 'function') {
- plugin = require('date-and-time/plugin/ordinal');
- }
-
- describe('ordinal number', function () {
- before(function () {
- date.plugin(plugin);
- });
-
- it('Jan. XX, 2019', function () {
- for (var i = 1, d, now; i <= 31; i++) {
- now = new Date(2019, 0, i, 12, 34, 56, 789);
- switch (i) {
- case 1:
- case 21:
- case 31:
- d = i + 'st';
- break;
- case 2:
- case 22:
- d = i + 'nd';
- break;
- case 3:
- case 23:
- d = i + 'rd';
- break;
- default:
- d = i + 'th';
- break;
- }
- expect(date.format(now, 'MMM. DDD, YYYY')).to.equal('Jan. ' + d + ', 2019');
- }
- });
- });
-
-}(this));
diff --git a/test/plugin/timespan.js b/test/plugin/timespan.js
deleted file mode 100644
index fcd1fd0..0000000
--- a/test/plugin/timespan.js
+++ /dev/null
@@ -1,172 +0,0 @@
-/*global describe, before, it */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time');
-
- var plugin = 'timespan';
-
- if (typeof require === 'function') {
- plugin = require('date-and-time/plugin/timespan');
- }
-
- describe('timespan', function () {
- before(function () {
- date.plugin(plugin);
- });
-
- it('toMilliseconds, S', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('S')).to.equal('1');
- });
- it('toMilliseconds, SS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('SS')).to.equal('01');
- });
- it('toMilliseconds, SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('001');
- });
- it('toMilliseconds, over SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('' + 31 * 24 * 60 * 60 * 1000);
- });
- it('toMilliseconds, over SSS, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMilliseconds('SSS')).to.equal('-' + 31 * 24 * 60 * 60 * 1000);
- });
- it('toSeconds, s', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toSeconds('s')).to.equal('0');
- });
- it('toSeconds, ss', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('00');
- });
- it('toSeconds, over ss', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('' + 31 * 24 * 60 * 60);
- });
- it('toSeconds, over ss, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toSeconds('ss')).to.equal('-' + 31 * 24 * 60 * 60);
- });
- it('toSeconds, over ss.SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 57, 790);
- expect(date.timeSpan(to, from).toSeconds('ss.SSS')).to.equal('01.001');
- });
- it('toSeconds, over ss.SSS, negative', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 790);
- var to = new Date(2019, 0, 1, 0, 34, 55, 789);
- expect(date.timeSpan(to, from).toSeconds('ss.SSS')).to.equal('-01.001');
- });
- it('toMinutes, m', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMinutes('m')).to.equal('0');
- });
- it('toMinutes, mm', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('00');
- });
- it('toMinutes, over mm', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('' + 31 * 24 * 60);
- });
- it('toMinutes, over mm, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toMinutes('mm')).to.equal('-' + 31 * 24 * 60);
- });
- it('toMinutes, over mm:ss.SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 35, 57, 790);
- expect(date.timeSpan(to, from).toMinutes('mm:ss.SSS')).to.equal('01:01.001');
- });
- it('toMinutes, over mm:ss.SSS, negative', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 790);
- var to = new Date(2019, 0, 1, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toMinutes('mm:ss.SSS')).to.equal('-01:01.001');
- });
- it('toHours, H', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toHours('H')).to.equal('0');
- });
- it('toHours, HH', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('00');
- });
- it('toHours, over HH', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('' + 31 * 24);
- });
- it('toHours, over HH, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toHours('HH')).to.equal('-' + 31 * 24);
- });
- it('toHours, over HH:mm:ss.SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 1, 35, 57, 790);
- expect(date.timeSpan(to, from).toHours('HH:mm:ss.SSS')).to.equal('01:01:01.001');
- });
- it('toHours, over HH:mm:ss.SSS, negative', function () {
- var from = new Date(2019, 0, 1, 1, 34, 56, 790);
- var to = new Date(2019, 0, 1, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toHours('HH:mm:ss.SSS')).to.equal('-01:01:01.001');
- });
- it('toDays, D', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toDays('D')).to.equal('0');
- });
- it('toDays, DD', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 790);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('00');
- });
- it('toDays, over DD', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 1, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('' + 31);
- });
- it('toDays, over DD, negative', function () {
- var from = new Date(2019, 1, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 1, 0, 34, 56, 789);
- expect(date.timeSpan(to, from).toDays('DD')).to.equal('-' + 31);
- });
- it('toDays, over DD HH:mm:ss.SSS', function () {
- var from = new Date(2019, 0, 1, 0, 34, 56, 789);
- var to = new Date(2019, 0, 2, 1, 35, 57, 790);
- expect(date.timeSpan(to, from).toDays('DD HH:mm:ss.SSS')).to.equal('01 01:01:01.001');
- });
- it('toDays, over DD HH:mm:ss.SSS, negative', function () {
- var from = new Date(2019, 0, 1, 1, 34, 56, 790);
- var to = new Date(2019, 0, 0, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toDays('DD HH:mm:ss.SSS')).to.equal('-01 01:01:01.001');
- });
- it('comments', function () {
- var from = new Date(2019, 0, 1, 1, 34, 56, 790);
- var to = new Date(2019, 0, 0, 0, 33, 55, 789);
- expect(date.timeSpan(to, from).toDays('[DD HH:mm:ss.SSS]')).to.equal('DD HH:mm:ss.SSS');
- });
- });
-
-}(this));
-
diff --git a/test/plugin/timezone.js b/test/plugin/timezone.js
deleted file mode 100644
index 8c8622e..0000000
--- a/test/plugin/timezone.js
+++ /dev/null
@@ -1,913 +0,0 @@
-/*global describe, before, it */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time');
-
- var plugin = 'timezone';
-
- if (typeof require === 'function') {
- plugin = require('date-and-time/plugin/timezone');
- }
-
- describe('timezone', function () {
- before(function () {
- date.plugin(plugin);
- });
-
- describe('formatTZ', function () {
- it('formatTZ UTC-8', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 UTC-0800');
- });
-
- it('formatTZ UTC-7 (Start of DST)', function () {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 3:00:00.000 UTC-0700');
- });
-
- it('formatTZ UTC-7 (End of DST)', function () {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:59:59.999 UTC-0700');
- });
-
- it('formatTZ UTC-8', function () {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:00:00.000 UTC-0800');
- });
-
- it('formatTZ UTC+9', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS [UTC]Z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 18:59:59.999 UTC+0900');
- });
- });
-
- describe('parseTZ', function () {
- it('parseTZ UTC', function () {
- // Mar 14 2021 1:59:59.999 => 2021-03-14T01:59:59.999Z
- var dateString = 'Mar 14 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'UTC';
- var dateObj = new Date(Date.UTC(2021, 2, 14, 1, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-8', function () {
- // Mar 14 2021 1:59:59.999 => 2021-03-14T09:59:59.999Z
- var dateString = 'Mar 14 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ Edge case1', function () {
- // Mar 14 2021 2:00:00.000 => 2021-03-14T10:00:00.000Z
- var dateString = 'Mar 14 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles';
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ Edge case2', function () {
- // Mar 14 2021 2:59:59.999 => 2021-03-14T10:59:59.999Z
- var dateString = 'Mar 14 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles';
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-7 (Start of DST)', function () {
- // Mar 14 2021 3:00:00.000 => 2021-03-14T10:00:00.000Z
- var dateString = 'Mar 14 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-7 (End of DST)', function () {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T08:59:59.999Z
- var dateString = 'Nov 7 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-8 with Z', function () {
- // Nov 7 2021 1:59:59.999 => 2021-11-07T09:59:59.999Z
- var dateString = 'Nov 7 2021 1:59:59.999 -0800';
- var formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 59, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC-8', function () {
- // Nov 7 2021 2:00:00.000 => 2021-11-07T10:00:00.000Z
- var dateString = 'Nov 7 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
- var dateObj = new Date(Date.UTC(2021, 10, 7, 10, 0, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+9.5', function () {
- // Oct 3 2021 1:59:59.999 => 2021-10-02T16:29:59.999Z
- var dateString = 'Oct 3 2021 1:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ Edge case1', function () {
- // Oct 3 2021 2:00:00.000 => 2021-10-02T16:30:00.000Z
- var dateString = 'Oct 3 2021 2:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide';
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ Edge case2', function () {
- // Oct 3 2021 2:59:59.999 => 2021-10-02T17:29:59.999Z
- var dateString = 'Oct 3 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide';
- var dateObj = new Date(Date.UTC(2021, 9, 2, 17, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+10.5 (Start of DST)', function () {
- // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
- var dateString = 'Oct 3 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+10.5 DST
- var dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+10.5 (End of DST)', function () {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T16:29:59.999Z
- var dateString = 'Apr 4 2021 2:59:59.999';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+10.5 DST
- var dateObj = new Date(Date.UTC(2021, 3, 3, 16, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+9.5 with Z', function () {
- // Apr 4 2021 2:59:59.999 => 2021-04-03T17:29:59.999Z
- var dateString = 'Apr 4 2021 2:59:59.999 +0930';
- var formatString = 'MMM D YYYY H:mm:ss.SSS Z';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 3, 3, 17, 29, 59, 999));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
-
- it('parseTZ UTC+9.5', function () {
- // Apr 4 2021 3:00:00.000 => 2021-04-03T17:30:00.000Z
- var dateString = 'Apr 4 2021 3:00:00.000';
- var formatString = 'MMM D YYYY H:mm:ss.SSS';
- var tz = 'Australia/Adelaide'; // UTC+9.5
- var dateObj = new Date(Date.UTC(2021, 3, 3, 17, 30, 0, 0));
-
- expect(date.parseTZ(dateString, formatString, tz).getTime()).to.equal(dateObj.getTime());
- });
- });
-
- describe('transformTZ', function () {
- it('transformTZ EST to PST', function () {
- var dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'November 7 2021 1:00:00.000';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EST to PDT (End of DST)', function () {
- var dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'November 7 2021 1:59:59.999';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to PST', function () {
- var dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'March 14 2021 1:59:59.999';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to PDT (Start of DST)', function () {
- var dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'March 14 2021 3:00:00.000';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PST to JST', function () {
- var dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 18:59:59.999';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PDT to JST', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 19:00:00.000';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ UTC to JST', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC+0000';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 12:00:00.000';
-
- // 2021-03-14T03:00:00.000 UTC+0000 => March 14 2021 12:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- });
-
- describe('addYearsTZ', function () {
- it('One year after 2024', function () {
- var date1 = new Date(Date.UTC(2024, 1, 29, 10));
- var date2 = new Date(Date.UTC(2025, 1, 28, 10));
-
- expect(date.addYearsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One year before 2024', function () {
- var date1 = new Date(Date.UTC(2024, 1, 29, 10));
- var date2 = new Date(Date.UTC(2023, 1, 28, 10));
-
- expect(date.addYearsTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('Four years after 2024', function () {
- var date1 = new Date(Date.UTC(2024, 1, 29, 10));
- var date2 = new Date(Date.UTC(2028, 1, 29, 10));
-
- expect(date.addYearsTZ(date1, 4, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('Four years before 2024', function () {
- var date1 = new Date(Date.UTC(2024, 1, 29, 10));
- var date2 = new Date(Date.UTC(2020, 1, 29, 10));
-
- expect(date.addYearsTZ(date1, -4, 'America/Los_Angeles')).to.eql(date2);
- });
- });
-
- describe('addMonthsTZ', function () {
- it('One month after 2:00 AM on January 31, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 0, 31, 10));
- var date2 = new Date(Date.UTC(2024, 1, 29, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('Two months after 2:00 AM on January 31, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 0, 31, 10));
- var date2 = new Date(Date.UTC(2024, 2, 31, 9));
-
- expect(date.addMonthsTZ(date1, 2, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('Three months after 2:00 AM on January 31, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 0, 31, 10));
- var date2 = new Date(Date.UTC(2024, 3, 30, 9));
-
- expect(date.addMonthsTZ(date1, 3, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 1:00 AM on February 10, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 1, 10, 9));
- var date2 = new Date(Date.UTC(2024, 2, 10, 9));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 2:00 AM on February 10, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 1, 10, 10));
- var date2 = new Date(Date.UTC(2024, 2, 10, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 3:00 AM on February 10, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 1, 10, 11));
- var date2 = new Date(Date.UTC(2024, 2, 10, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month before 1:00 AM on December 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 11, 3, 8));
- var date2 = new Date(Date.UTC(2024, 10, 3, 7));
-
- expect(date.addMonthsTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month before 2:00 AM on December 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 11, 3, 9));
- var date2 = new Date(Date.UTC(2024, 10, 3, 8));
-
- expect(date.addMonthsTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month before 3:00 AM on December 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 11, 3, 10));
- var date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addMonthsTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 1:00 AM on November 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 3, 8));
- var date2 = new Date(Date.UTC(2024, 11, 3, 9));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 1:00 AM PST on November 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 3, 9));
- var date2 = new Date(Date.UTC(2024, 11, 3, 9));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 2:00 AM on November 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 3, 10));
- var date2 = new Date(Date.UTC(2024, 11, 3, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 1:00 AM on October 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 9, 3, 8));
- var date2 = new Date(Date.UTC(2024, 10, 3, 8));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 2:00 AM on October 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 9, 3, 9));
- var date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One month after 3:00 AM on October 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 9, 3, 10));
- var date2 = new Date(Date.UTC(2024, 10, 3, 11));
-
- expect(date.addMonthsTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
- });
-
- describe('addDaysTZ', function () {
- it('One day after 1:00 AM on March 9, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 2, 9, 9));
- var date2 = new Date(Date.UTC(2024, 2, 10, 9));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 2:00 AM on March 9, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 2, 9, 10));
- var date2 = new Date(Date.UTC(2024, 2, 10, 10));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 3:00 AM on March 9, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 2, 9, 11));
- var date2 = new Date(Date.UTC(2024, 2, 10, 10));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 1:00 AM on March 10, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 2, 10, 9));
- var date2 = new Date(Date.UTC(2024, 2, 9, 9));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 3:00 AM on March 10, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 2, 10, 10));
- var date2 = new Date(Date.UTC(2024, 2, 9, 11));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 4:00 AM on March 10, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 2, 10, 11));
- var date2 = new Date(Date.UTC(2024, 2, 9, 12));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 1:00 AM on November 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 3, 8));
- var date2 = new Date(Date.UTC(2024, 10, 2, 8));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 1:00 AM PST on November 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 3, 9));
- var date2 = new Date(Date.UTC(2024, 10, 2, 8));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 2:00 AM on November 3, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 3, 10));
- var date2 = new Date(Date.UTC(2024, 10, 2, 9));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 1:00 AM on November 2, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 2, 8));
- var date2 = new Date(Date.UTC(2024, 10, 3, 8));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 2:00 AM on November 2, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 2, 9));
- var date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day after 3:00 AM on November 2, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 2, 10));
- var date2 = new Date(Date.UTC(2024, 10, 3, 11));
-
- expect(date.addDaysTZ(date1, 1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 1:00 AM on November 4, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 4, 9));
- var date2 = new Date(Date.UTC(2024, 10, 3, 8));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 2:00 AM on November 4, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 4, 10));
- var date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
-
- it('One day before 3:00 AM on November 4, 2024', function () {
- var date1 = new Date(Date.UTC(2024, 10, 4, 10));
- var date2 = new Date(Date.UTC(2024, 10, 3, 10));
-
- expect(date.addDaysTZ(date1, -1, 'America/Los_Angeles')).to.eql(date2);
- });
- });
-
- describe('additional tokens', function () {
- describe('formatTZ', function () {
- it('formatTZ PST', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 PST');
- });
-
- it('formatTZ PDT (Start of DST)', function () {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 3:00:00.000 PDT');
- });
-
- it('formatTZ PDT (End of DST)', function () {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:59:59.999 PDT');
- });
-
- it('formatTZ PST', function () {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:00:00.000 PST');
- });
-
- it('formatTZ JST', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS z';
- var tz = 'Asia/Tokyo';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 18:59:59.999 JST');
- });
-
- it('formatTZ Pacific Standard Time', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 1:59:59.999 Pacific Standard Time');
- });
-
- it('formatTZ Pacific Daylight Time (Start of DST)', function () {
- // 2021-03-14T10:00:00.000Z => March 14 2021 3:00:00.000
- var dateObj = new Date(Date.UTC(2021, 2, 14, 10, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 3:00:00.000 Pacific Daylight Time');
- });
-
- it('formatTZ Pacific Daylight Time (End of DST)', function () {
- // 2021-11-07T08:59:59.999Z => November 7 2021 1:59:59.999
- var dateObj = new Date(Date.UTC(2021, 10, 7, 8, 59, 59, 999));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:59:59.999 Pacific Daylight Time');
- });
-
- it('formatTZ Pacific Standard Time', function () {
- // 2021-11-07T09:00:00.000Z => November 7 2021 1:00:00.000
- var dateObj = new Date(Date.UTC(2021, 10, 7, 9, 0, 0, 0));
- var formatString = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('November 7 2021 1:00:00.000 Pacific Standard Time');
- });
-
- it('formatTZ Japan Standard Time', function () {
- // 2021-03-14T09:59:59.999Z => March 14 2021 18:59:59.999
- var dateObj = new Date(Date.UTC(2021, 2, 14, 9, 59, 59, 999));
- var formatString = 'MMMM DD YYYY H:mm:ss.SSS zz';
- var tz = 'Asia/Tokyo';
-
- expect(date.formatTZ(dateObj, formatString, tz)).to.equal('March 14 2021 18:59:59.999 Japan Standard Time');
- });
- });
-
- describe('transformTZ', function () {
- it('transformTZ EST to PST', function () {
- var dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'November 7 2021 1:00:00.000 PST';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000 PST
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EST to PDT (End of DST)', function () {
- var dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'November 7 2021 1:59:59.999 PDT';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to PST', function () {
- var dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'March 14 2021 1:59:59.999 PST';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to PDT (Start of DST)', function () {
- var dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'March 14 2021 3:00:00.000 PDT';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PST to JST', function () {
- var dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 18:59:59.999 JST';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PDT to JST', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 19:00:00.000 JST';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ UTC to JST', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC+0000';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS z';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 12:00:00.000 JST';
-
- // 2021-03-14T03:00:00.000 UTC+0000 => March 14 2021 12:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EST to Pacific Standard Time', function () {
- var dateString1 = '2021-11-07T04:00:00.000 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'November 7 2021 1:00:00.000 Pacific Standard Time';
-
- // 2021-11-07T04:00:00.000 UTC-0500 => November 7 2021 1:00:00.000 PST
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EST to Pacific Daylight Time (End of DST)', function () {
- var dateString1 = '2021-11-07T03:59:59.999 UTC-0500';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'November 7 2021 1:59:59.999 Pacific Daylight Time';
-
- // 2021-11-07T03:59:59.999 UTC-0500 => November 7 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to Pacific Standard Time', function () {
- var dateString1 = '2021-03-14T05:59:59.999 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles'; // UTC-8
-
- var dateString2 = 'March 14 2021 1:59:59.999 Pacific Standard Time';
-
- // 2021-03-14T05:59:59.999 UTC-0400 => March 14 2021 1:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ EDT to Pacific Daylight Time (Start of DST)', function () {
- var dateString1 = '2021-03-14T06:00:00.000 UTC-0400';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'America/Los_Angeles'; // UTC-7 DST
-
- var dateString2 = 'March 14 2021 3:00:00.000 Pacific Daylight Time';
-
- // 2021-03-14T06:00:00.000 UTC-0400 => March 14 2021 3:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PST to Japan Standard Time', function () {
- var dateString1 = '2021-03-14T01:59:59.999 UTC-0800';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 18:59:59.999 Japan Standard Time';
-
- // 2021-03-14T01:59:59.999 UTC-0800 => March 14 2021 18:59:59.999
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ PDT to Japan Standard Time', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC-0700';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 19:00:00.000 Japan Standard Time';
-
- // 2021-03-14T03:00:00.000 UTC-0700 => March 14 2021 19:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
-
- it('transformTZ UTC to Japan Standard Time', function () {
- var dateString1 = '2021-03-14T03:00:00.000 UTC+0000';
- var formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS [UTC]Z';
- var formatString2 = 'MMMM D YYYY H:mm:ss.SSS zz';
- var tz = 'Asia/Tokyo'; // UTC+9
-
- var dateString2 = 'March 14 2021 12:00:00.000 Japan Standard Time';
-
- // 2021-03-14T03:00:00.000 UTC+0000 => March 14 2021 12:00:00.000
- expect(date.transformTZ(dateString1, formatString1, formatString2, tz)).to.equal(dateString2);
- });
- });
- });
-
- describe('format', function () {
- before(function () {
- process.env.TZ = 'America/Los_Angeles';
- });
-
- it('"z" equals to "PST"', function () {
- // Before the start of daylight saving time
- var now = new Date(2024, 2, 10, 1, 59, 59, 999);
- expect(date.format(now, 'z')).to.equal('PST');
- });
-
- it('"z" equals to "PDT"', function () {
- // Daylight saving time started
- var now = new Date(2024, 2, 10, 2, 0, 0, 0);
- expect(date.format(now, 'z')).to.equal('PDT');
- });
-
- it('"z" equals to "PDT"', function () {
- // Before the end of daylight saving time
- var now = new Date(2024, 10, 3, 1, 0, 0, 0);
- expect(date.format(now, 'z')).to.equal('PDT');
- });
-
- it('"z" equals to "PST"', function () {
- // Daylight saving time ends
- var now = new Date(2024, 10, 3, 2, 0, 0, 0);
- expect(date.format(now, 'z')).to.equal('PST');
- });
-
- it('"zz" equals to "Pacific Standard Time"', function () {
- // Before the start of daylight saving time
- var now = new Date(2024, 2, 10, 1, 59, 59, 999);
- expect(date.format(now, 'zz')).to.equal('Pacific Standard Time');
- });
-
- it('"zz" equals to "Pacific Daylight Time"', function () {
- // Daylight saving time started
- var now = new Date(2024, 2, 10, 2, 0, 0, 0);
- expect(date.format(now, 'zz')).to.equal('Pacific Daylight Time');
- });
-
- it('"zz" equals to "Pacific Daylight Time"', function () {
- // Before the end of daylight saving time
- var now = new Date(2024, 10, 3, 1, 0, 0, 0);
- expect(date.format(now, 'zz')).to.equal('Pacific Daylight Time');
- });
-
- it('"zz" equals to "Pacific Standard Time"', function () {
- // Daylight saving time ends
- var now = new Date(2024, 10, 3, 2, 0, 0, 0);
- expect(date.format(now, 'zz')).to.equal('Pacific Standard Time');
- });
- });
-
- describe('transform', function () {
- before(function () {
- process.env.TZ = 'America/Los_Angeles';
- });
-
- it('"z" equals to "PST"', function () {
- // Before the start of daylight saving time
- expect(date.transform('10 March 2024, 01:59:59.999', 'D MMMM YYYY, HH:mm:ss.SSS', 'z')).to.equal('PST');
- });
-
- it('"z" equals to "PDT"', function () {
- // Daylight saving time started
- expect(date.transform('10 March 2024, 02:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'z')).to.equal('PDT');
- });
-
- it('"z" equals to "PDT"', function () {
- // Before the end of daylight saving time
- expect(date.transform('3 November 2024, 01:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'z')).to.equal('PDT');
- });
-
- it('"z" equals to "PST"', function () {
- // Daylight saving time ends
- expect(date.transform('3 November 2024, 02:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'z')).to.equal('PST');
- });
-
- it('"zz" equals to "Pacific Standard Time"', function () {
- // Before the start of daylight saving time
- expect(date.transform('10 March 2024, 01:59:59.999', 'D MMMM YYYY, HH:mm:ss.SSS', 'zz')).to.equal('Pacific Standard Time');
- });
-
- it('"zz" equals to "Pacific Daylight Time"', function () {
- // Daylight saving time started
- expect(date.transform('10 March 2024, 02:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'zz')).to.equal('Pacific Daylight Time');
- });
-
- it('"zz" equals to "Pacific Daylight Time"', function () {
- // Before the end of daylight saving time
- expect(date.transform('3 November 2024, 01:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'zz')).to.equal('Pacific Daylight Time');
- });
-
- it('"zz" equals to "Pacific Standard Time"', function () {
- // Daylight saving time ends
- expect(date.transform('3 November 2024, 02:00:00.000', 'D MMMM YYYY, HH:mm:ss.SSS', 'zz')).to.equal('Pacific Standard Time');
- });
- });
- });
-
-}(this));
diff --git a/test/plugin/two-digit-year.js b/test/plugin/two-digit-year.js
deleted file mode 100644
index 990e44a..0000000
--- a/test/plugin/two-digit-year.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*global describe, it */
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time');
-
- var plugin = 'two-digit-year';
-
- if (typeof require === 'function') {
- plugin = require('date-and-time/plugin/two-digit-year');
- }
-
- date.plugin(plugin);
-
- describe('compile (two-digit-year)', function () {
- it('YY', function () {
- var obj = ['YY', 'YY'];
- expect(date.compile('YY')).to.eql(obj);
- });
- });
-
- describe('preparse (two-digit-year)', function () {
- it('YY-1', function () {
- var dt = { Y: 2000, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('00', 'YY')).to.eql(dt);
- });
- it('YY-2', function () {
- var dt = { Y: 2001, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('01', 'YY')).to.eql(dt);
- });
- it('YY-3', function () {
- var dt = { Y: 2010, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('10', 'YY')).to.eql(dt);
- });
- it('YY-4', function () {
- var dt = { Y: 2069, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('69', 'YY')).to.eql(dt);
- });
- it('YY-5', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('70', 'YY')).to.eql(dt);
- });
- it('YY-6', function () {
- var dt = { Y: 1999, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('99', 'YY')).to.eql(dt);
- });
- });
-
- describe('parse (two-digit-year)', function () {
- it('YY-1', function () {
- var now = new Date(2000, 0, 1);
- expect(date.parse('00', 'YY')).to.eql(now);
- });
- it('YY-2', function () {
- var now = new Date(2001, 0, 1);
- expect(date.parse('01', 'YY')).to.eql(now);
- });
- it('YY-3', function () {
- var now = new Date(2010, 0, 1);
- expect(date.parse('10', 'YY')).to.eql(now);
- });
- it('YY-4', function () {
- var now = new Date(2069, 0, 1);
- expect(date.parse('69', 'YY')).to.eql(now);
- });
- it('YY-5', function () {
- var now = new Date(1970, 0, 1);
- expect(date.parse('70', 'YY')).to.eql(now);
- });
- it('YY-6', function () {
- var now = new Date(1999, 0, 1);
- expect(date.parse('99', 'YY')).to.eql(now);
- });
- });
-
-}(this));
diff --git a/test/test.js b/test/test.js
deleted file mode 100644
index 92661cf..0000000
--- a/test/test.js
+++ /dev/null
@@ -1,1934 +0,0 @@
-/*global describe, it */
-process.env.TZ = 'UTC';
-
-(function (global) {
- 'use strict';
-
- var expect = global.expect || require('expect.js'),
- date = global.date || require('date-and-time');
-
- describe('format', function () {
- it('"YYYY" equals to "0001"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'YYYY')).to.equal('0001');
- });
- it('"YYYY" equals to "0099"', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.format(now, 'YYYY')).to.equal('0099');
- });
- it('"YYYY" equals to "0100"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('0100');
- });
- it('"YYYY" equals to "1800"', function () {
- var now = new Date(1800, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1800');
- });
- it('"YYYY" equals to "1899"', function () {
- var now = new Date(1899, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1899');
- });
- it('"YYYY" equals to "1900"', function () {
- var now = new Date(1900, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1900');
- });
- it('"YYYY" equals to "1901"', function () {
- var now = new Date(1901, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1901');
- });
- it('"YYYY" equals to "1970"', function () {
- var now = new Date(1970, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1970');
- });
- it('"YYYY" equals to "1999"', function () {
- var now = new Date(1999, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('1999');
- });
- it('"YYYY" equals to "2000"', function () {
- var now = new Date(2000, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('2000');
- });
- it('"YYYY" equals to "2001"', function () {
- var now = new Date(2001, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('2001');
- });
- it('"YYYY" equals to "9999"', function () {
- var now = new Date(9999, 0, 1);
- expect(date.format(now, 'YYYY')).to.equal('9999');
- });
- it('"YYYY" as UTC equals to "XXXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'YYYY', utc)).to.equal('' + now.getUTCFullYear());
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(101, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(199, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(1900, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(1901, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(1999, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(2000, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(2001, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(2099, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" equals to "00"', function () {
- var now = new Date(9900, 0, 1);
- expect(date.format(now, 'YY')).to.equal('00');
- });
- it('"YY" equals to "01"', function () {
- var now = new Date(9901, 0, 1);
- expect(date.format(now, 'YY')).to.equal('01');
- });
- it('"YY" equals to "99"', function () {
- var now = new Date(9999, 0, 1);
- expect(date.format(now, 'YY')).to.equal('99');
- });
- it('"YY" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'YY')).to.equal('' + (now.getUTCFullYear() - 2000));
- });
- it('"Y" equals to "1"', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.format(now, 'Y')).to.equal('1');
- });
- it('"Y" equals to "10"', function () {
- var now = new Date(0, -1890 * 12, 1);
- expect(date.format(now, 'Y')).to.equal('10');
- });
- it('"Y" equals to "100"', function () {
- var now = new Date(100, 0, 1);
- expect(date.format(now, 'Y')).to.equal('100');
- });
- it('"Y" equals to "1000"', function () {
- var now = new Date(1000, 0, 1);
- expect(date.format(now, 'Y')).to.equal('1000');
- });
- it('"Y" equals to "10000"', function () {
- var now = new Date(10000, 0, 1);
- expect(date.format(now, 'Y')).to.equal('10000');
- });
- it('"Y" as UTC equals to "X"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'Y')).to.equal('' + (now.getUTCFullYear()));
- });
- it('"MMMM" equals to "January"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMMM')).to.equal('January');
- });
- it('"MMMM" equals to "December"', function () {
- var now = new Date(2015, 11, 1);
- expect(date.format(now, 'MMMM')).to.equal('December');
- });
- it('"MMM" equals to "Jan"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MMM')).to.equal('Jan');
- });
- it('"MMM" equals to "Dec"', function () {
- var now = new Date(2015, 11, 1);
- expect(date.format(now, 'MMM')).to.equal('Dec');
- });
- it('"MM" equals to "01"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MM')).to.equal('01');
- });
- it('"MM" equals to "12"', function () {
- var now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(date.format(now, 'MM')).to.equal('12');
- });
- it('"MM" as UTC equals to "XX"', function () {
- var now = new Date(2015, 10, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'MM', utc)).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"M" equals to "1"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('1');
- });
- it('"M" equals to "12"', function () {
- var now = new Date(2015, 11, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('12');
- });
- it('"M" as UTC equals to "XX"', function () {
- var now = new Date(2015, 10, 1, 12, 34, 56, 789);
- expect(date.format(now, 'M')).to.equal('' + (now.getUTCMonth() + 1));
- });
- it('"DD" equals to "01"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'DD')).to.equal('01');
- });
- it('"DD" equals to "31"', function () {
- var now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(date.format(now, 'DD')).to.equal('31');
- });
- it('"DD" equals to "XX"', function () {
- var now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'DD', utc)).to.equal('' + now.getUTCDate());
- });
- it('"D" equals to "1"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'D')).to.equal('1');
- });
- it('"D" equals to "31"', function () {
- var now = new Date(2015, 0, 31, 12, 34, 56, 789);
- expect(date.format(now, 'D')).to.equal('31');
- });
- it('"D" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 15, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'D', utc)).to.equal('' + now.getUTCDate());
- });
- it('"dddd" equals to "Tuesday"', function () {
- var now = new Date(2015, 0, 6, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal('Tuesday');
- });
- it('"dddd" equals to "Thursday"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'dddd')).to.equal('Thursday');
- });
- it('"ddd" equals to "Sun"', function () {
- var now = new Date(2015, 0, 4, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal('Sun');
- });
- it('"ddd" equals to "Wed"', function () {
- var now = new Date(2015, 0, 7, 12, 34, 56, 789);
- expect(date.format(now, 'ddd')).to.equal('Wed');
- });
- it('"dd" equals to "Fr"', function () {
- var now = new Date(2015, 0, 2, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal('Fr');
- });
- it('"dd" equals to "Sa"', function () {
- var now = new Date(2015, 0, 3, 12, 34, 56, 789);
- expect(date.format(now, 'dd')).to.equal('Sa');
- });
- it('"HH" equals to "12"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('12');
- });
- it('"HH" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('00');
- });
- it('"HH" equals to "23"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'HH')).to.equal('23');
- });
- it('"HH" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'HH', utc)).to.equal(('0' + now.getUTCHours()).slice(-2));
- });
- it('"H" equals to "12"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('12');
- });
- it('"H" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('0');
- });
- it('"H" equals to "23"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'H')).to.equal('23');
- });
- it('"H" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'H', utc)).to.equal('' + now.getUTCHours());
- });
- it('"hh A" equals to "12 PM"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('12 PM');
- });
- it('"hh A" equals to "12 AM"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('12 AM');
- });
- it('"hh A" equals to "11 PM"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('11 PM');
- });
- it('"hh A" equals to "01 AM"', function () {
- var now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('01 AM');
- });
- it('"hh A" equals to "01 PM"', function () {
- var now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(date.format(now, 'hh A')).to.equal('01 PM');
- });
- it('"h A" equals to "12 PM"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('12 PM');
- });
- it('"h A" equals to "12 AM"', function () {
- var now = new Date(2015, 0, 1, 0, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('12 AM');
- });
- it('"h A" equals to "11 PM"', function () {
- var now = new Date(2015, 0, 1, 23, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('11 PM');
- });
- it('"h A" equals to "1 AM"', function () {
- var now = new Date(2015, 0, 1, 1, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('1 AM');
- });
- it('"h A" equals to "1 PM"', function () {
- var now = new Date(2015, 0, 1, 13, 34, 56, 789);
- expect(date.format(now, 'h A')).to.equal('1 PM');
- });
- it('"mm" equals to "34"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'mm')).to.equal('34');
- });
- it('"mm" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(date.format(now, 'mm')).to.equal('00');
- });
- it('"mm" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(date.format(now, 'mm')).to.equal('59');
- });
- it('"mm" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(date.format(now, 'mm', utc)).to.equal(('0' + now.getUTCMinutes()).slice(-2));
- });
- it('"m" equals to "34"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'm')).to.equal('34');
- });
- it('"m" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 0, 56, 789);
- expect(date.format(now, 'm')).to.equal('0');
- });
- it('"m" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789);
- expect(date.format(now, 'm')).to.equal('59');
- });
- it('"m" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 59, 56, 789),
- utc = true;
- expect(date.format(now, 'm', utc)).to.equal('' + now.getUTCMinutes());
- });
- it('"ss" equals to "56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ss')).to.equal('56');
- });
- it('"ss" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(date.format(now, 'ss')).to.equal('00');
- });
- it('"ss" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(date.format(now, 'ss')).to.equal('59');
- });
- it('"ss" as UTC equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(date.format(now, 'ss', utc)).to.equal(('0' + now.getUTCSeconds()).slice(-2));
- });
- it('"s" equals to "56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 's')).to.equal('56');
- });
- it('"s" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 0, 789);
- expect(date.format(now, 's')).to.equal('0');
- });
- it('"s" equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789);
- expect(date.format(now, 's')).to.equal('59');
- });
- it('"s" as UTC equals to "59"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 59, 789),
- utc = true;
- expect(date.format(now, 's', utc)).to.equal('' + now.getUTCSeconds());
- });
- it('"SSS" equals to "789"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'SSS')).to.equal('789');
- });
- it('"SSS" equals to "000"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'SSS')).to.equal('000');
- });
- it('"SSS" equals to "001"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'SSS')).to.equal('001');
- });
- it('"SSS" as UTC equals to "XXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 10),
- utc = true;
- expect(date.format(now, 'SSS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3));
- });
- it('"SS" equals to "78"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'SS')).to.equal('78');
- });
- it('"SS" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'SS')).to.equal('00');
- });
- it('"SS" equals to "00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'SS')).to.equal('00');
- });
- it('"SS" as UTC equals to "XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 9),
- utc = true;
- expect(date.format(now, 'SS', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 2));
- });
- it('"S" equals to "7"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'S')).to.equal('7');
- });
- it('"S" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 0);
- expect(date.format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "0"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 1);
- expect(date.format(now, 'S')).to.equal('0');
- });
- it('"S" equals to "X"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'S', utc)).to.equal(('00' + now.getUTCMilliseconds()).slice(-3).slice(0, 1));
- });
- it('"Z" matches "+XXXX/-XXXX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'Z')).to.match(/^[+-]\d{4}$/);
- });
- it('"Z" as UTC equals to "+0000"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'Z', utc)).to.equal('+0000');
- });
- it('"ZZ" matches "+XX:XX/-XX:XX"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ZZ')).to.match(/^[+-]\d{2}:\d{2}$/);
- });
- it('"ZZ" as UTC equals to "+00:00"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789),
- utc = true;
- expect(date.format(now, 'ZZ', utc)).to.equal('+00:00');
- });
- it('"ddd MMM DD YYYY HH:mm:ss" equals to "Thu Jan 01 2015 12:34:56"', function () {
- var now = new Date(2015, 0, 1, 12, 34, 56, 789);
- expect(date.format(now, 'ddd MMM DD YYYY HH:mm:ss')).to.equal('Thu Jan 01 2015 12:34:56');
- });
- it('"YYYY/MM/DD HH:mm:ss.SSS" equals to "1900/01/01 00:00:00.000"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YYYY/MM/DD HH:mm:ss.SSS')).to.equal('1900/01/01 00:00:00.000');
- });
- it('"YY/MM/DD HH:mm:ss.SSS" equals to "00/01/01 00:00:00.000"', function () {
- var now = new Date(0, 0, 1);
- expect(date.format(now, 'YY/MM/DD HH:mm:ss.SSS')).to.equal('00/01/01 00:00:00.000');
- });
- it('"Y/M/D H:m:s.SSS" equals to "999/1/1 0:0:0.000"', function () {
- var now = new Date(999, 0, 1);
- expect(date.format(now, 'Y/M/D H:m:s.SSS')).to.equal('999/1/1 0:0:0.000');
- });
- it('"dddd, MMMM D, YYYY h A" equals to "Saturday, January 1, 2000 10 AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, 'dddd, MMMM D, YYYY h A')).to.equal('Saturday, January 1, 2000 10 AM');
- });
- it('"[dddd, MMMM D, YYYY h A]" equals to "dddd, MMMM D, YYYY h A"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd, MMMM D, YYYY h A]')).to.equal('dddd, MMMM D, YYYY h A');
- });
- it('"[dddd], MMMM [D], YYYY [h] A" equals to "dddd, January D, 2000 h AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd], MMMM [D], YYYY [h] A')).to.equal('dddd, January D, 2000 h AM');
- });
- it('"[[dddd], MMMM [D], YYYY [h] A]" equals to "[dddd], MMMM [D], YYYY [h] A"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[[dddd], MMMM [D], YYYY [h] A]')).to.equal('[dddd], MMMM [D], YYYY [h] A');
- });
- it('"[dddd], MMMM [[D], YYYY] [h] A" equals to "dddd, January [D], YYYY h AM"', function () {
- var now = new Date(2000, 0, 1, 10, 0, 0);
- expect(date.format(now, '[dddd], MMMM [[D], YYYY] [h] A')).to.equal('dddd, January [D], YYYY h AM');
- });
- });
-
- describe('compile', function () {
- it('YYYY', function () {
- var obj = ['YYYY', 'YYYY'];
- expect(date.compile('YYYY')).to.eql(obj);
- });
- it('Y', function () {
- var obj = ['Y', 'Y'];
- expect(date.compile('Y')).to.eql(obj);
- });
- it('YYYY MMMM', function () {
- var obj = ['YYYY MMMM', 'YYYY', ' ', 'MMMM'];
- expect(date.compile('YYYY MMMM')).to.eql(obj);
- });
- it('YYYY MMM', function () {
- var obj = ['YYYY MMM', 'YYYY', ' ', 'MMM'];
- expect(date.compile('YYYY MMM')).to.eql(obj);
- });
- it('YYYY-MM', function () {
- var obj = ['YYYY-MM', 'YYYY', '-', 'MM'];
- expect(date.compile('YYYY-MM')).to.eql(obj);
- });
- it('YYYY-M', function () {
- var obj = ['YYYY-M', 'YYYY', '-', 'M'];
- expect(date.compile('YYYY-M')).to.eql(obj);
- });
- it('YYYY-MM-DD', function () {
- var obj = ['YYYY-MM-DD', 'YYYY', '-', 'MM', '-', 'DD'];
- expect(date.compile('YYYY-MM-DD')).to.eql(obj);
- });
- it('YYYY-M-D', function () {
- var obj = ['YYYY-M-D', 'YYYY', '-', 'M', '-', 'D'];
- expect(date.compile('YYYY-M-D')).to.eql(obj);
- });
- it('YYYY-MM-DD HH', function () {
- var obj = ['YYYY-MM-DD HH', 'YYYY', '-', 'MM', '-', 'DD', ' ', 'HH'];
- expect(date.compile('YYYY-MM-DD HH')).to.eql(obj);
- });
- it('YYYY-M-D H', function () {
- var obj = ['YYYY-M-D H', 'YYYY', '-', 'M', '-', 'D', ' ', 'H'];
- expect(date.compile('YYYY-M-D H')).to.eql(obj);
- });
- it('YYYY-M-D hh A', function () {
- var obj = ['YYYY-M-D hh A', 'YYYY', '-', 'M', '-', 'D', ' ', 'hh', ' ', 'A'];
- expect(date.compile('YYYY-M-D hh A')).to.eql(obj);
- });
- it('YYYY-M-D h A', function () {
- var obj = ['YYYY-M-D h A', 'YYYY', '-', 'M', '-', 'D', ' ', 'h', ' ', 'A'];
- expect(date.compile('YYYY-M-D h A')).to.eql(obj);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var obj = ['YYYY-MM-DD HH:mm', 'YYYY', '-', 'MM', '-', 'DD', ' ', 'HH', ':', 'mm'];
- expect(date.compile('YYYY-MM-DD HH:mm')).to.eql(obj);
- });
- it('YYYY-M-D H:m', function () {
- var obj = ['YYYY-M-D H:m', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm'];
- expect(date.compile('YYYY-M-D H:m')).to.eql(obj);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var obj = ['YYYY-MM-DD HH:mm:ss', 'YYYY', '-', 'MM', '-', 'DD', ' ', 'HH', ':', 'mm', ':', 'ss'];
- expect(date.compile('YYYY-MM-DD HH:mm:ss')).to.eql(obj);
- });
- it('YYYY-M-D H:m:s', function () {
- var obj = ['YYYY-M-D H:m:s', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm', ':', 's'];
- expect(date.compile('YYYY-M-D H:m:s')).to.eql(obj);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var obj = ['YYYY-M-D H:m:s.SSS', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm', ':', 's', '.', 'SSS'];
- expect(date.compile('YYYY-M-D H:m:s.SSS')).to.eql(obj);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var obj = ['YYYY-M-D H:m:s.SS', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm', ':', 's', '.', 'SS'];
- expect(date.compile('YYYY-M-D H:m:s.SS')).to.eql(obj);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var obj = ['YYYY-M-D H:m:s.S', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm', ':', 's', '.', 'S'];
- expect(date.compile('YYYY-M-D H:m:s.S')).to.eql(obj);
- });
- it('MMDDHHmmssSSS', function () {
- var obj = ['MMDDHHmmssSSS', 'MM', 'DD', 'HH', 'mm', 'ss', 'SSS'];
- expect(date.compile('MMDDHHmmssSSS')).to.eql(obj);
- });
- it('DDHHmmssSSS', function () {
- var obj = ['DDHHmmssSSS', 'DD', 'HH', 'mm', 'ss', 'SSS'];
- expect(date.compile('DDHHmmssSSS')).to.eql(obj);
- });
- it('HHmmssSSS', function () {
- var obj = ['HHmmssSSS', 'HH', 'mm', 'ss', 'SSS'];
- expect(date.compile('HHmmssSSS')).to.eql(obj);
- });
- it('mmssSSS', function () {
- var obj = ['mmssSSS', 'mm', 'ss', 'SSS'];
- expect(date.compile('mmssSSS')).to.eql(obj);
- });
- it('ssSSS', function () {
- var obj = ['ssSSS', 'ss', 'SSS'];
- expect(date.compile('ssSSS')).to.eql(obj);
- });
- it('SSS', function () {
- var obj = ['SSS', 'SSS'];
- expect(date.compile('SSS')).to.eql(obj);
- });
- it('foo', function () {
- var obj = ['foo', 'f', 'oo'];
- expect(date.compile('foo')).to.eql(obj);
- });
- it('bar', function () {
- var obj = ['bar', 'b', 'a', 'r'];
- expect(date.compile('bar')).to.eql(obj);
- });
- it('YYYYMMDD', function () {
- var obj = ['YYYYMMDD', 'YYYY', 'MM', 'DD'];
- expect(date.compile('YYYYMMDD')).to.eql(obj);
- });
- it('20150101235959', function () {
- var obj = ['20150101235959', '2', '0', '1', '5', '0', '1', '0', '1', '2', '3', '5', '9', '5', '9'];
- expect(date.compile('20150101235959')).to.eql(obj);
- });
- it('YYYY?M?D H?m?s?S', function () {
- var obj = ['YYYY?M?D H?m?s?S', 'YYYY', '?', 'M', '?', 'D', ' ', 'H', '?', 'm', '?', 's', '?', 'S'];
- expect(date.compile('YYYY?M?D H?m?s?S')).to.eql(obj);
- });
- it('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', function () {
- var obj = ['[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', '[Y]', 'YYYY', '[M]', 'M', '[D]', 'D', '[H]', 'H', '[m]', 'm', '[s]', 's', '[S]', 'S'];
- expect(date.compile('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S')).to.eql(obj);
- });
- it('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', function () {
- var obj = ['[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]'];
- expect(date.compile('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]')).to.eql(obj);
- });
- it(' ', function () {
- var obj = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '];
- expect(date.compile(' ')).to.eql(obj);
- });
- });
-
- describe('preparse', function () {
- it('YYYY', function () {
- var dt = { Y: 0, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('0000', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('0001', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 99, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('0099', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 100, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('0100', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 1899, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('1899', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 1900, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('1900', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 1969, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('1969', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('1970', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 1999, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('1999', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 2000, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('2000', 'YYYY')).to.eql(dt);
- });
- it('YYYY', function () {
- var dt = { Y: 9999, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 4, _match: 1 };
- expect(date.preparse('9999', 'YYYY')).to.eql(dt);
- });
- it('Y', function () {
- var dt = { Y: 0, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.preparse('0', 'Y')).to.eql(dt);
- });
- it('Y', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.preparse('1', 'Y')).to.eql(dt);
- });
- it('Y', function () {
- var dt = { Y: 99, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 2, _length: 2, _match: 1 };
- expect(date.preparse('99', 'Y')).to.eql(dt);
- });
- it('Y', function () {
- var dt = { Y: 100, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 3, _length: 3, _match: 1 };
- expect(date.preparse('100', 'Y')).to.eql(dt);
- });
- it('YYYY MMMM', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 12, _length: 12, _match: 2 };
- expect(date.preparse('2015 January', 'YYYY MMMM')).to.eql(dt);
- });
- it('YYYY MMMM', function () {
- var dt = { Y: 2015, M: 12, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 13, _length: 13, _match: 2 };
- expect(date.preparse('2015 December', 'YYYY MMMM')).to.eql(dt);
- });
- it('YYYY MMMM', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 5, _length: 9, _match: 1 };
- expect(date.preparse('2015 Zero', 'YYYY MMMM')).to.eql(dt);
- });
- it('YYYY MMM', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 8, _length: 8, _match: 2 };
- expect(date.preparse('2015 Jan', 'YYYY MMM')).to.eql(dt);
- });
- it('YYYY MMM', function () {
- var dt = { Y: 2015, M: 12, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 8, _length: 8, _match: 2 };
- expect(date.preparse('2015 Dec', 'YYYY MMM')).to.eql(dt);
- });
- it('YYYY MMM', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 5, _length: 9, _match: 1 };
- expect(date.preparse('2015 Zero', 'YYYY MMM')).to.eql(dt);
- });
- it('YYYY-MM', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 7, _length: 7, _match: 2 };
- expect(date.preparse('2015-01', 'YYYY-MM')).to.eql(dt);
- });
- it('YYYY-MM', function () {
- var dt = { Y: 2015, M: 12, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 7, _length: 7, _match: 2 };
- expect(date.preparse('2015-12', 'YYYY-MM')).to.eql(dt);
- });
- it('YYYY-MM', function () {
- var dt = { Y: 2015, M: 0, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 7, _length: 7, _match: 2 };
- expect(date.preparse('2015-00', 'YYYY-MM')).to.eql(dt);
- });
- it('YYYY-M', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 6, _length: 6, _match: 2 };
- expect(date.preparse('2015-1', 'YYYY-M')).to.eql(dt);
- });
- it('YYYY-M', function () {
- var dt = { Y: 2015, M: 12, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 7, _length: 7, _match: 2 };
- expect(date.preparse('2015-12', 'YYYY-M')).to.eql(dt);
- });
- it('YYYY-M', function () {
- var dt = { Y: 2015, M: 0, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 6, _length: 6, _match: 2 };
- expect(date.preparse('2015-0', 'YYYY-M')).to.eql(dt);
- });
- it('YYYY-MM-DD', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 10, _length: 10, _match: 3 };
- expect(date.preparse('2015-01-01', 'YYYY-MM-DD')).to.eql(dt);
- });
- it('YYYY-MM-DD', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 10, _length: 10, _match: 3 };
- expect(date.preparse('2015-12-31', 'YYYY-MM-DD')).to.eql(dt);
- });
- it('YYYY-MM-DD', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 10, _length: 10, _match: 3 };
- expect(date.preparse('2015-00-00', 'YYYY-MM-DD')).to.eql(dt);
- });
- it('YYYY-M-D', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 8, _length: 8, _match: 3 };
- expect(date.preparse('2015-1-1', 'YYYY-M-D')).to.eql(dt);
- });
- it('YYYY-M-D', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 10, _length: 10, _match: 3 };
- expect(date.preparse('2015-12-31', 'YYYY-M-D')).to.eql(dt);
- });
- it('YYYY-M-D', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 8, _length: 8, _match: 3 };
- expect(date.preparse('2015-0-0', 'YYYY-M-D')).to.eql(dt);
- });
- it('YYYY-MM-DD HH', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 13, _length: 13, _match: 4 };
- expect(date.preparse('2015-01-01 00', 'YYYY-MM-DD HH')).to.eql(dt);
- });
- it('YYYY-MM-DD HH', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 13, _length: 13, _match: 4 };
- expect(date.preparse('2015-12-31 23', 'YYYY-MM-DD HH')).to.eql(dt);
- });
- it('YYYY-MM-DD HH', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 13, _length: 13, _match: 4 };
- expect(date.preparse('2015-00-00 24', 'YYYY-MM-DD HH')).to.eql(dt);
- });
- it('YYYY-M-D H', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 10, _length: 10, _match: 4 };
- expect(date.preparse('2015-1-1 0', 'YYYY-M-D H')).to.eql(dt);
- });
- it('YYYY-M-D H', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 13, _length: 13, _match: 4 };
- expect(date.preparse('2015-12-31 23', 'YYYY-M-D H')).to.eql(dt);
- });
- it('YYYY-M-D H', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 11, _length: 11, _match: 4 };
- expect(date.preparse('2015-0-0 24', 'YYYY-M-D H')).to.eql(dt);
- });
- it('YYYY-M-D hh A', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 12, m: 0, s: 0, S: 0, Z: 0, _index: 14, _length: 14, _match: 5 };
- expect(date.preparse('2015-1-1 12 AM', 'YYYY-M-D hh A')).to.eql(dt);
- });
- it('YYYY-M-D hh A', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 1, h: 11, m: 0, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 5 };
- expect(date.preparse('2015-12-31 11 PM', 'YYYY-M-D hh A')).to.eql(dt);
- });
- it('YYYY-M-D hh A', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 0, A: 0, h: 12, m: 0, s: 0, S: 0, Z: 0, _index: 14, _length: 14, _match: 5 };
- expect(date.preparse('2015-0-0 12 AM', 'YYYY-M-D hh A')).to.eql(dt);
- });
- it('YYYY-M-D h A', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 12, m: 0, s: 0, S: 0, Z: 0, _index: 14, _length: 14, _match: 5 };
- expect(date.preparse('2015-1-1 12 AM', 'YYYY-M-D h A')).to.eql(dt);
- });
- it('YYYY-M-D h A', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 1, h: 11, m: 0, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 5 };
- expect(date.preparse('2015-12-31 11 PM', 'YYYY-M-D h A')).to.eql(dt);
- });
- it('YYYY-M-D h A', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 0, A: 0, h: 12, m: 0, s: 0, S: 0, Z: 0, _index: 14, _length: 14, _match: 5 };
- expect(date.preparse('2015-0-0 12 AM', 'YYYY-M-D h A')).to.eql(dt);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 5 };
- expect(date.preparse('2015-01-01 00:00', 'YYYY-MM-DD HH:mm')).to.eql(dt);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 5 };
- expect(date.preparse('2015-12-31 23:59', 'YYYY-MM-DD HH:mm')).to.eql(dt);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 60, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 5 };
- expect(date.preparse('2015-00-00 24:60', 'YYYY-MM-DD HH:mm')).to.eql(dt);
- });
- it('YYYY-M-D H:m', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 12, _length: 12, _match: 5 };
- expect(date.preparse('2015-1-1 0:0', 'YYYY-M-D H:m')).to.eql(dt);
- });
- it('YYYY-M-D H:m', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 5 };
- expect(date.preparse('2015-12-31 23:59', 'YYYY-M-D H:m')).to.eql(dt);
- });
- it('YYYY-M-D H:m', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 60, s: 0, S: 0, Z: 0, _index: 14, _length: 14, _match: 5 };
- expect(date.preparse('2015-0-0 24:60', 'YYYY-M-D H:m')).to.eql(dt);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 19, _length: 19, _match: 6 };
- expect(date.preparse('2015-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss')).to.eql(dt);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 0, Z: 0, _index: 19, _length: 19, _match: 6 };
- expect(date.preparse('2015-12-31 23:59:59', 'YYYY-MM-DD HH:mm:ss')).to.eql(dt);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 60, s: 60, S: 0, Z: 0, _index: 19, _length: 19, _match: 6 };
- expect(date.preparse('2015-00-00 24:60:60', 'YYYY-MM-DD HH:mm:ss')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 14, _length: 14, _match: 6 };
- expect(date.preparse('2015-1-1 0:0:0', 'YYYY-M-D H:m:s')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 0, Z: 0, _index: 19, _length: 19, _match: 6 };
- expect(date.preparse('2015-12-31 23:59:59', 'YYYY-M-D H:m:s')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 60, s: 60, S: 0, Z: 0, _index: 17, _length: 17, _match: 6 };
- expect(date.preparse('2015-0-0 24:60:60', 'YYYY-M-D H:m:s')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 7 };
- expect(date.preparse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SSS')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 999, Z: 0, _index: 23, _length: 23, _match: 7 };
- expect(date.preparse('2015-12-31 23:59:59.999', 'YYYY-M-D H:m:s.SSS')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 60, s: 61, S: 0, Z: 0, _index: 21, _length: 21, _match: 7 };
- expect(date.preparse('2015-0-0 24:60:61.000', 'YYYY-M-D H:m:s.SSS')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 7 };
- expect(date.preparse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SS')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 990, Z: 0, _index: 22, _length: 22, _match: 7 };
- expect(date.preparse('2015-12-31 23:59:59.99', 'YYYY-M-D H:m:s.SS')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 60, s: 61, S: 0, Z: 0, _index: 20, _length: 20, _match: 7 };
- expect(date.preparse('2015-0-0 24:60:61.00', 'YYYY-M-D H:m:s.SS')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 16, _length: 16, _match: 7 };
- expect(date.preparse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.S')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 900, Z: 0, _index: 21, _length: 21, _match: 7 };
- expect(date.preparse('2015-12-31 23:59:59.9', 'YYYY-M-D H:m:s.S')).to.eql(dt);
- });
- it('YYYY M D H m s S', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 900, Z: 0, _index: 21, _length: 21, _match: 7 };
- expect(date.preparse('2015-12-31 23:59:59.9', 'YYYY M D H m s S')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 60, s: 61, S: 0, Z: 0, _index: 19, _length: 19, _match: 7 };
- expect(date.preparse('2015-0-0 24:60:61.0', 'YYYY-M-D H:m:s.S')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 22, _length: 22, _match: 8 };
- expect(date.preparse('2015-1-1 0:0:0.0 +0000', 'YYYY-M-D H:m:s.SSS Z')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 999, Z: 840, _index: 29, _length: 29, _match: 8 };
- expect(date.preparse('2015-12-31 23:59:59.999 -1400', 'YYYY-M-D H:m:s.SSS Z')).to.eql(dt);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var dt = { Y: 2015, M: 0, D: 0, H: 24, A: 0, h: 0, m: 60, s: 61, S: 0, Z: -720, _index: 27, _length: 27, _match: 8 };
- expect(date.preparse('2015-0-0 24:60:61.000 +1200', 'YYYY-M-D H:m:s.SSS Z')).to.eql(dt);
- });
- it('MMDDHHmmssSSS', function () {
- var dt = { Y: 1970, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 999, Z: 0, _index: 13, _length: 13, _match: 6 };
- expect(date.preparse('1231235959999', 'MMDDHHmmssSSS')).to.eql(dt);
- });
- it('DDHHmmssSSS', function () {
- var dt = { Y: 1970, M: 1, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 999, Z: 0, _index: 11, _length: 11, _match: 5 };
- expect(date.preparse('31235959999', 'DDHHmmssSSS')).to.eql(dt);
- });
- it('HHmmssSSS', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 23, A: 0, h: 0, m: 59, s: 59, S: 999, Z: 0, _index: 9, _length: 9, _match: 4 };
- expect(date.preparse('235959999', 'HHmmssSSS')).to.eql(dt);
- });
- it('mmssSSS', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 59, s: 59, S: 999, Z: 0, _index: 7, _length: 7, _match: 3 };
- expect(date.preparse('5959999', 'mmssSSS')).to.eql(dt);
- });
- it('ssSSS', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 59, S: 999, Z: 0, _index: 5, _length: 5, _match: 2 };
- expect(date.preparse('59999', 'ssSSS')).to.eql(dt);
- });
- it('SSS', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 999, Z: 0, _index: 3, _length: 3, _match: 1 };
- expect(date.preparse('999', 'SSS')).to.eql(dt);
- });
- it('Z', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: -355, _index: 5, _length: 5, _match: 1 };
- expect(date.preparse('+0555', 'Z')).to.eql(dt);
- });
- it('Z', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 5, _match: 0 };
- expect(date.preparse('+9999', 'Z')).to.eql(dt);
- });
- it('ZZ', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: -355, _index: 6, _length: 6, _match: 1 };
- expect(date.preparse('+05:55', 'ZZ')).to.eql(dt);
- });
- it('ZZ', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 6, _match: 0 };
- expect(date.preparse('+99:99', 'Z')).to.eql(dt);
- });
- it('foo', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 14, _match: 0 };
- expect(date.preparse('20150101235959', 'foo')).to.eql(dt);
- });
- it('bar', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 14, _match: 0 };
- expect(date.preparse('20150101235959', 'bar')).to.eql(dt);
- });
- it('YYYYMMDD', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 8, _length: 14, _match: 3 };
- expect(date.preparse('20150101235959', 'YYYYMMDD')).to.eql(dt);
- });
- it('20150101235959', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 14, _length: 14, _match: 0 };
- expect(date.preparse('20150101235959', '20150101235959')).to.eql(dt);
- });
- it('YYYY?M?D H?m?s?S', function () {
- var dt = { Y: 2015, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 4, _length: 21, _match: 1 };
- expect(date.preparse('2015-12-31 23:59:59.9', 'YYYY?M?D H?m?s?S')).to.eql(dt);
- });
- it('YYYY-MM-DD HH:mm:ssZ', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 0, Z: 0, _index: 19, _length: 20, _match: 6 };
- expect(date.preparse('2015-12-31 23:59:59K', 'YYYY-MM-DD HH:mm:ss[Z]')).to.eql(dt);
- });
- it('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 23, A: 0, h: 0, m: 59, s: 59, S: 900, Z: 0, _index: 22, _length: 22, _match: 7 };
- expect(date.preparse('Y2015M12D31H23m59s59S9', '[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S')).to.eql(dt);
- });
- it('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', function () {
- var dt = { Y: 2015, M: 12, D: 31, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 22, _length: 22, _match: 3 };
- expect(date.preparse('Y2015M12D31H23m59s59S9', '[Y]YYYY[M]M[D]D...')).to.eql(dt);
- });
- it('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 36, _length: 36, _match: 0 };
- expect(date.preparse('[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]')).to.eql(dt);
- });
- it('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 36, _match: 0 };
- expect(date.preparse('[Y]2015[M]12[D]31[H]23[m]59[s]59[S]9', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]')).to.eql(dt);
- });
- it(' ', function () {
- var dt = { Y: 1970, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 17, _length: 17, _match: 0 };
- expect(date.preparse('20151231235959900', ' ')).to.eql(dt);
- });
- });
-
- describe('parse', function () {
- it('YYYY', function () {
- expect(isNaN(date.parse('0000', 'YYYY'))).to.be(true);
- });
- it('YYYY', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.parse('0001', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.parse('0099', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(100, 0, 1);
- expect(date.parse('0100', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1899, 0, 1);
- expect(date.parse('1899', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1900, 0, 1);
- expect(date.parse('1900', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1969, 0, 1);
- expect(date.parse('1969', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1970, 0, 1);
- expect(date.parse('1970', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(1999, 0, 1);
- expect(date.parse('1999', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(2000, 0, 1);
- expect(date.parse('2000', 'YYYY')).to.eql(now);
- });
- it('YYYY', function () {
- var now = new Date(9999, 0, 1);
- expect(date.parse('9999', 'YYYY')).to.eql(now);
- });
- it('Y', function () {
- expect(isNaN(date.parse('0', 'Y'))).to.be(true);
- });
- it('Y', function () {
- var now = new Date(0, -1899 * 12, 1);
- expect(date.parse('1', 'Y')).to.eql(now);
- });
- it('Y', function () {
- var now = new Date(0, -1801 * 12, 1);
- expect(date.parse('99', 'Y')).to.eql(now);
- });
- it('Y', function () {
- var now = new Date(100, 0, 1);
- expect(date.parse('100', 'Y')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015 January', 'YYYY MMMM')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015 December', 'YYYY MMMM')).to.eql(now);
- });
- it('YYYY MMMM', function () {
- expect(isNaN(date.parse('2015 Zero', 'YYYY MMMM'))).to.be(true);
- });
- it('YYYY MMM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015 Jan', 'YYYY MMM')).to.eql(now);
- });
- it('YYYY MMM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015 Dec', 'YYYY MMM')).to.eql(now);
- });
- it('YYYY MMM', function () {
- expect(isNaN(date.parse('2015 Zero', 'YYYY MMM'))).to.be(true);
- });
- it('YYYY-MM', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-01', 'YYYY-MM')).to.eql(now);
- });
- it('YYYY-MM', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015-12', 'YYYY-MM')).to.eql(now);
- });
- it('YYYY-MM', function () {
- expect(isNaN(date.parse('2015-00', 'YYYY-MM'))).to.be(true);
- });
- it('YYYY-M', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-1', 'YYYY-M')).to.eql(now);
- });
- it('YYYY-M', function () {
- var now = new Date(2015, 11, 1);
- expect(date.parse('2015-12', 'YYYY-M')).to.eql(now);
- });
- it('YYYY-M', function () {
- expect(isNaN(date.parse('2015-0', 'YYYY-M'))).to.be(true);
- });
- it('YYYY-MM-DD', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-01-01', 'YYYY-MM-DD')).to.eql(now);
- });
- it('YYYY-MM-DD', function () {
- var now = new Date(2015, 11, 31);
- expect(date.parse('2015-12-31', 'YYYY-MM-DD')).to.eql(now);
- });
- it('YYYY-MM-DD', function () {
- expect(isNaN(date.parse('2015-00-00', 'YYYY-MM-DD'))).to.be(true);
- });
- it('YYYY-M-D', function () {
- var now = new Date(2015, 0, 1);
- expect(date.parse('2015-1-1', 'YYYY-M-D')).to.eql(now);
- });
- it('YYYY-M-D', function () {
- var now = new Date(2015, 11, 31);
- expect(date.parse('2015-12-31', 'YYYY-M-D')).to.eql(now);
- });
- it('YYYY-M-D', function () {
- expect(isNaN(date.parse('2015-0-0', 'YYYY-M-D'))).to.be(true);
- });
- it('YYYY-MM-DD HH', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-01-01 00', 'YYYY-MM-DD HH')).to.eql(now);
- });
- it('YYYY-MM-DD HH', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 23', 'YYYY-MM-DD HH')).to.eql(now);
- });
- it('YYYY-MM-DD HH', function () {
- expect(isNaN(date.parse('2015-00-00 24', 'YYYY-MM-DD HH'))).to.be(true);
- });
- it('YYYY-M-D H', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 0', 'YYYY-M-D H')).to.eql(now);
- });
- it('YYYY-M-D H', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 23', 'YYYY-M-D H')).to.eql(now);
- });
- it('YYYY-M-D H', function () {
- expect(isNaN(date.parse('2015-0-0 24', 'YYYY-M-D H'))).to.be(true);
- });
- it('YYYY-M-D hh A', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 12 AM', 'YYYY-M-D hh A')).to.eql(now);
- });
- it('YYYY-M-D hh A', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 11 PM', 'YYYY-M-D hh A')).to.eql(now);
- });
- it('YYYY-M-D hh A', function () {
- expect(isNaN(date.parse('2015-0-0 12 AM', 'YYYY-M-D hh A'))).to.be(true);
- });
- it('YYYY-M-D h A', function () {
- var now = new Date(2015, 0, 1, 0);
- expect(date.parse('2015-1-1 12 AM', 'YYYY-M-D h A')).to.eql(now);
- });
- it('YYYY-M-D h A', function () {
- var now = new Date(2015, 11, 31, 23);
- expect(date.parse('2015-12-31 11 PM', 'YYYY-M-D h A')).to.eql(now);
- });
- it('YYYY-M-D h A', function () {
- expect(isNaN(date.parse('2015-0-0 12 AM', 'YYYY-M-D h A'))).to.be(true);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-01-01 00:00', 'YYYY-MM-DD HH:mm')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm', function () {
- var now = new Date(2015, 11, 31, 23, 59);
- expect(date.parse('2015-12-31 23:59', 'YYYY-MM-DD HH:mm')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm', function () {
- expect(isNaN(date.parse('2015-00-00 24:60', 'YYYY-MM-DD HH:mm'))).to.be(true);
- });
- it('YYYY-M-D H:m', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-1-1 0:0', 'YYYY-M-D H:m')).to.eql(now);
- });
- it('YYYY-M-D H:m', function () {
- var now = new Date(2015, 11, 31, 23, 59);
- expect(date.parse('2015-12-31 23:59', 'YYYY-M-D H:m')).to.eql(now);
- });
- it('YYYY-M-D H:m', function () {
- expect(isNaN(date.parse('2015-0-0 24:60', 'YYYY-M-D H:m'))).to.be(true);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59);
- expect(date.parse('2015-12-31 23:59:59', 'YYYY-MM-DD HH:mm:ss')).to.eql(now);
- });
- it('YYYY-MM-DD HH:mm:ss', function () {
- expect(isNaN(date.parse('2015-00-00 24:60:60', 'YYYY-MM-DD HH:mm:ss'))).to.be(true);
- });
- it('YYYY-M-D H:m:s', function () {
- var now = new Date(2015, 0, 1, 0, 0);
- expect(date.parse('2015-1-1 0:0:0', 'YYYY-M-D H:m:s')).to.eql(now);
- });
- it('YYYY-M-D H:m:s', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59);
- expect(date.parse('2015-12-31 23:59:59', 'YYYY-M-D H:m:s')).to.eql(now);
- });
- it('YYYY-M-D H:m:s', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:60', 'YYYY-M-D H:m:s'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SSS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 999);
- expect(date.parse('2015-12-31 23:59:59.999', 'YYYY-M-D H:m:s.SSS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.000', 'YYYY-M-D H:m:s.SSS'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 990);
- expect(date.parse('2015-12-31 23:59:59.99', 'YYYY-M-D H:m:s.SS')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SS', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.00', 'YYYY-M-D H:m:s.SS'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var now = new Date(2015, 0, 1, 0, 0, 0);
- expect(date.parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.S')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('2015-12-31 23:59:59.9', 'YYYY-M-D H:m:s.S')).to.eql(now);
- });
- it('YYYY M D H m s S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('2015-12-31 23:59:59.9', 'YYYY M D H m s S')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.S', function () {
- expect(isNaN(date.parse('2015-0-0 24:60:61.0', 'YYYY-M-D H:m:s.S'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
- expect(date.parse('2015-1-1 0:0:0.0 +0000', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
- expect(date.parse('2015-12-31 23:00:59.999 -0059', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
- expect(date.parse('2015-12-31 09:59:59.999 -1200', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- expect(isNaN(date.parse('2015-12-31 09:58:59.999 -1201', 'YYYY-M-D H:m:s.SSS Z'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- var now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
- expect(date.parse('2015-12-31 12:00:59.999 +1400', 'YYYY-M-D H:m:s.SSS Z')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS Z', function () {
- expect(isNaN(date.parse('2015-12-31 12:01:59.999 +1401', 'YYYY-M-D H:m:s.SSS Z'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
- expect(date.parse('2015-1-1 0:0:0.0 +00:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
- expect(date.parse('2015-12-31 23:00:59.999 -00:59', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
- expect(date.parse('2015-12-31 09:59:59.999 -12:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- expect(isNaN(date.parse('2015-12-31 09:58:59.999 -12:01', 'YYYY-M-D H:m:s.SSS ZZ'))).to.be(true);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- var now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
- expect(date.parse('2015-12-31 12:00:59.999 +14:00', 'YYYY-M-D H:m:s.SSS ZZ')).to.eql(now);
- });
- it('YYYY-M-D H:m:s.SSS ZZ', function () {
- expect(isNaN(date.parse('2015-12-31 12:01:59.999 +14:01', 'YYYY-M-D H:m:s.SSS ZZ'))).to.be(true);
- });
- it('MMDDHHmmssSSS', function () {
- var now = new Date(1970, 11, 31, 23, 59, 59, 999);
- expect(date.parse('1231235959999', 'MMDDHHmmssSSS')).to.eql(now);
- });
- it('DDHHmmssSSS', function () {
- var now = new Date(1970, 0, 31, 23, 59, 59, 999);
- expect(date.parse('31235959999', 'DDHHmmssSSS')).to.eql(now);
- });
- it('HHmmssSSS', function () {
- var now = new Date(1970, 0, 1, 23, 59, 59, 999);
- expect(date.parse('235959999', 'HHmmssSSS')).to.eql(now);
- });
- it('mmssSSS', function () {
- var now = new Date(1970, 0, 1, 0, 59, 59, 999);
- expect(date.parse('5959999', 'mmssSSS')).to.eql(now);
- });
- it('ssSSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 59, 999);
- expect(date.parse('59999', 'ssSSS')).to.eql(now);
- });
- it('SSS', function () {
- var now = new Date(1970, 0, 1, 0, 0, 0, 999);
- expect(date.parse('999', 'SSS')).to.eql(now);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+000', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+00', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('+0', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('0', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('0000', 'Z'))).to.be(true);
- });
- it('Z', function () {
- expect(isNaN(date.parse('00000', 'Z'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+00:0', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+00:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('+0:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('0:', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('00:00', 'ZZ'))).to.be(true);
- });
- it('ZZ', function () {
- expect(isNaN(date.parse('00:000', 'ZZ'))).to.be(true);
- });
- it('foo', function () {
- expect(isNaN(date.parse('20150101235959', 'foo'))).to.be(true);
- });
- it('bar', function () {
- expect(isNaN(date.parse('20150101235959', 'bar'))).to.be(true);
- });
- it('YYYYMMDD', function () {
- expect(isNaN(date.parse('20150101235959', 'YYYYMMDD'))).to.be(true);
- });
- it('20150101235959', function () {
- expect(isNaN(date.parse('20150101235959', '20150101235959'))).to.be(true);
- });
- it('YYYY?M?D H?m?s?S', function () {
- expect(isNaN(date.parse('2015-12-31 23:59:59.9', 'YYYY?M?D H?m?s?S'))).to.be(true);
- });
- it('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', function () {
- var now = new Date(2015, 11, 31, 23, 59, 59, 900);
- expect(date.parse('Y2015M12D31H23m59s59S9', '[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S')).to.eql(now);
- });
- it('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', function () {
- expect(isNaN(date.parse('[Y]2015[M]12[D]31[H]23[m]59[s]59[S]9', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]'))).to.be(true);
- });
- it(' ', function () {
- expect(isNaN(date.parse('20151231235959900', ' '))).to.be(true);
- });
- });
-
- describe('transform', function () {
- it('D/M/YYYY => M/D/YYYY', function () {
- expect(date.transform('3/8/2020', 'D/M/YYYY', 'M/D/YYYY')).to.eql('8/3/2020');
- });
- it('HH:mm => hh:mm A', function () {
- expect(date.transform('13:05', 'HH:mm', 'hh:mm A')).to.eql('01:05 PM');
- });
- it('HH:mm => hh:mm A, output as UTC', function () {
- var utc = date.format(new Date(2020, 3, 1, 13, 5), 'hh:mm A', true);
- expect(date.transform('13:05', 'HH:mm', 'hh:mm A', true)).to.eql(utc);
- });
- it('D/M/YYYY => M/D/YYYY, with compile', function () {
- var arg1 = date.compile('D/M/YYYY');
- var arg2 = date.compile('M/D/YYYY');
- expect(date.transform('3/8/2020', arg1, arg2)).to.eql('8/3/2020');
- });
- });
-
- describe('addition', function () {
- it('add a year', function () {
- var date1 = new Date(1969, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(1970, 11, 31, 23, 59, 59, 999);
- expect(date.addYears(date1, 1, true)).to.eql(date2);
- });
- it('add a year at the end of the month', function () {
- var date1 = new Date(Date.UTC(2020, 1, 29));
- var date2 = new Date(Date.UTC(2021, 1, 28));
- expect(date.addYears(date1, 1, true)).to.eql(date2);
- });
- it('subtract a year', function () {
- var date1 = new Date(1970, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(1969, 11, 31, 23, 59, 59, 999);
- expect(date.addYears(date1, -1, true)).to.eql(date2);
- });
- it('subtract a year at the end of the month', function () {
- var date1 = new Date(Date.UTC(2024, 1, 29));
- var date2 = new Date(Date.UTC(2023, 1, 28));
- expect(date.addYears(date1, -1, true)).to.eql(date2);
- });
- it('add a month', function () {
- var date1 = new Date(2014, 10, 30, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 30, 23, 59, 59, 999);
- expect(date.addMonths(date1, 1, true)).to.eql(date2);
- });
- it('add a month at the end of the month', function () {
- var date1 = new Date(Date.UTC(2023, 0, 31));
- var date2 = new Date(Date.UTC(2023, 1, 28));
- expect(date.addMonths(date1, 1, true)).to.eql(date2);
- });
- it('subtract a month', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 10, 30, 23, 59, 59, 999);
- expect(date.addMonths(date1, -1, true)).to.eql(date2);
- });
- it('subtract a month at the end of the month', function () {
- var date1 = new Date(Date.UTC(2023, 2, 31));
- var date2 = new Date(Date.UTC(2023, 1, 28));
- expect(date.addMonths(date1, -1, true)).to.eql(date2);
- });
- it('add a day', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 32, 23, 59, 59, 999);
- expect(date.addDays(date1, 1, true)).to.eql(date2);
- });
- it('subtract a day', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 30, 23, 59, 59, 999);
- expect(date.addDays(date1, -1, true)).to.eql(date2);
- });
- it('add an hour', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 24, 59, 59, 999);
- expect(date.addHours(date1, 1)).to.eql(date2);
- });
- it('subtract an hour', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 22, 59, 59, 999);
- expect(date.addHours(date1, -1)).to.eql(date2);
- });
- it('add a minute', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 60, 59, 999);
- expect(date.addMinutes(date1, 1)).to.eql(date2);
- });
- it('subtract a minute', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 58, 59, 999);
- expect(date.addMinutes(date1, -1)).to.eql(date2);
- });
- it('add a second', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 60, 999);
- expect(date.addSeconds(date1, 1)).to.eql(date2);
- });
- it('subtract a second', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 58, 999);
- expect(date.addSeconds(date1, -1)).to.eql(date2);
- });
- it('add a millisecond', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 1000);
- expect(date.addMilliseconds(date1, 1)).to.eql(date2);
- });
- it('subtract a millisecond', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 998);
- expect(date.addMilliseconds(date1, -1)).to.eql(date2);
- });
- });
-
- describe('subtraction', function () {
- it('A year is 365 days', function () {
- var date1 = new Date(2015, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date1, date2).toDays()).to.equal(365);
- expect(date.subtract(date1, date2).toHours()).to.equal(365 * 24);
- expect(date.subtract(date1, date2).toMinutes()).to.equal(365 * 24 * 60);
- expect(date.subtract(date1, date2).toSeconds()).to.equal(365 * 24 * 60 * 60);
- expect(date.subtract(date1, date2).toMilliseconds()).to.equal(365 * 24 * 60 * 60 * 1000);
- });
- it('A year is 365 days (reverse)', function () {
- var date1 = new Date(2015, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date2, date1).toDays()).to.equal(-365);
- expect(date.subtract(date2, date1).toHours()).to.equal(-365 * 24);
- expect(date.subtract(date2, date1).toMinutes()).to.equal(-365 * 24 * 60);
- expect(date.subtract(date2, date1).toSeconds()).to.equal(-365 * 24 * 60 * 60);
- expect(date.subtract(date2, date1).toMilliseconds()).to.equal(-365 * 24 * 60 * 60 * 1000);
- });
- it('A month is 31 days', function () {
- var date1 = new Date(2014, 12, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date1, date2).toDays()).to.equal(31);
- expect(date.subtract(date1, date2).toHours()).to.equal(31 * 24);
- expect(date.subtract(date1, date2).toMinutes()).to.equal(31 * 24 * 60);
- expect(date.subtract(date1, date2).toSeconds()).to.equal(31 * 24 * 60 * 60);
- expect(date.subtract(date1, date2).toMilliseconds()).to.equal(31 * 24 * 60 * 60 * 1000);
- });
- it('A month is 31 days (reverse)', function () {
- var date1 = new Date(2014, 12, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date2, date1).toDays()).to.equal(-31);
- expect(date.subtract(date2, date1).toHours()).to.equal(-31 * 24);
- expect(date.subtract(date2, date1).toMinutes()).to.equal(-31 * 24 * 60);
- expect(date.subtract(date2, date1).toSeconds()).to.equal(-31 * 24 * 60 * 60);
- expect(date.subtract(date2, date1).toMilliseconds()).to.equal(-31 * 24 * 60 * 60 * 1000);
- });
- it('A day', function () {
- var date1 = new Date(2014, 11, 32, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date1, date2).toDays()).to.equal(1);
- expect(date.subtract(date1, date2).toHours()).to.equal(24);
- expect(date.subtract(date1, date2).toMinutes()).to.equal(24 * 60);
- expect(date.subtract(date1, date2).toSeconds()).to.equal(24 * 60 * 60);
- expect(date.subtract(date1, date2).toMilliseconds()).to.equal(24 * 60 * 60 * 1000);
- });
- it('A day (reverse)', function () {
- var date1 = new Date(2014, 11, 32, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date2, date1).toDays()).to.equal(-1);
- expect(date.subtract(date2, date1).toHours()).to.equal(-1 * 24);
- expect(date.subtract(date2, date1).toMinutes()).to.equal(-1 * 24 * 60);
- expect(date.subtract(date2, date1).toSeconds()).to.equal(-1 * 24 * 60 * 60);
- expect(date.subtract(date2, date1).toMilliseconds()).to.equal(-1 * 24 * 60 * 60 * 1000);
- });
- it('An hour', function () {
- var date1 = new Date(2014, 11, 31, 24, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date1, date2).toDays()).to.equal(1 / 24);
- expect(date.subtract(date1, date2).toHours()).to.equal(1);
- expect(date.subtract(date1, date2).toMinutes()).to.equal(60);
- expect(date.subtract(date1, date2).toSeconds()).to.equal(60 * 60);
- expect(date.subtract(date1, date2).toMilliseconds()).to.equal(60 * 60 * 1000);
- });
- it('An hour (reverse)', function () {
- var date1 = new Date(2014, 11, 31, 24, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date2, date1).toDays()).to.equal(-1 / 24);
- expect(date.subtract(date2, date1).toHours()).to.equal(-1);
- expect(date.subtract(date2, date1).toMinutes()).to.equal(-1 * 60);
- expect(date.subtract(date2, date1).toSeconds()).to.equal(-1 * 60 * 60);
- expect(date.subtract(date2, date1).toMilliseconds()).to.equal(-1 * 60 * 60 * 1000);
- });
- it('A minute', function () {
- var date1 = new Date(2014, 11, 31, 23, 60, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date1, date2).toDays()).to.equal(1 / (24 * 60));
- expect(date.subtract(date1, date2).toHours()).to.equal(1 / 60);
- expect(date.subtract(date1, date2).toMinutes()).to.equal(1);
- expect(date.subtract(date1, date2).toSeconds()).to.equal(60);
- expect(date.subtract(date1, date2).toMilliseconds()).to.equal(60 * 1000);
- });
- it('A minute (reverse)', function () {
- var date1 = new Date(2014, 11, 31, 23, 60, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date2, date1).toDays()).to.equal(-1 / (24 * 60));
- expect(date.subtract(date2, date1).toHours()).to.equal(-1 / 60);
- expect(date.subtract(date2, date1).toMinutes()).to.equal(-1);
- expect(date.subtract(date2, date1).toSeconds()).to.equal(-1 * 60);
- expect(date.subtract(date2, date1).toMilliseconds()).to.equal(-1 * 60 * 1000);
- });
- it('A second', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 60, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date1, date2).toDays()).to.equal(1 / (24 * 60 * 60));
- expect(date.subtract(date1, date2).toHours()).to.equal(1 / (60 * 60));
- expect(date.subtract(date1, date2).toMinutes()).to.equal(1 / 60);
- expect(date.subtract(date1, date2).toSeconds()).to.equal(1);
- expect(date.subtract(date1, date2).toMilliseconds()).to.equal(1000);
- });
- it('A second (reverse)', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 60, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
- expect(date.subtract(date2, date1).toDays()).to.equal(-1 / (24 * 60 * 60));
- expect(date.subtract(date2, date1).toHours()).to.equal(-1 / (60 * 60));
- expect(date.subtract(date2, date1).toMinutes()).to.equal(-1 / 60);
- expect(date.subtract(date2, date1).toSeconds()).to.equal(-1);
- expect(date.subtract(date2, date1).toMilliseconds()).to.equal(-1 * 1000);
- });
- it('A millisecond', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 998);
- expect(date.subtract(date1, date2).toDays()).to.equal(1 / (24 * 60 * 60 * 1000));
- expect(date.subtract(date1, date2).toHours()).to.equal(1 / (60 * 60 * 1000));
- expect(date.subtract(date1, date2).toMinutes()).to.equal(1 / (60 * 1000));
- expect(date.subtract(date1, date2).toSeconds()).to.equal(1 / 1000);
- expect(date.subtract(date1, date2).toMilliseconds()).to.equal(1);
- });
- it('A millisecond (reverse)', function () {
- var date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
- var date2 = new Date(2014, 11, 31, 23, 59, 59, 998);
- expect(date.subtract(date2, date1).toDays()).to.equal(-1 / (24 * 60 * 60 * 1000));
- expect(date.subtract(date2, date1).toHours()).to.equal(-1 / (60 * 60 * 1000));
- expect(date.subtract(date2, date1).toMinutes()).to.equal(-1 / (60 * 1000));
- expect(date.subtract(date2, date1).toSeconds()).to.equal(-1 / 1000);
- expect(date.subtract(date2, date1).toMilliseconds()).to.equal(-1);
- });
- });
-
- describe('validation', function () {
- it('2014-12-31 12:34:56.789 is valid', function () {
- expect(date.isValid('20141231123456789', 'YYYYMMDDHHmmssSSS')).to.be(true);
- });
- it('2012-2-29 is valid', function () {
- expect(date.isValid('2012-2-29', 'YYYY-M-D')).to.be(true);
- });
- it('2100-2-29 is invalid', function () {
- expect(date.isValid('2100-2-29', 'YYYY-M-D')).to.be(false);
- });
- it('2000-2-29 is valid', function () {
- expect(date.isValid('2000-2-29', 'YYYY-M-D')).to.be(true);
- });
- it('2014-2-29 is invalid', function () {
- expect(date.isValid('2014-2-29', 'YYYY-M-D')).to.be(false);
- });
- it('2014-2-28 is valid', function () {
- expect(date.isValid('2014-2-28', 'YYYY-M-D')).to.be(true);
- });
- it('2014-4-31 is invalid', function () {
- expect(date.isValid('2014-4-31', 'YYYY-M-D')).to.be(false);
- });
- it('24:00 is invalid', function () {
- expect(date.isValid('2014-4-30 24:00', 'YYYY-M-D H:m')).to.be(false);
- });
- it('13:00 PM is invalid', function () {
- expect(date.isValid('2014-4-30 13:00 PM', 'YYYY-M-D h:m A')).to.be(false);
- });
- it('23:60 is invalid', function () {
- expect(date.isValid('2014-4-30 23:60', 'YYYY-M-D H:m')).to.be(false);
- });
- it('23:59:60 is invalid', function () {
- expect(date.isValid('2014-4-30 23:59:60', 'YYYY-M-D H:m:s')).to.be(false);
- });
- it('All zero is invalid', function () {
- expect(date.isValid('00000000000000000', 'YYYYMMDDHHmmssSSS')).to.be(false);
- });
- it('All nine is invalid', function () {
- expect(date.isValid('99999999999999999', 'YYYYMMDDHHmmssSSS')).to.be(false);
- });
- it('foo is invalid', function () {
- expect(date.isValid('20150101235959', 'foo')).to.be(false);
- });
- it('bar is invalid', function () {
- expect(date.isValid('20150101235959', 'bar')).to.be(false);
- });
- it('YYYYMMDD is invalid', function () {
- expect(date.isValid('20150101235959', 'YYYYMMDD')).to.be(false);
- });
- it('20150101235959 is invalid', function () {
- expect(date.isValid('20150101235959', '20150101235959')).to.be(false);
- });
- it('Y == 0', function () {
- var dt = { Y: 0, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('Y > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('Y < 0', function () {
- var dt = { Y: -1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('Y > 9999', function () {
- var dt = { Y: 100000, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('M == 0', function () {
- var dt = { Y: 1, M: 0, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('M > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('M < 0', function () {
- var dt = { Y: 1, M: -1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('M > 12', function () {
- var dt = { Y: 1, M: 13, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('M < 13', function () {
- var dt = { Y: 1, M: 12, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('D == 0', function () {
- var dt = { Y: 1, M: 1, D: 0, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('D > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('D < 0', function () {
- var dt = { Y: 1, M: 1, D: -1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('D == 28', function () {
- var dt = { Y: 1, M: 2, D: 28, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('D == 29', function () {
- var dt = { Y: 2000, M: 2, D: 29, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('D == 30', function () {
- var dt = { Y: 2000, M: 2, D: 30, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('D == 31', function () {
- var dt = { Y: 1, M: 4, D: 31, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('D == 31', function () {
- var dt = { Y: 1, M: 3, D: 31, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('D > 31', function () {
- var dt = { Y: 1, M: 1, D: 32, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('H == 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('H > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 1, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('H < 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: -1, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('H > 23', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 24, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('H < 24', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 23, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('m == 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('m > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 1, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('m < 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: -1, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('m > 59', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 60, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('m < 60', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 59, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('s == 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('s > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 1, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('s < 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: -1, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('s > 59', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 60, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('s < 60', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 59, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('S == 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('S > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 1, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('S < 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: -1, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('S > 999', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 1000, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('S < 1000', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 999, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('Z < -840', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: -841, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('Z > -841', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: -840, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('Z > 720', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 721, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('Z < 721', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 720, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('index == 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 0, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('index > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('length < 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: -1, _length: -1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('length == 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 0, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('length > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 0, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('length < 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: -1, _match: 1 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('match == 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 0 };
- expect(date.isValid(dt)).to.be(false);
- });
- it('match > 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: 1 };
- expect(date.isValid(dt)).to.be(true);
- });
- it('match < 0', function () {
- var dt = { Y: 1, M: 1, D: 1, H: 0, A: 0, h: 0, m: 0, s: 0, S: 0, Z: 0, _index: 1, _length: 1, _match: -1 };
- expect(date.isValid(dt)).to.be(false);
- });
- });
-
- describe('leap year', function () {
- it('2012-2-29 It is valid.', function () {
- expect(date.isLeapYear(new Date(2012, 0, 1).getFullYear())).to.be(true);
- });
- it('2100-2-29 It is invalid.', function () {
- expect(date.isLeapYear(new Date(2100, 0, 1).getFullYear())).to.be(false);
- });
- it('2000-2-29 It is valid.', function () {
- expect(date.isLeapYear(new Date(2000, 0, 1).getFullYear())).to.be(true);
- });
- it('2014-2-29 It is invalid.', function () {
- expect(date.isLeapYear(new Date(2014, 0, 1).getFullYear())).to.be(false);
- });
- });
-
- describe('the same day', function () {
- it('the same', function () {
- var date1 = new Date(2016, 0, 1, 2, 34, 56, 789);
- var date2 = new Date(2016, 0, 1, 23, 4, 56, 789);
- expect(date.isSameDay(date1, date2)).to.be(true);
- });
- it('the same', function () {
- var date1 = new Date(1916, 0, 1, 2, 34, 56, 789);
- var date2 = new Date(1916, 0, 1, 23, 4, 56, 789);
- expect(date.isSameDay(date1, date2)).to.be(true);
- });
- it('not the same', function () {
- var date1 = new Date(2016, 0, 1, 23, 59, 59, 999);
- var date2 = new Date(2016, 0, 2, 0, 0, 0, 0);
- expect(date.isSameDay(date1, date2)).to.be(false);
- });
- it('not the same', function () {
- var date1 = new Date(1916, 0, 1, 23, 59, 59, 999);
- var date2 = new Date(1916, 0, 2, 0, 0, 0, 0);
- expect(date.isSameDay(date1, date2)).to.be(false);
- });
- });
-
- describe('customize', function () {
- it('getting current locale', function () {
- expect(date.locale()).to.equal('en');
- });
- it('changing default meridiem', function () {
- date.extend({ res: { A: ['am', 'pm'] } });
- expect(date.format(new Date(2012, 0, 1, 12), 'h A')).to.not.equal('12 pm');
- });
- it('extending default meridiem', function () {
- date.extend({
- res: {
- a: ['am', 'pm']
- },
- formatter: {
- a: function (d) {
- return this.res.a[d.getHours() > 11 | 0];
- }
- }
- });
- expect(date.format(new Date(2012, 0, 1, 12), 'h a')).to.equal('12 pm');
- });
- });
-
-}(this));
diff --git a/test/ts/date-and-time.d.ts b/test/ts/date-and-time.d.ts
deleted file mode 120000
index efb7a50..0000000
--- a/test/ts/date-and-time.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../date-and-time.d.ts
\ No newline at end of file
diff --git a/test/ts/date-and-time.test-d.ts b/test/ts/date-and-time.test-d.ts
deleted file mode 100644
index 0bf0b9f..0000000
--- a/test/ts/date-and-time.test-d.ts
+++ /dev/null
@@ -1,251 +0,0 @@
-import { expectType } from 'tsd';
-
-import date from './date-and-time';
-
-import ar from './locale/ar';
-import az from './locale/az';
-import bn from './locale/bn';
-import cs from './locale/cs';
-import de from './locale/de';
-import dk from './locale/dk';
-import el from './locale/el';
-import en from './locale/en';
-import es from './locale/es';
-import fa from './locale/fa';
-import fr from './locale/fr';
-import hi from './locale/hi';
-import hu from './locale/hu';
-import id from './locale/id';
-import it from './locale/it';
-import ja from './locale/ja';
-import jv from './locale/jv';
-import ko from './locale/ko';
-import my from './locale/my';
-import nl from './locale/nl';
-import pa_in from './locale/pa-in';
-import pl from './locale/pl';
-import pt from './locale/pt';
-import ro from './locale/ro';
-import ru from './locale/ru';
-import rw from './locale/rw';
-import sr from './locale/sr';
-import sv from './locale/sv';
-import th from './locale/th';
-import tr from './locale/tr';
-import uk from './locale/uk';
-import uz from './locale/uz';
-import vi from './locale/vi';
-import zh_cn from './locale/zh-cn';
-import zh_tw from './locale/zh-tw';
-
-import day_of_week from './plugin/day-of-week';
-import meridiem from './plugin/meridiem';
-import microsecond from './plugin/microsecond';
-import ordinal from './plugin/ordinal';
-import timespan from './plugin/timespan';
-import timezone from './plugin/timezone';
-import two_digit_year from './plugin/two-digit-year';
-
-/* Core */
-
-expectType(date.compile('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
-
-const compiledObj: string[] = date.compile('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
-
-expectType(date.format(new Date(), 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
-expectType(date.format(new Date(), 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', true));
-expectType(date.format(new Date(), compiledObj));
-expectType(date.format(new Date(), compiledObj, true));
-
-expectType(date.parse('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
-expectType(date.parse('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', true));
-expectType(date.parse('1970-01-01T12:59:59.999Z', compiledObj));
-expectType(date.parse('1970-01-01T12:59:59.999Z', compiledObj, true));
-
-expectType(date.preparse('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
-expectType(date.preparse('1970-01-01T12:59:59.999Z', compiledObj));
-
-const preparseResult: date.PreparseResult = date.preparse('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]');
-
-expectType(preparseResult.Y);
-expectType(preparseResult.M);
-expectType(preparseResult.D);
-expectType(preparseResult.H);
-expectType(preparseResult.A);
-expectType(preparseResult.h);
-expectType(preparseResult.m);
-expectType(preparseResult.s);
-expectType(preparseResult.S);
-expectType(preparseResult.Z);
-expectType(preparseResult._index);
-expectType(preparseResult._length);
-expectType(preparseResult._match);
-
-expectType(date.isValid('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
-expectType(date.isValid('1970-01-01T12:59:59.999Z', compiledObj));
-expectType(date.isValid(preparseResult));
-
-const compiledObj2: string[] = date.compile('MMM D YYYY H:mm:ss');
-
-expectType(date.transform('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', 'MMM D YYYY H:mm:ss'));
-expectType(date.transform('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', 'MMM D YYYY H:mm:ss', true));
-expectType(date.transform('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', compiledObj2));
-expectType(date.transform('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', compiledObj2, true));
-expectType(date.transform('1970-01-01T12:59:59.999Z', compiledObj, 'MMM D YYYY H:mm:ss'));
-expectType(date.transform('1970-01-01T12:59:59.999Z', compiledObj, 'MMM D YYYY H:mm:ss', true));
-expectType(date.transform('1970-01-01T12:59:59.999Z', compiledObj, compiledObj2));
-expectType(date.transform('1970-01-01T12:59:59.999Z', compiledObj, compiledObj2, true));
-
-expectType(date.addYears(new Date(), 1));
-expectType(date.addYears(new Date(), 1, true));
-
-expectType(date.addMonths(new Date(), 1));
-expectType(date.addMonths(new Date(), 1, true));
-
-expectType(date.addDays(new Date(), 1));
-expectType(date.addDays(new Date(), 1, true));
-
-expectType(date.addHours(new Date(), 1));
-expectType(date.addHours(new Date(), 1, true));
-
-expectType(date.addMinutes(new Date(), 1));
-expectType(date.addMinutes(new Date(), 1, true));
-
-expectType(date.addSeconds(new Date(), 1));
-expectType(date.addSeconds(new Date(), 1, true));
-
-expectType(date.addMilliseconds(new Date(), 1));
-expectType(date.addMilliseconds(new Date(), 1, true));
-
-expectType(date.subtract(new Date(), new Date()));
-
-const subtractResult: date.SubtractResult = date.subtract(new Date(), new Date());
-
-expectType(subtractResult.toDays());
-expectType(subtractResult.toHours());
-expectType(subtractResult.toMinutes());
-expectType(subtractResult.toSeconds());
-expectType(subtractResult.toMilliseconds());
-
-expectType(date.isLeapYear(2000));
-
-expectType(date.isSameDay(new Date(), new Date()));
-
-expectType(date.locale());
-
-expectType(date.locale('locale'));
-
-const extension: date.Extension = {
- res: {
- XXX: [
- ['x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7'],
- ['X1', 'X2', 'X3', 'X4', 'X5', 'X6', 'X7']
- ],
- QQ: ['Q1', 'Q2', 'Q3', 'Q4']
- },
- formatter: {
- foo: (): void => {},
- bar: (): string => { return ''; },
- baz: (arg: number): number => { return arg; }
- },
- parser: {
- foo: (): void => {},
- bar: (): string => { return ''; },
- baz: (arg: number): number => { return arg; }
- },
- extender: {
- foo: (): void => {},
- bar: (): string => { return ''; },
- baz: (arg: number): number => { return arg; }
- }
-};
-
-expectType(date.extend(extension));
-
-expectType(date.plugin('plugin'));
-
-/* Locales */
-
-expectType(date.locale(ar));
-expectType(date.locale(az));
-expectType(date.locale(bn));
-expectType(date.locale(cs));
-expectType(date.locale(de));
-expectType(date.locale(dk));
-expectType(date.locale(el));
-expectType(date.locale(en));
-expectType(date.locale(es));
-expectType(date.locale(fa));
-expectType(date.locale(fr));
-expectType(date.locale(hi));
-expectType(date.locale(hu));
-expectType(date.locale(id));
-expectType(date.locale(it));
-expectType(date.locale(ja));
-expectType(date.locale(jv));
-expectType(date.locale(ko));
-expectType(date.locale(my));
-expectType(date.locale(nl));
-expectType(date.locale(pa_in));
-expectType(date.locale(pl));
-expectType(date.locale(pt));
-expectType(date.locale(ro));
-expectType(date.locale(ru));
-expectType(date.locale(rw));
-expectType(date.locale(sr));
-expectType(date.locale(sv));
-expectType(date.locale(th));
-expectType(date.locale(tr));
-expectType(date.locale(uk));
-expectType(date.locale(uz));
-expectType(date.locale(vi));
-expectType(date.locale(zh_cn));
-expectType(date.locale(zh_tw));
-
-/* Plugins */
-
-expectType(date.plugin(day_of_week));
-expectType(date.plugin(meridiem));
-expectType(date.plugin(microsecond));
-expectType(date.plugin(ordinal));
-expectType(date.plugin(timespan));
-expectType(date.plugin(timezone));
-expectType(date.plugin(two_digit_year));
-
-expectType(date.timeSpan(new Date(), new Date()));
-
-const timeSpanResult: date.TimeSpanResult = date.timeSpan(new Date(), new Date());
-
-expectType(timeSpanResult.toDays('D H m s S'));
-expectType(timeSpanResult.toHours('H m s S'));
-expectType(timeSpanResult.toMinutes('m s S'));
-expectType(timeSpanResult.toSeconds('s S'));
-expectType(timeSpanResult.toMilliseconds('S'));
-
-expectType(date.formatTZ(new Date(), 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', 'America/Los_Angeles'));
-expectType(date.formatTZ(new Date(), 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
-expectType(date.formatTZ(new Date(), compiledObj, 'America/Los_Angeles'));
-expectType(date.formatTZ(new Date(), compiledObj));
-
-expectType(date.parseTZ('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', 'America/Los_Angeles'));
-expectType(date.parseTZ('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
-expectType(date.parseTZ('1970-01-01T12:59:59.999Z', compiledObj, 'America/Los_Angeles'));
-expectType(date.parseTZ('1970-01-01T12:59:59.999Z', compiledObj));
-
-expectType(date.transformTZ('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', 'MMM D YYYY H:mm:ss', 'America/Los_Angeles'));
-expectType(date.transformTZ('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', 'MMM D YYYY H:mm:ss'));
-expectType(date.transformTZ('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', compiledObj2, 'America/Los_Angeles'));
-expectType(date.transformTZ('1970-01-01T12:59:59.999Z', 'YYYY-MM-DDTHH:mm:ss.SSS[Z]', compiledObj2));
-expectType(date.transformTZ('1970-01-01T12:59:59.999Z', compiledObj, 'MMM D YYYY H:mm:ss', 'America/Los_Angeles'));
-expectType(date.transformTZ('1970-01-01T12:59:59.999Z', compiledObj, 'MMM D YYYY H:mm:ss'));
-expectType(date.transformTZ('1970-01-01T12:59:59.999Z', compiledObj, compiledObj2, 'America/Los_Angeles'));
-expectType(date.transformTZ('1970-01-01T12:59:59.999Z', compiledObj, compiledObj2));
-
-expectType(date.addYearsTZ(new Date(), 1));
-expectType(date.addYearsTZ(new Date(), 1, 'America/Los_Angeles'));
-
-expectType(date.addMonthsTZ(new Date(), 1));
-expectType(date.addMonthsTZ(new Date(), 1, 'America/Los_Angeles'));
-
-expectType(date.addDaysTZ(new Date(), 1));
-expectType(date.addDaysTZ(new Date(), 1, 'America/Los_Angeles'));
diff --git a/test/ts/locale/ar.d.ts b/test/ts/locale/ar.d.ts
deleted file mode 120000
index 0076cc6..0000000
--- a/test/ts/locale/ar.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/ar.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/az.d.ts b/test/ts/locale/az.d.ts
deleted file mode 120000
index 4fc43b9..0000000
--- a/test/ts/locale/az.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/az.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/bn.d.ts b/test/ts/locale/bn.d.ts
deleted file mode 120000
index f807419..0000000
--- a/test/ts/locale/bn.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/bn.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/cs.d.ts b/test/ts/locale/cs.d.ts
deleted file mode 120000
index 4b8437d..0000000
--- a/test/ts/locale/cs.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/cs.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/de.d.ts b/test/ts/locale/de.d.ts
deleted file mode 120000
index 8ca9b3c..0000000
--- a/test/ts/locale/de.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/de.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/dk.d.ts b/test/ts/locale/dk.d.ts
deleted file mode 120000
index 9d796f9..0000000
--- a/test/ts/locale/dk.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/dk.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/el.d.ts b/test/ts/locale/el.d.ts
deleted file mode 120000
index 3ea5db8..0000000
--- a/test/ts/locale/el.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/el.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/en.d.ts b/test/ts/locale/en.d.ts
deleted file mode 120000
index 476fe04..0000000
--- a/test/ts/locale/en.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/en.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/es.d.ts b/test/ts/locale/es.d.ts
deleted file mode 120000
index 2022191..0000000
--- a/test/ts/locale/es.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/es.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/fa.d.ts b/test/ts/locale/fa.d.ts
deleted file mode 120000
index 12e9d27..0000000
--- a/test/ts/locale/fa.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/fa.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/fr.d.ts b/test/ts/locale/fr.d.ts
deleted file mode 120000
index 4e4536a..0000000
--- a/test/ts/locale/fr.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/fr.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/hi.d.ts b/test/ts/locale/hi.d.ts
deleted file mode 120000
index d01ae73..0000000
--- a/test/ts/locale/hi.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/hi.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/hu.d.ts b/test/ts/locale/hu.d.ts
deleted file mode 120000
index dbd47c3..0000000
--- a/test/ts/locale/hu.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/hu.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/id.d.ts b/test/ts/locale/id.d.ts
deleted file mode 120000
index 0adb1df..0000000
--- a/test/ts/locale/id.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/id.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/it.d.ts b/test/ts/locale/it.d.ts
deleted file mode 120000
index 4aedb01..0000000
--- a/test/ts/locale/it.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/it.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/ja.d.ts b/test/ts/locale/ja.d.ts
deleted file mode 120000
index 803891c..0000000
--- a/test/ts/locale/ja.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/ja.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/jv.d.ts b/test/ts/locale/jv.d.ts
deleted file mode 120000
index c4ca87a..0000000
--- a/test/ts/locale/jv.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/jv.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/ko.d.ts b/test/ts/locale/ko.d.ts
deleted file mode 120000
index 3c998c0..0000000
--- a/test/ts/locale/ko.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/ko.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/my.d.ts b/test/ts/locale/my.d.ts
deleted file mode 120000
index f1d8b64..0000000
--- a/test/ts/locale/my.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/my.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/nl.d.ts b/test/ts/locale/nl.d.ts
deleted file mode 120000
index 30ce117..0000000
--- a/test/ts/locale/nl.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/nl.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/pa-in.d.ts b/test/ts/locale/pa-in.d.ts
deleted file mode 120000
index 8ab78f9..0000000
--- a/test/ts/locale/pa-in.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/pa-in.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/pl.d.ts b/test/ts/locale/pl.d.ts
deleted file mode 120000
index 2382de9..0000000
--- a/test/ts/locale/pl.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/pl.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/pt.d.ts b/test/ts/locale/pt.d.ts
deleted file mode 120000
index 6dbe6fb..0000000
--- a/test/ts/locale/pt.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/pt.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/ro.d.ts b/test/ts/locale/ro.d.ts
deleted file mode 120000
index 5fe87a5..0000000
--- a/test/ts/locale/ro.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/ro.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/ru.d.ts b/test/ts/locale/ru.d.ts
deleted file mode 120000
index eaab787..0000000
--- a/test/ts/locale/ru.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/ru.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/rw.d.ts b/test/ts/locale/rw.d.ts
deleted file mode 120000
index b9bd7f6..0000000
--- a/test/ts/locale/rw.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/rw.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/sr.d.ts b/test/ts/locale/sr.d.ts
deleted file mode 120000
index 1607e5b..0000000
--- a/test/ts/locale/sr.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/sr.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/sv.d.ts b/test/ts/locale/sv.d.ts
deleted file mode 120000
index fb35395..0000000
--- a/test/ts/locale/sv.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/sv.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/th.d.ts b/test/ts/locale/th.d.ts
deleted file mode 120000
index 89fe2d0..0000000
--- a/test/ts/locale/th.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/th.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/tr.d.ts b/test/ts/locale/tr.d.ts
deleted file mode 120000
index fbb8167..0000000
--- a/test/ts/locale/tr.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/tr.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/uk.d.ts b/test/ts/locale/uk.d.ts
deleted file mode 120000
index b8daec1..0000000
--- a/test/ts/locale/uk.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/uk.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/uz.d.ts b/test/ts/locale/uz.d.ts
deleted file mode 120000
index db4c9ae..0000000
--- a/test/ts/locale/uz.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/uz.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/vi.d.ts b/test/ts/locale/vi.d.ts
deleted file mode 120000
index 0e917f4..0000000
--- a/test/ts/locale/vi.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/vi.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/zh-cn.d.ts b/test/ts/locale/zh-cn.d.ts
deleted file mode 120000
index 1b6d1d9..0000000
--- a/test/ts/locale/zh-cn.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/zh-cn.d.ts
\ No newline at end of file
diff --git a/test/ts/locale/zh-tw.d.ts b/test/ts/locale/zh-tw.d.ts
deleted file mode 120000
index 7191049..0000000
--- a/test/ts/locale/zh-tw.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../locale/zh-tw.d.ts
\ No newline at end of file
diff --git a/test/ts/plugin/day-of-week.d.ts b/test/ts/plugin/day-of-week.d.ts
deleted file mode 120000
index 9890337..0000000
--- a/test/ts/plugin/day-of-week.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../plugin/day-of-week.d.ts
\ No newline at end of file
diff --git a/test/ts/plugin/meridiem.d.ts b/test/ts/plugin/meridiem.d.ts
deleted file mode 120000
index 46dc7ab..0000000
--- a/test/ts/plugin/meridiem.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../plugin/meridiem.d.ts
\ No newline at end of file
diff --git a/test/ts/plugin/microsecond.d.ts b/test/ts/plugin/microsecond.d.ts
deleted file mode 120000
index 7a17c2f..0000000
--- a/test/ts/plugin/microsecond.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../plugin/microsecond.d.ts
\ No newline at end of file
diff --git a/test/ts/plugin/ordinal.d.ts b/test/ts/plugin/ordinal.d.ts
deleted file mode 120000
index 88db3ee..0000000
--- a/test/ts/plugin/ordinal.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../plugin/ordinal.d.ts
\ No newline at end of file
diff --git a/test/ts/plugin/timespan.d.ts b/test/ts/plugin/timespan.d.ts
deleted file mode 120000
index 8f3025c..0000000
--- a/test/ts/plugin/timespan.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../plugin/timespan.d.ts
\ No newline at end of file
diff --git a/test/ts/plugin/timezone.d.ts b/test/ts/plugin/timezone.d.ts
deleted file mode 120000
index f366f40..0000000
--- a/test/ts/plugin/timezone.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../plugin/timezone.d.ts
\ No newline at end of file
diff --git a/test/ts/plugin/two-digit-year.d.ts b/test/ts/plugin/two-digit-year.d.ts
deleted file mode 120000
index aba0122..0000000
--- a/test/ts/plugin/two-digit-year.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-../../../plugin/two-digit-year.d.ts
\ No newline at end of file
diff --git a/tests/addDays.spec.ts b/tests/addDays.spec.ts
new file mode 100644
index 0000000..fa08677
--- /dev/null
+++ b/tests/addDays.spec.ts
@@ -0,0 +1,330 @@
+import { expect, test, describe, beforeAll } from 'vitest';
+import { addDays } from '../src/index.ts';
+import Los_Angeles from '../src/timezones/America/Los_Angeles.ts';
+
+describe('Local Time', () => {
+ beforeAll(() => (process.env.TZ = 'America/Los_Angeles'));
+
+ test('One day after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 1, 10));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('Two days after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 2, 10));
+
+ expect(addDays(date1, 2)).toEqual(date2);
+ });
+
+ test('Three days after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 3, 10));
+
+ expect(addDays(date1, 3)).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 9));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 10));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('One day after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 11));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('One day before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 8));
+
+ expect(addDays(date1, -1)).toEqual(date2);
+ });
+
+ test('One day before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 9));
+
+ expect(addDays(date1, -1)).toEqual(date2);
+ });
+
+ test('One day before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 10));
+
+ expect(addDays(date1, -1)).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 9));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 9));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 10));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 8));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 9));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+
+ test('One day after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 10));
+
+ expect(addDays(date1, 1)).toEqual(date2);
+ });
+});
+
+describe('UTC Time', () => {
+ beforeAll(() => (process.env.TZ = 'Asia/Tokyo'));
+
+ test('One day after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 1, 10));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('Two days after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 2, 10));
+
+ expect(addDays(date1, 2, 'UTC')).toEqual(date2);
+ });
+
+ test('Three days after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 3, 10));
+
+ expect(addDays(date1, 3, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 9));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 10));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 11));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 8));
+
+ expect(addDays(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 9));
+
+ expect(addDays(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 10));
+
+ expect(addDays(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 8));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 9));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 10));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 8));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 9));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One day after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 10));
+
+ expect(addDays(date1, 1, 'UTC')).toEqual(date2);
+ });
+});
+
+describe('America/Los_Angeles', () => {
+ beforeAll(() => (process.env.TZ = 'Australia/Sydney'));
+
+ test('One day after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 1, 10));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('Two days after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 2, 10));
+
+ expect(addDays(date1, 2, Los_Angeles)).toEqual(date2);
+ });
+
+ test('Three days after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 3, 10));
+
+ expect(addDays(date1, 3, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 9));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 10));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2024, 1, 11, 11));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 8));
+
+ expect(addDays(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 9));
+
+ expect(addDays(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 11, 2, 10));
+
+ expect(addDays(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 9));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 9));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 4, 10));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 8));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 9));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One day after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 9, 4, 10));
+
+ expect(addDays(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+});
diff --git a/tests/addHours.spec.ts b/tests/addHours.spec.ts
new file mode 100644
index 0000000..7e12933
--- /dev/null
+++ b/tests/addHours.spec.ts
@@ -0,0 +1,109 @@
+import { expect, test, beforeAll } from 'vitest';
+import { addHours } from '../src/index.ts';
+
+beforeAll(() => (process.env.TZ = 'America/Los_Angeles'));
+
+test('One hour after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 11));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('Two hours after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 12));
+
+ expect(addHours(date1, 2)).toEqual(date2);
+});
+
+test('Three hours after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 13));
+
+ expect(addHours(date1, 3)).toEqual(date2);
+});
+
+test('One hour after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 10));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('One hour after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 11));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('One hour after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 12));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('One hour before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 7));
+
+ expect(addHours(date1, -1)).toEqual(date2);
+});
+
+test('One hour before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 8));
+
+ expect(addHours(date1, -1)).toEqual(date2);
+});
+
+test('One hour before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9));
+
+ expect(addHours(date1, -1)).toEqual(date2);
+});
+
+test('One hour after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 9));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('One hour after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('One hour after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 11));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('One hour after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 9));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('One hour after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 10));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
+
+test('One hour after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 11));
+
+ expect(addHours(date1, 1)).toEqual(date2);
+});
diff --git a/tests/addMilliseconds.spec.ts b/tests/addMilliseconds.spec.ts
new file mode 100644
index 0000000..57015c8
--- /dev/null
+++ b/tests/addMilliseconds.spec.ts
@@ -0,0 +1,109 @@
+import { expect, test, beforeAll } from 'vitest';
+import { addMilliseconds } from '../src/index.ts';
+
+beforeAll(() => (process.env.TZ = 'America/Los_Angeles'));
+
+test('One millisecond after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('Two milliseconds after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0, 2));
+
+ expect(addMilliseconds(date1, 2)).toEqual(date2);
+});
+
+test('Three milliseconds after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0, 3));
+
+ expect(addMilliseconds(date1, 3)).toEqual(date2);
+});
+
+test('One millisecond after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 9, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('One millisecond after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 10, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('One millisecond after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 10, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('One millisecond before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 7, 59, 59, 999));
+
+ expect(addMilliseconds(date1, -1)).toEqual(date2);
+});
+
+test('One millisecond before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 8, 59, 59, 999));
+
+ expect(addMilliseconds(date1, -1)).toEqual(date2);
+});
+
+test('One millisecond before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9, 59, 59, 999));
+
+ expect(addMilliseconds(date1, -1)).toEqual(date2);
+});
+
+test('One millisecond after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('One millisecond after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 9, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('One millisecond after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('One millisecond after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 8, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('One millisecond after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 9, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
+
+test('One millisecond after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10, 0, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 10, 0, 0, 1));
+
+ expect(addMilliseconds(date1, 1)).toEqual(date2);
+});
diff --git a/tests/addMinutes.spec.ts b/tests/addMinutes.spec.ts
new file mode 100644
index 0000000..5a84f8a
--- /dev/null
+++ b/tests/addMinutes.spec.ts
@@ -0,0 +1,109 @@
+import { expect, test, beforeAll } from 'vitest';
+import { addMinutes } from '../src/index.ts';
+
+beforeAll(() => (process.env.TZ = 'America/Los_Angeles'));
+
+test('One minute after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('Two minutes after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 2));
+
+ expect(addMinutes(date1, 2)).toEqual(date2);
+});
+
+test('Three minutes after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 3));
+
+ expect(addMinutes(date1, 3)).toEqual(date2);
+});
+
+test('One minute after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 9, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('One minute after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 10, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('One minute after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 10, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('One minute before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 7, 59));
+
+ expect(addMinutes(date1, -1)).toEqual(date2);
+});
+
+test('One minute before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 8, 59));
+
+ expect(addMinutes(date1, -1)).toEqual(date2);
+});
+
+test('One minute before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9, 59));
+
+ expect(addMinutes(date1, -1)).toEqual(date2);
+});
+
+test('One minute after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('One minute after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 9, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('One minute after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('One minute after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 8, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('One minute after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 9, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
+
+test('One minute after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 10, 1));
+
+ expect(addMinutes(date1, 1)).toEqual(date2);
+});
diff --git a/tests/addMonths.spec.ts b/tests/addMonths.spec.ts
new file mode 100644
index 0000000..a136e05
--- /dev/null
+++ b/tests/addMonths.spec.ts
@@ -0,0 +1,330 @@
+import { expect, test, describe, beforeAll } from 'vitest';
+import { addMonths } from '../src/index.ts';
+import Los_Angeles from '../src/timezones/America/Los_Angeles.ts';
+
+describe('Local Time', () => {
+ beforeAll(() => (process.env.TZ = 'America/Los_Angeles'));
+
+ test('One month after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 29, 10));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('Two months after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 2, 31, 9));
+
+ expect(addMonths(date1, 2)).toEqual(date2);
+ });
+
+ test('Three months after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 3, 30, 9));
+
+ expect(addMonths(date1, 3)).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 9));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 10));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('One month after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 10));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('One month before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 7));
+
+ expect(addMonths(date1, -1)).toEqual(date2);
+ });
+
+ test('One month before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8));
+
+ expect(addMonths(date1, -1)).toEqual(date2);
+ });
+
+ test('One month before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10));
+
+ expect(addMonths(date1, -1)).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 10));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+
+ test('One month after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 11));
+
+ expect(addMonths(date1, 1)).toEqual(date2);
+ });
+});
+
+describe('UTC Time', () => {
+ beforeAll(() => (process.env.TZ = 'Asia/Tokyo'));
+
+ test('One month after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 29, 10));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('Two months after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 2, 31, 10));
+
+ expect(addMonths(date1, 2, 'UTC')).toEqual(date2);
+ });
+
+ test('Three months after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 3, 30, 10));
+
+ expect(addMonths(date1, 3, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 9));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 10));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 11));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8));
+
+ expect(addMonths(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 9));
+
+ expect(addMonths(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10));
+
+ expect(addMonths(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 8));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 10));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 9));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One month after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10));
+
+ expect(addMonths(date1, 1, 'UTC')).toEqual(date2);
+ });
+});
+
+describe('America/Los_Angeles', () => {
+ beforeAll(() => (process.env.TZ = 'Australia/Sydney'));
+
+ test('One month after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 1, 29, 10));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('Two months after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 2, 31, 9));
+
+ expect(addMonths(date1, 2, Los_Angeles)).toEqual(date2);
+ });
+
+ test('Three months after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2024, 3, 30, 9));
+
+ expect(addMonths(date1, 3, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 9));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 10));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2024, 2, 10, 10));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 7));
+
+ expect(addMonths(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8));
+
+ expect(addMonths(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10));
+
+ expect(addMonths(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 10));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One month after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 11));
+
+ expect(addMonths(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+});
diff --git a/tests/addSeconds.spec.ts b/tests/addSeconds.spec.ts
new file mode 100644
index 0000000..fbe39b5
--- /dev/null
+++ b/tests/addSeconds.spec.ts
@@ -0,0 +1,109 @@
+import { expect, test, beforeAll } from 'vitest';
+import { addSeconds } from '../src/index.ts';
+
+beforeAll(() => (process.env.TZ = 'America/Los_Angeles'));
+
+test('One second after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('Two seconds after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 0, 2));
+
+ expect(addSeconds(date1, 2)).toEqual(date2);
+});
+
+test('Three seconds after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 0, 31, 10, 0, 3));
+
+ expect(addSeconds(date1, 3)).toEqual(date2);
+});
+
+test('One second after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 9, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('One second after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 10, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('One second after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 1, 10, 10, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('One second before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 7, 59, 59));
+
+ expect(addSeconds(date1, -1)).toEqual(date2);
+});
+
+test('One second before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 8, 59, 59));
+
+ expect(addSeconds(date1, -1)).toEqual(date2);
+});
+
+test('One second before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 11, 3, 9, 59, 59));
+
+ expect(addSeconds(date1, -1)).toEqual(date2);
+});
+
+test('One second after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 8, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('One second after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 9, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('One second after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 10, 3, 10, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('One second after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 8, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('One second after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 9, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
+
+test('One second after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10, 0, 0));
+ const date2 = new Date(Date.UTC(2024, 9, 3, 10, 0, 1));
+
+ expect(addSeconds(date1, 1)).toEqual(date2);
+});
diff --git a/tests/addYears.spec.ts b/tests/addYears.spec.ts
new file mode 100644
index 0000000..89031cb
--- /dev/null
+++ b/tests/addYears.spec.ts
@@ -0,0 +1,330 @@
+import { expect, test, describe, beforeAll } from 'vitest';
+import { addYears } from '../src/index.ts';
+import Los_Angeles from '../src/timezones/America/Los_Angeles.ts';
+
+describe('Local Time', () => {
+ beforeAll(() => (process.env.TZ = 'America/Los_Angeles'));
+
+ test('One year after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2025, 0, 31, 10));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('Two years after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2026, 0, 31, 10));
+
+ expect(addYears(date1, 2)).toEqual(date2);
+ });
+
+ test('Three years after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2027, 0, 31, 10));
+
+ expect(addYears(date1, 3)).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 9));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 10));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('One year after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 11));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('One year before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 8));
+
+ expect(addYears(date1, -1)).toEqual(date2);
+ });
+
+ test('One year before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 9));
+
+ expect(addYears(date1, -1)).toEqual(date2);
+ });
+
+ test('One year before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 10));
+
+ expect(addYears(date1, -1)).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 9));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 9));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 10));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 8));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 9));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+
+ test('One year after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 10));
+
+ expect(addYears(date1, 1)).toEqual(date2);
+ });
+});
+
+describe('UTC Time', () => {
+ beforeAll(() => (process.env.TZ = 'Asia/Tokyo'));
+
+ test('One year after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2025, 0, 31, 10));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('Two years after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2026, 0, 31, 10));
+
+ expect(addYears(date1, 2, 'UTC')).toEqual(date2);
+ });
+
+ test('Three years after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2027, 0, 31, 10));
+
+ expect(addYears(date1, 3, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 9));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 10));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 11));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 8));
+
+ expect(addYears(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 9));
+
+ expect(addYears(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 10));
+
+ expect(addYears(date1, -1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 8));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 9));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 10));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 8));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 9));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+
+ test('One year after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 10));
+
+ expect(addYears(date1, 1, 'UTC')).toEqual(date2);
+ });
+});
+
+describe('America/Los_Angeles', () => {
+ beforeAll(() => (process.env.TZ = 'Australia/Sydney'));
+
+ test('One year after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2025, 0, 31, 10));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('Two years after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2026, 0, 31, 10));
+
+ expect(addYears(date1, 2, Los_Angeles)).toEqual(date2);
+ });
+
+ test('Three years after 2:00 AM on January 31, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 0, 31, 10));
+ const date2 = new Date(Date.UTC(2027, 0, 31, 10));
+
+ expect(addYears(date1, 3, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 9));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 9));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 10));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 10));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 3:00 AM on February 10, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 1, 10, 11));
+ const date2 = new Date(Date.UTC(2025, 1, 10, 11));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year before 1:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 8));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 8));
+
+ expect(addYears(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year before 2:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 9));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 9));
+
+ expect(addYears(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year before 3:00 AM on December 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 11, 3, 10));
+ const date2 = new Date(Date.UTC(2023, 11, 3, 10));
+
+ expect(addYears(date1, -1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 8));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 9));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM PST on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 9));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 9));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on November 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 10, 3, 10));
+ const date2 = new Date(Date.UTC(2025, 10, 3, 10));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 1:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 8));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 8));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 2:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 9));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 9));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+
+ test('One year after 3:00 AM on October 3, 2024', () => {
+ const date1 = new Date(Date.UTC(2024, 9, 3, 10));
+ const date2 = new Date(Date.UTC(2025, 9, 3, 10));
+
+ expect(addYears(date1, 1, Los_Angeles)).toEqual(date2);
+ });
+});
diff --git a/tests/compile.spec.ts b/tests/compile.spec.ts
new file mode 100644
index 0000000..a0ce2d0
--- /dev/null
+++ b/tests/compile.spec.ts
@@ -0,0 +1,172 @@
+import { expect, test } from 'vitest';
+import { compile } from '../src/index.ts';
+
+test('YYYY', () => {
+ const obj = ['YYYY', 'YYYY'];
+ expect(compile('YYYY')).toEqual(obj);
+});
+
+test('Y', () => {
+ const obj = ['Y', 'Y'];
+ expect(compile('Y')).toEqual(obj);
+});
+
+test('YYYY MMMM', () => {
+ const obj = ['YYYY MMMM', 'YYYY', ' ', 'MMMM'];
+ expect(compile('YYYY MMMM')).toEqual(obj);
+});
+
+test('YYYY MMM', () => {
+ const obj = ['YYYY MMM', 'YYYY', ' ', 'MMM'];
+ expect(compile('YYYY MMM')).toEqual(obj);
+});
+
+test('YYYY-MM', () => {
+ const obj = ['YYYY-MM', 'YYYY', '-', 'MM'];
+ expect(compile('YYYY-MM')).toEqual(obj);
+});
+
+test('YYYY-M', () => {
+ const obj = ['YYYY-M', 'YYYY', '-', 'M'];
+ expect(compile('YYYY-M')).toEqual(obj);
+});
+
+test('YYYY-MM-DD', () => {
+ const obj = ['YYYY-MM-DD', 'YYYY', '-', 'MM', '-', 'DD'];
+ expect(compile('YYYY-MM-DD')).toEqual(obj);
+});
+
+test('YYYY-M-D', () => {
+ const obj = ['YYYY-M-D', 'YYYY', '-', 'M', '-', 'D'];
+ expect(compile('YYYY-M-D')).toEqual(obj);
+});
+
+test('YYYY-MM-DD HH', () => {
+ const obj = ['YYYY-MM-DD HH', 'YYYY', '-', 'MM', '-', 'DD', ' ', 'HH'];
+ expect(compile('YYYY-MM-DD HH')).toEqual(obj);
+});
+
+test('YYYY-M-D H', () => {
+ const obj = ['YYYY-M-D H', 'YYYY', '-', 'M', '-', 'D', ' ', 'H'];
+ expect(compile('YYYY-M-D H')).toEqual(obj);
+});
+
+test('YYYY-M-D hh A', () => {
+ const obj = ['YYYY-M-D hh A', 'YYYY', '-', 'M', '-', 'D', ' ', 'hh', ' ', 'A'];
+ expect(compile('YYYY-M-D hh A')).toEqual(obj);
+});
+
+test('YYYY-M-D h A', () => {
+ const obj = ['YYYY-M-D h A', 'YYYY', '-', 'M', '-', 'D', ' ', 'h', ' ', 'A'];
+ expect(compile('YYYY-M-D h A')).toEqual(obj);
+});
+
+test('YYYY-MM-DD HH:mm', () => {
+ const obj = ['YYYY-MM-DD HH:mm', 'YYYY', '-', 'MM', '-', 'DD', ' ', 'HH', ':', 'mm'];
+ expect(compile('YYYY-MM-DD HH:mm')).toEqual(obj);
+});
+
+test('YYYY-M-D H:m', () => {
+ const obj = ['YYYY-M-D H:m', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm'];
+ expect(compile('YYYY-M-D H:m')).toEqual(obj);
+});
+
+test('YYYY-MM-DD HH:mm:ss', () => {
+ const obj = ['YYYY-MM-DD HH:mm:ss', 'YYYY', '-', 'MM', '-', 'DD', ' ', 'HH', ':', 'mm', ':', 'ss'];
+ expect(compile('YYYY-MM-DD HH:mm:ss')).toEqual(obj);
+});
+
+test('YYYY-M-D H:m:s', () => {
+ const obj = ['YYYY-M-D H:m:s', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm', ':', 's'];
+ expect(compile('YYYY-M-D H:m:s')).toEqual(obj);
+});
+
+test('YYYY-M-D H:m:s.SSS', () => {
+ const obj = ['YYYY-M-D H:m:s.SSS', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm', ':', 's', '.', 'SSS'];
+ expect(compile('YYYY-M-D H:m:s.SSS')).toEqual(obj);
+});
+
+test('YYYY-M-D H:m:s.SS', () => {
+ const obj = ['YYYY-M-D H:m:s.SS', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm', ':', 's', '.', 'SS'];
+ expect(compile('YYYY-M-D H:m:s.SS')).toEqual(obj);
+});
+
+test('YYYY-M-D H:m:s.S', () => {
+ const obj = ['YYYY-M-D H:m:s.S', 'YYYY', '-', 'M', '-', 'D', ' ', 'H', ':', 'm', ':', 's', '.', 'S'];
+ expect(compile('YYYY-M-D H:m:s.S')).toEqual(obj);
+});
+
+test('MMDDHHmmssSSS', () => {
+ const obj = ['MMDDHHmmssSSS', 'MM', 'DD', 'HH', 'mm', 'ss', 'SSS'];
+ expect(compile('MMDDHHmmssSSS')).toEqual(obj);
+});
+
+test('DDHHmmssSSS', () => {
+ const obj = ['DDHHmmssSSS', 'DD', 'HH', 'mm', 'ss', 'SSS'];
+ expect(compile('DDHHmmssSSS')).toEqual(obj);
+});
+
+test('HHmmssSSS', () => {
+ const obj = ['HHmmssSSS', 'HH', 'mm', 'ss', 'SSS'];
+ expect(compile('HHmmssSSS')).toEqual(obj);
+});
+
+test('mmssSSS', () => {
+ const obj = ['mmssSSS', 'mm', 'ss', 'SSS'];
+ expect(compile('mmssSSS')).toEqual(obj);
+});
+
+test('ssSSS', () => {
+ const obj = ['ssSSS', 'ss', 'SSS'];
+ expect(compile('ssSSS')).toEqual(obj);
+});
+
+test('SSS', () => {
+ const obj = ['SSS', 'SSS'];
+ expect(compile('SSS')).toEqual(obj);
+});
+
+test('foo', () => {
+ const obj = ['foo', 'f', 'oo'];
+ expect(compile('foo')).toEqual(obj);
+});
+
+test('bar', () => {
+ const obj = ['bar', 'b', 'a', 'r'];
+ expect(compile('bar')).toEqual(obj);
+});
+
+test('YYYYMMDD', () => {
+ const obj = ['YYYYMMDD', 'YYYY', 'MM', 'DD'];
+ expect(compile('YYYYMMDD')).toEqual(obj);
+});
+
+test('20150101235959', () => {
+ const obj = ['20150101235959', '2', '0', '1', '5', '0', '1', '0', '1', '2', '3', '5', '9', '5', '9'];
+ expect(compile('20150101235959')).toEqual(obj);
+});
+
+test('YYYY?M?D H?m?s?S', () => {
+ const obj = ['YYYY?M?D H?m?s?S', 'YYYY', '?', 'M', '?', 'D', ' ', 'H', '?', 'm', '?', 's', '?', 'S'];
+ expect(compile('YYYY?M?D H?m?s?S')).toEqual(obj);
+});
+
+test('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', () => {
+ const obj = ['[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', '[Y]', 'YYYY', '[M]', 'M', '[D]', 'D', '[H]', 'H', '[m]', 'm', '[s]', 's', '[S]', 'S'];
+ expect(compile('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S')).toEqual(obj);
+});
+
+test('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', () => {
+ const obj = ['[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]'];
+ expect(compile('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]')).toEqual(obj);
+});
+
+test(' ', () => {
+ const obj = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '];
+ expect(compile(' ')).toEqual(obj);
+});
+
+test('[empty]', () => {
+ const obj = [''] as string[];
+ expect(compile('')).toEqual(obj);
+});
diff --git a/tests/duration.spec.ts b/tests/duration.spec.ts
new file mode 100644
index 0000000..8301687
--- /dev/null
+++ b/tests/duration.spec.ts
@@ -0,0 +1,134 @@
+import { describe, expect, test } from 'vitest';
+import { Duration } from '../src/index.ts';
+
+describe('Duration', () => {
+ test('toDays', () => {
+ const duration = 365 * 24 * 60 * 60 * 1000 + 0.123456;
+ expect(new Duration(duration).toDays().value).toBe(365 + 0.123456 / 24 / 60 / 60 / 1000);
+ expect(new Duration(duration).toDays().toParts()).toEqual({ nanoseconds: 456, microseconds: 123, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: 365 });
+ });
+
+ test('toHours', () => {
+ const duration = 365 * 24 * 60 * 60 * 1000 + 0.123456;
+ expect(new Duration(duration).toHours().value).toBe(365 * 24 + 0.123456 / 60 / 60 / 1000);
+ expect(new Duration(duration).toHours().toParts()).toEqual({ nanoseconds: 456, microseconds: 123, milliseconds: 0, seconds: 0, minutes: 0, hours: 365 * 24 });
+ });
+
+ test('toMinutes', () => {
+ const duration = 365 * 24 * 60 * 60 * 1000 + 0.123456;
+ expect(new Duration(duration).toMinutes().value).toBe(365 * 24 * 60 + 0.123456 / 60 / 1000);
+ expect(new Duration(duration).toMinutes().toParts()).toEqual({ nanoseconds: 456, microseconds: 123, milliseconds: 0, seconds: 0, minutes: 365 * 24 * 60 });
+ });
+
+ test('toSeconds', () => {
+ const duration = 365 * 24 * 60 * 60 * 1000 + 0.123456;
+ expect(new Duration(duration).toSeconds().value).toBe(365 * 24 * 60 * 60 + 0.123456 / 1000);
+ expect(new Duration(duration).toSeconds().toParts()).toEqual({ nanoseconds: 456, microseconds: 123, milliseconds: 0, seconds: 365 * 24 * 60 * 60 });
+ });
+
+ test('toMilliseconds', () => {
+ const duration = 365 * 24 * 60 * 60 * 1000 + 0.123456;
+ expect(new Duration(duration).toMilliseconds().value).toBe(365 * 24 * 60 * 60 * 1000 + 0.123456);
+ expect(new Duration(duration).toMilliseconds().toParts()).toEqual({ nanoseconds: 456, microseconds: 123, milliseconds: 365 * 24 * 60 * 60 * 1000 });
+ });
+
+ test('toMicroseconds', () => {
+ const duration = 365 * 24 * 60 * 60 * 1000 + 0.123456;
+ expect(new Duration(duration).toMicroseconds().value).toBe((365 * 24 * 60 * 60 * 1000 + 0.123456) * 1000);
+ expect(new Duration(duration).toMicroseconds().toParts()).toEqual({ nanoseconds: 456, microseconds: 365 * 24 * 60 * 60 * 1000 * 1000 + 123 });
+ });
+
+ test('toNanoseconds', () => {
+ const duration = 365 * 24 * 60 * 60 * 1000 + 0.123456;
+ expect(new Duration(duration).toNanoseconds().value).toBe((365 * 24 * 60 * 60 * 1000 + 0.123456) * 1000000);
+ expect(new Duration(duration).toNanoseconds().toParts()).toEqual({ nanoseconds: 365 * 24 * 60 * 60 * 1000 * 1000 * 1000 + 123 * 1000 + 456 });
+ });
+});
+
+describe('Duration (minus)', () => {
+ test('toDays', () => {
+ const duration = -1 * (365 * 24 * 60 * 60 * 1000 + 0.123456);
+ expect(new Duration(duration).toDays().value).toBe(-1 * (365 + 0.123456 / 24 / 60 / 60 / 1000));
+ expect(new Duration(duration).toDays().toParts()).toEqual({ nanoseconds: -456, microseconds: -123, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: -365 });
+ });
+
+ test('toHours', () => {
+ const duration = -1 * (365 * 24 * 60 * 60 * 1000 + 0.123456);
+ expect(new Duration(duration).toHours().value).toBe(-1 * (365 * 24 + 0.123456 / 60 / 60 / 1000));
+ expect(new Duration(duration).toHours().toParts()).toEqual({ nanoseconds: -456, microseconds: -123, milliseconds: 0, seconds: 0, minutes: 0, hours: -365 * 24 });
+ });
+
+ test('toMinutes', () => {
+ const duration = -1 * (365 * 24 * 60 * 60 * 1000 + 0.123456);
+ expect(new Duration(duration).toMinutes().value).toBe(-1 * (365 * 24 * 60 + 0.123456 / 60 / 1000));
+ expect(new Duration(duration).toMinutes().toParts()).toEqual({ nanoseconds: -456, microseconds: -123, milliseconds: 0, seconds: 0, minutes: -365 * 24 * 60 });
+ });
+
+ test('toSeconds', () => {
+ const duration = -1 * (365 * 24 * 60 * 60 * 1000 + 0.123456);
+ expect(new Duration(duration).toSeconds().value).toBe(-1 * (365 * 24 * 60 * 60 + 0.123456 / 1000));
+ expect(new Duration(duration).toSeconds().toParts()).toEqual({ nanoseconds: -456, microseconds: -123, milliseconds: 0, seconds: -365 * 24 * 60 * 60 });
+ });
+
+ test('toMilliseconds', () => {
+ const duration = -1 * (365 * 24 * 60 * 60 * 1000 + 0.123456);
+ expect(new Duration(duration).toMilliseconds().value).toBe(-1 * (365 * 24 * 60 * 60 * 1000 + 0.123456));
+ expect(new Duration(duration).toMilliseconds().toParts()).toEqual({ nanoseconds: -456, microseconds: -123, milliseconds: -365 * 24 * 60 * 60 * 1000 });
+ });
+
+ test('toMicroseconds', () => {
+ const duration = -1 * (365 * 24 * 60 * 60 * 1000 + 0.123456);
+ expect(new Duration(duration).toMicroseconds().value).toBe((-1 * (365 * 24 * 60 * 60 * 1000 + 0.123456) * 1000));
+ expect(new Duration(duration).toMicroseconds().toParts()).toEqual({ nanoseconds: -456, microseconds: -365 * 24 * 60 * 60 * 1000 * 1000 - 123 });
+ });
+
+ test('toNanoseconds', () => {
+ const duration = -1 * (365 * 24 * 60 * 60 * 1000 + 0.123456);
+ expect(new Duration(duration).toNanoseconds().value).toBe((-1 * (365 * 24 * 60 * 60 * 1000 + 0.123456) * 1000000));
+ expect(new Duration(duration).toNanoseconds().toParts()).toEqual({ nanoseconds: -365 * 24 * 60 * 60 * 1000 * 1000 * 1000 - 123 * 1000 - 456 });
+ });
+});
+
+describe('Duration (Negative Zero)', () => {
+ test('toDays', () => {
+ const duration = -0;
+ expect(new Duration(duration).toDays().format('DDD HH mm ss SSS fff FFF')).toBe('-000 00 00 00 000 000 000');
+ expect(new Duration(duration).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: 0 });
+ });
+
+ test('toHours', () => {
+ const duration = -0;
+ expect(new Duration(duration).toHours().format('DDD HH mm ss SSS fff FFF')).toBe('DDD -00 00 00 000 000 000');
+ expect(new Duration(duration).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 0 });
+ });
+
+ test('toMinutes', () => {
+ const duration = -0;
+ expect(new Duration(duration).toMinutes().format('DDD HH mm ss SSS fff FFF')).toBe('DDD HH -00 00 000 000 000');
+ expect(new Duration(duration).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0 });
+ });
+
+ test('toSeconds', () => {
+ const duration = -0;
+ expect(new Duration(duration).toSeconds().format('DDD HH mm ss SSS fff FFF')).toBe('DDD HH mm -00 000 000 000');
+ expect(new Duration(duration).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0 });
+ });
+
+ test('toMilliseconds', () => {
+ const duration = -0;
+ expect(new Duration(duration).toMilliseconds().format('DDD HH mm ss SSS fff FFF')).toBe('DDD HH mm ss -000 000 000');
+ expect(new Duration(duration).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0 });
+ });
+
+ test('toMicroseconds', () => {
+ const duration = -0;
+ expect(new Duration(duration).toMicroseconds().format('DDD HH mm ss SSS fff FFF')).toBe('DDD HH mm ss SSS -000 000');
+ expect(new Duration(duration).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0 });
+ });
+
+ test('toNanoseconds', () => {
+ const duration = -0;
+ expect(new Duration(duration).toNanoseconds().format('DDD HH mm ss SSS fff FFF')).toBe('DDD HH mm ss SSS fff -000');
+ expect(new Duration(duration).toNanoseconds().toParts()).toEqual({ nanoseconds: 0 });
+ });
+});
diff --git a/tests/format.spec.ts b/tests/format.spec.ts
new file mode 100644
index 0000000..17ec1a4
--- /dev/null
+++ b/tests/format.spec.ts
@@ -0,0 +1,790 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { format, compile } from '../src/index.ts';
+import Los_Angeles from '../src/timezones/America/Los_Angeles.ts';
+import Tokyo from '../src/timezones/Asia/Tokyo.ts';
+
+describe('YYYY', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('0001', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'YYYY')).toBe('0001');
+ });
+
+ test('9999', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'YYYY')).toBe('9999');
+ });
+});
+
+describe('YY', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('01', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'YY')).toBe('01');
+ });
+
+ test('99', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'YY')).toBe('99');
+ });
+});
+
+describe('Y', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('1', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'Y')).toBe('1');
+ });
+
+ test('9999', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'Y')).toBe('9999');
+ });
+});
+
+describe('MMMM', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('January', () => {
+ const now = new Date(0, 1 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('January');
+ });
+
+ test('February', () => {
+ const now = new Date(0, 2 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('February');
+ });
+
+ test('March', () => {
+ const now = new Date(0, 3 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('March');
+ });
+
+ test('April', () => {
+ const now = new Date(0, 4 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('April');
+ });
+
+ test('May', () => {
+ const now = new Date(0, 5 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('May');
+ });
+
+ test('June', () => {
+ const now = new Date(0, 6 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('June');
+ });
+
+ test('July', () => {
+ const now = new Date(0, 7 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('July');
+ });
+
+ test('August', () => {
+ const now = new Date(0, 8 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('August');
+ });
+
+ test('September', () => {
+ const now = new Date(0, 9 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('September');
+ });
+
+ test('October', () => {
+ const now = new Date(0, 10 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('October');
+ });
+
+ test('November', () => {
+ const now = new Date(0, 11 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('November');
+ });
+
+ test('December', () => {
+ const now = new Date(0, 12 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMMM')).toBe('December');
+ });
+});
+
+describe('MMM', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('Jan', () => {
+ const now = new Date(0, 1 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Jan');
+ });
+
+ test('Feb', () => {
+ const now = new Date(0, 2 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Feb');
+ });
+
+ test('Mar', () => {
+ const now = new Date(0, 3 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Mar');
+ });
+
+ test('Apr', () => {
+ const now = new Date(0, 4 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Apr');
+ });
+
+ test('May', () => {
+ const now = new Date(0, 5 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('May');
+ });
+
+ test('Jun', () => {
+ const now = new Date(0, 6 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Jun');
+ });
+
+ test('Jul', () => {
+ const now = new Date(0, 7 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Jul');
+ });
+
+ test('Aug', () => {
+ const now = new Date(0, 8 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Aug');
+ });
+
+ test('Sep', () => {
+ const now = new Date(0, 9 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Sep');
+ });
+
+ test('Oct', () => {
+ const now = new Date(0, 10 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Oct');
+ });
+
+ test('Nov', () => {
+ const now = new Date(0, 11 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Nov');
+ });
+
+ test('Dec', () => {
+ const now = new Date(0, 12 - 1, 1, 0, 0, 0, 0);
+ expect(format(now, 'MMM')).toBe('Dec');
+ });
+});
+
+describe('MM', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('01', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'MM')).toBe('01');
+ });
+
+ test('12', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'MM')).toBe('12');
+ });
+});
+
+describe('M', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('1', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'M')).toBe('1');
+ });
+
+ test('12', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'M')).toBe('12');
+ });
+});
+
+describe('DD', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('01', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'DD')).toBe('01');
+ });
+
+ test('31', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'DD')).toBe('31');
+ });
+});
+
+describe('D', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('1', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'D')).toBe('1');
+ });
+
+ test('31', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'D')).toBe('31');
+ });
+});
+
+describe('dddd', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('Sunday', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 0, 0, 0, 0, 0);
+ expect(format(now, 'dddd')).toBe('Sunday');
+ });
+
+ test('Monday', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'dddd')).toBe('Monday');
+ });
+
+ test('Tuesday', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 2, 0, 0, 0, 0);
+ expect(format(now, 'dddd')).toBe('Tuesday');
+ });
+
+ test('Wednesday', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 3, 0, 0, 0, 0);
+ expect(format(now, 'dddd')).toBe('Wednesday');
+ });
+
+ test('Thursday', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 4, 0, 0, 0, 0);
+ expect(format(now, 'dddd')).toBe('Thursday');
+ });
+
+ test('Friday', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 5, 0, 0, 0, 0);
+ expect(format(now, 'dddd')).toBe('Friday');
+ });
+
+ test('Saturday', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 6, 0, 0, 0, 0);
+ expect(format(now, 'dddd')).toBe('Saturday');
+ });
+});
+
+describe('ddd', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('Sun', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 0, 0, 0, 0, 0);
+ expect(format(now, 'ddd')).toBe('Sun');
+ });
+
+ test('Mon', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'ddd')).toBe('Mon');
+ });
+
+ test('Tue', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 2, 0, 0, 0, 0);
+ expect(format(now, 'ddd')).toBe('Tue');
+ });
+
+ test('Wed', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 3, 0, 0, 0, 0);
+ expect(format(now, 'ddd')).toBe('Wed');
+ });
+
+ test('Thu', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 4, 0, 0, 0, 0);
+ expect(format(now, 'ddd')).toBe('Thu');
+ });
+
+ test('Fri', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 5, 0, 0, 0, 0);
+ expect(format(now, 'ddd')).toBe('Fri');
+ });
+
+ test('Sat', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 6, 0, 0, 0, 0);
+ expect(format(now, 'ddd')).toBe('Sat');
+ });
+});
+
+describe('dd', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('Su', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 0, 0, 0, 0, 0);
+ expect(format(now, 'dd')).toBe('Su');
+ });
+
+ test('Mo', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'dd')).toBe('Mo');
+ });
+
+ test('Tu', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 2, 0, 0, 0, 0);
+ expect(format(now, 'dd')).toBe('Tu');
+ });
+
+ test('We', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 3, 0, 0, 0, 0);
+ expect(format(now, 'dd')).toBe('We');
+ });
+
+ test('Th', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 4, 0, 0, 0, 0);
+ expect(format(now, 'dd')).toBe('Th');
+ });
+
+ test('Fr', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 5, 0, 0, 0, 0);
+ expect(format(now, 'dd')).toBe('Fr');
+ });
+
+ test('Sa', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 6, 0, 0, 0, 0);
+ expect(format(now, 'dd')).toBe('Sa');
+ });
+});
+
+describe('HH', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('00', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'HH', { hour24: 'h23' })).toBe('00');
+ });
+
+ test('23', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 23, 0, 0, 0);
+ expect(format(now, 'HH', { hour24: 'h23' })).toBe('23');
+ });
+
+ test('24', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'HH', { hour24: 'h24' })).toBe('24');
+ });
+});
+
+describe('H', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('0', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'H', { hour24: 'h23' })).toBe('0');
+ });
+
+ test('23', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 23, 0, 0, 0);
+ expect(format(now, 'H', { hour24: 'h23' })).toBe('23');
+ });
+
+ test('24', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'H', { hour24: 'h24' })).toBe('24');
+ });
+});
+
+describe('hh', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('00', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'hh', { hour12: 'h11' })).toBe('00');
+ });
+
+ test('11', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'hh', { hour12: 'h12' })).toBe('11');
+ });
+
+ test('12', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'hh', { hour12: 'h12' })).toBe('12');
+ });
+});
+
+describe('h', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('0', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'h', { hour12: 'h11' })).toBe('0');
+ });
+
+ test('11', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'h', { hour12: 'h12' })).toBe('11');
+ });
+
+ test('12', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'h', { hour12: 'h12' })).toBe('12');
+ });
+});
+
+describe('AA', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('A.M.', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'AA')).toBe('A.M.');
+ });
+
+ test('P.M.', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'AA')).toBe('P.M.');
+ });
+});
+
+describe('A', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('AM', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'A')).toBe('AM');
+ });
+
+ test('PM', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'A')).toBe('PM');
+ });
+});
+
+describe('aa', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('a.m.', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'aa')).toBe('a.m.');
+ });
+
+ test('p.m.', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'aa')).toBe('p.m.');
+ });
+});
+
+describe('a', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('am', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'a')).toBe('am');
+ });
+
+ test('pm', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'a')).toBe('pm');
+ });
+});
+
+describe('mm', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('00', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'mm')).toBe('00');
+ });
+
+ test('59', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'mm')).toBe('59');
+ });
+});
+
+describe('m', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('0', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'm')).toBe('0');
+ });
+
+ test('59', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'm')).toBe('59');
+ });
+});
+
+describe('ss', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('00', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'ss')).toBe('00');
+ });
+
+ test('59', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'ss')).toBe('59');
+ });
+});
+
+describe('s', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('0', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 's')).toBe('0');
+ });
+
+ test('59', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 's')).toBe('59');
+ });
+});
+
+describe('SSS', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('000', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'SSS')).toBe('000');
+ });
+
+ test('456', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 456);
+ expect(format(now, 'SSS')).toBe('456');
+ });
+
+ test('999', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'SSS')).toBe('999');
+ });
+});
+
+describe('SS', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('00', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'SS')).toBe('00');
+ });
+
+ test('45', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 456);
+ expect(format(now, 'SS')).toBe('45');
+ });
+
+ test('99', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'SS')).toBe('99');
+ });
+});
+
+describe('S', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('0', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 0);
+ expect(format(now, 'S')).toBe('0');
+ });
+
+ test('4', () => {
+ const now = new Date(0, 0 - (1900 - 1) * 12, 1, 0, 0, 0, 456);
+ expect(format(now, 'S')).toBe('4');
+ });
+
+ test('9', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'S')).toBe('9');
+ });
+});
+
+describe('ZZ', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('-08:00', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'ZZ', { timeZone: Los_Angeles })).toBe('-08:00');
+ });
+
+ test('+00:00', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'ZZ', { timeZone: 'UTC' })).toBe('+00:00');
+ });
+
+ test('+09:00', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'ZZ', { timeZone: Tokyo })).toBe('+09:00');
+ });
+});
+
+describe('Z', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('-0800', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'Z', { timeZone: Los_Angeles })).toBe('-0800');
+ });
+
+ test('+0000', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'Z', { timeZone: 'UTC' })).toBe('+0000');
+ });
+
+ test('+0900', () => {
+ const now = new Date(9999, 12 - 1, 31, 23, 59, 59, 999);
+ expect(format(now, 'Z', { timeZone: Tokyo })).toBe('+0900');
+ });
+});
+
+describe('comments', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('dddd, MMMM D, YYYY h A', () => {
+ const now = new Date(2000, 1 - 1, 1, 0, 0, 0);
+ expect(format(now, '[dddd, MMMM D, YYYY h A]')).toBe('dddd, MMMM D, YYYY h A');
+ });
+
+ test('dddd, January D, 2000 h AM', () => {
+ const now = new Date(2000, 1 - 1, 1, 0, 0, 0);
+ expect(format(now, '[dddd], MMMM [D], YYYY [h] A')).toBe('dddd, January D, 2000 h AM');
+ });
+
+ test('[dddd], MMMM [D], YYYY [h] A', () => {
+ const now = new Date(2000, 1 - 1, 1, 0, 0, 0);
+ expect(format(now, '[[dddd], MMMM [D], YYYY [h] A]')).toBe('[dddd], MMMM [D], YYYY [h] A');
+ });
+
+ test('dddd, January [D], YYYY 12 A', () => {
+ const now = new Date(2000, 1 - 1, 1, 0, 0, 0);
+ expect(format(now, '[dddd], MMMM [[D], YYYY] h [A]')).toBe('dddd, January [D], YYYY 12 A');
+ });
+});
+
+describe('compiledObj', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('"ddd MMM DD YYYY HH:mm:ss" equals to "Thu Jan 01 2015 12:34:56"', () => {
+ const now = new Date(2015, 0, 1, 12, 34, 56, 789);
+ expect(format(now, compile('ddd MMM DD YYYY HH:mm:ss'))).toBe('Thu Jan 01 2015 12:34:56');
+ });
+
+ test('"YYYY/MM/DD HH:mm:ss.SSS" equals to "1900/01/01 00:00:00.000"', () => {
+ const now = new Date(0, 0, 1);
+ expect(format(now, compile('YYYY/MM/DD HH:mm:ss.SSS'))).toBe('1900/01/01 00:00:00.000');
+ });
+
+ test('"YY/MM/DD HH:mm:ss.SSS" equals to "00/01/01 00:00:00.000"', () => {
+ const now = new Date(0, 0, 1);
+ expect(format(now, compile('YY/MM/DD HH:mm:ss.SSS'))).toBe('00/01/01 00:00:00.000');
+ });
+
+ test('"Y/M/D H:m:s.SSS" equals to "999/1/1 0:0:0.000"', () => {
+ const now = new Date(999, 0, 1);
+ expect(format(now, compile('Y/M/D H:m:s.SSS'))).toBe('999/1/1 0:0:0.000');
+ });
+
+ test('"dddd, MMMM D, YYYY h A" equals to "Saturday, January 1, 2000 10 AM"', () => {
+ const now = new Date(2000, 0, 1, 10, 0, 0);
+ expect(format(now, compile('dddd, MMMM D, YYYY h A'))).toBe('Saturday, January 1, 2000 10 AM');
+ });
+
+ test('"[dddd, MMMM D, YYYY h A]" equals to "dddd, MMMM D, YYYY h A"', () => {
+ const now = new Date(2000, 0, 1, 10, 0, 0);
+ expect(format(now, compile('[dddd, MMMM D, YYYY h A]'))).toBe('dddd, MMMM D, YYYY h A');
+ });
+
+ test('"[dddd], MMMM [D], YYYY [h] A" equals to "dddd, January D, 2000 h AM"', () => {
+ const now = new Date(2000, 0, 1, 10, 0, 0);
+ expect(format(now, compile('[dddd], MMMM [D], YYYY [h] A'))).toBe('dddd, January D, 2000 h AM');
+ });
+
+ test('"[[dddd], MMMM [D], YYYY [h] A]" equals to "[dddd], MMMM [D], YYYY [h] A"', () => {
+ const now = new Date(2000, 0, 1, 10, 0, 0);
+ expect(format(now, compile('[[dddd], MMMM [D], YYYY [h] A]'))).toBe('[dddd], MMMM [D], YYYY [h] A');
+ });
+
+ test('"[dddd], MMMM [[D], YYYY] [h] A" equals to "dddd, January [D], YYYY h AM"', () => {
+ const now = new Date(2000, 0, 1, 10, 0, 0);
+ expect(format(now, compile('[dddd], MMMM [[D], YYYY] [h] A'))).toBe('dddd, January [D], YYYY h AM');
+ });
+});
+
+describe('options', () => {
+ beforeAll(() => (process.env.TZ = 'UTC'));
+
+ test('hour12: h11', () => {
+ expect(format(new Date(2000, 1 - 1, 1, 0, 0, 0), 'h A', { hour12: 'h11' })).toBe('0 AM');
+ expect(format(new Date(2000, 1 - 1, 1, 11, 0, 0), 'h A', { hour12: 'h11' })).toBe('11 AM');
+ expect(format(new Date(2000, 1 - 1, 1, 12, 0, 0), 'h A', { hour12: 'h11' })).toBe('0 PM');
+ expect(format(new Date(2000, 1 - 1, 1, 23, 0, 0), 'h A', { hour12: 'h11' })).toBe('11 PM');
+ });
+
+ test('hour12: h12', () => {
+ expect(format(new Date(2000, 1 - 1, 1, 0, 0, 0), 'h A', { hour12: 'h12' })).toBe('12 AM');
+ expect(format(new Date(2000, 1 - 1, 1, 11, 0, 0), 'h A', { hour12: 'h12' })).toBe('11 AM');
+ expect(format(new Date(2000, 1 - 1, 1, 12, 0, 0), 'h A', { hour12: 'h12' })).toBe('12 PM');
+ expect(format(new Date(2000, 1 - 1, 1, 23, 0, 0), 'h A', { hour12: 'h12' })).toBe('11 PM');
+ });
+
+ test('hour24: h23', () => {
+ expect(format(new Date(2000, 1 - 1, 1, 0, 0, 0), 'H', { hour24: 'h23' })).toBe('0');
+ expect(format(new Date(2000, 1 - 1, 1, 11, 0, 0), 'H', { hour24: 'h23' })).toBe('11');
+ expect(format(new Date(2000, 1 - 1, 1, 12, 0, 0), 'H', { hour24: 'h23' })).toBe('12');
+ expect(format(new Date(2000, 1 - 1, 1, 23, 0, 0), 'H', { hour24: 'h23' })).toBe('23');
+ });
+
+ test('hour24: h24', () => {
+ expect(format(new Date(2000, 1 - 1, 1, 0, 0, 0), 'H', { hour24: 'h24' })).toBe('24');
+ expect(format(new Date(2000, 1 - 1, 1, 11, 0, 0), 'H', { hour24: 'h24' })).toBe('11');
+ expect(format(new Date(2000, 1 - 1, 1, 12, 0, 0), 'H', { hour24: 'h24' })).toBe('12');
+ expect(format(new Date(2000, 1 - 1, 1, 23, 0, 0), 'H', { hour24: 'h24' })).toBe('23');
+ });
+
+ test('calendar: buddhist', () => {
+ expect(format(new Date(1, 0 - (1900 + 543) * 12, 1, 0, 0, 0), 'YYYY-MM-DD HH', { calendar: 'buddhist' })).toBe('0001-01-01 00');
+ expect(format(new Date(1, 0 - 1900 * 12, 1, 0, 0, 0), 'YYYY-MM-DD HH', { calendar: 'buddhist' })).toBe('0544-01-01 00');
+ expect(format(new Date(9456, 1 - 1, 1, 0, 0, 0), 'YYYY-MM-DD HH', { calendar: 'buddhist' })).toBe('9999-01-01 00');
+
+ expect(format(new Date(1, 0 - (1900 + 543) * 12, 1, 0, 0, 0), 'YY-MM-DD HH', { calendar: 'buddhist' })).toBe('01-01-01 00');
+ expect(format(new Date(1, 0 - 1900 * 12, 1, 0, 0, 0), 'YY-MM-DD HH', { calendar: 'buddhist' })).toBe('44-01-01 00');
+ expect(format(new Date(9456, 1 - 1, 1, 0, 0, 0), 'YY-MM-DD HH', { calendar: 'buddhist' })).toBe('99-01-01 00');
+
+ expect(format(new Date(1, 0 - (1900 + 543) * 12, 1, 0, 0, 0), 'Y-MM-DD HH', { calendar: 'buddhist' })).toBe('1-01-01 00');
+ expect(format(new Date(1, 0 - 1900 * 12, 1, 0, 0, 0), 'Y-MM-DD HH', { calendar: 'buddhist' })).toBe('544-01-01 00');
+ expect(format(new Date(9456, 1 - 1, 1, 0, 0, 0), 'Y-MM-DD HH', { calendar: 'buddhist' })).toBe('9999-01-01 00');
+ });
+
+ test('timeZone', () => {
+ const now = new Date(2025, 1 - 1, 1, 0);
+ expect(format(now, 'YYYY-MM-DD HH:mm:ss.SSS Z dd', { timeZone: Los_Angeles })).toBe('2024-12-31 16:00:00.000 -0800 Tu');
+ expect(format(now, 'YYYY-MM-DD HH:mm:ss.SSS Z dd', { timeZone: Tokyo })).toBe('2025-01-01 09:00:00.000 +0900 We');
+ expect(format(now, 'YYYY-MM-DD HH:mm:ss.SSS Z dd', { timeZone: 'UTC' })).toBe('2025-01-01 00:00:00.000 +0000 We');
+ });
+});
+
+describe('timeZone DST', () => {
+ beforeAll(() => (process.env.TZ = 'America/Los_Angeles'));
+
+ test('before DST', () => {
+ const dateObj = new Date(2021, 2, 14, 1, 59, 59, 999);
+ const dateString = '2021-03-14 01:59:59.999 UTC-0800';
+ expect(format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z')).toBe(dateString);
+ });
+
+ test('start of DST', () => {
+ const dateObj = new Date(2021, 2, 14, 2, 0, 0, 0);
+ const dateString = '2021-03-14 03:00:00.000 UTC-0700';
+ expect(format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z')).toBe(dateString);
+ });
+
+ test('before of PST', () => {
+ const dateObj = new Date(2021, 10, 7, 1, 59, 59, 999);
+ const dateString = '2021-11-07 01:59:59.999 UTC-0700';
+ expect(format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z')).toBe(dateString);
+ });
+
+ test('end of DST', () => {
+ const dateObj = new Date(2021, 10, 7, 2, 0, 0, 0);
+ const dateString = '2021-11-07 02:00:00.000 UTC-0800';
+ expect(format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z')).toBe(dateString);
+ });
+
+ test('after of DST', () => {
+ const dateObj = new Date(2021, 10, 7, 3, 0, 0, 0);
+ const dateString = '2021-11-07 03:00:00.000 UTC-0800';
+ expect(format(dateObj, 'YYYY-MM-DD HH:mm:ss.SSS [UTC]Z')).toBe(dateString);
+ });
+});
diff --git a/tests/isValid.spec.ts b/tests/isValid.spec.ts
new file mode 100644
index 0000000..137b93f
--- /dev/null
+++ b/tests/isValid.spec.ts
@@ -0,0 +1,140 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { isValid, compile } from '../src/index.ts';
+import { parser } from '../src/plugins/day-of-week.ts';
+
+beforeAll(() => (process.env.TZ = 'UTC'));
+
+test('2014-12-31 12:34:56.789 is valid', () => {
+ expect(isValid('20141231123456789', 'YYYYMMDDHHmmssSSS')).toBe(true);
+ expect(isValid('20141231123456789', compile('YYYYMMDDHHmmssSSS'))).toBe(true);
+});
+
+test('2012-2-29 is valid', () => {
+ expect(isValid('2012-2-29', 'YYYY-M-D')).toBe(true);
+ expect(isValid('2012-2-29', compile('YYYY-M-D'))).toBe(true);
+});
+
+test('2100-2-29 is invalid', () => {
+ expect(isValid('2100-2-29', 'YYYY-M-D')).toBe(false);
+ expect(isValid('2100-2-29', compile('YYYY-M-D'))).toBe(false);
+});
+
+test('2000-2-29 is valid', () => {
+ expect(isValid('2000-2-29', 'YYYY-M-D')).toBe(true);
+ expect(isValid('2000-2-29', compile('YYYY-M-D'))).toBe(true);
+});
+
+test('2014-2-29 is invalid', () => {
+ expect(isValid('2014-2-29', 'YYYY-M-D')).toBe(false);
+ expect(isValid('2014-2-29', compile('YYYY-M-D'))).toBe(false);
+});
+
+test('2014-2-28 is valid', () => {
+ expect(isValid('2014-2-28', 'YYYY-M-D')).toBe(true);
+ expect(isValid('2014-2-28', compile('YYYY-M-D'))).toBe(true);
+});
+
+test('2014-4-31 is invalid', () => {
+ expect(isValid('2014-4-31', 'YYYY-M-D')).toBe(false);
+ expect(isValid('2014-4-31', compile('YYYY-M-D'))).toBe(false);
+});
+
+test('24:00 is invalid', () => {
+ expect(isValid('2014-4-30 24:00', 'YYYY-M-D H:m')).toBe(false);
+ expect(isValid('2014-4-30 24:00', compile('YYYY-M-D H:m'))).toBe(false);
+});
+
+test('13:00 PM is invalid', () => {
+ expect(isValid('2014-4-30 13:00 PM', 'YYYY-M-D h:m A')).toBe(false);
+ expect(isValid('2014-4-30 13:00 PM', compile('YYYY-M-D h:m A'))).toBe(false);
+});
+
+test('23:60 is invalid', () => {
+ expect(isValid('2014-4-30 23:60', 'YYYY-M-D H:m')).toBe(false);
+ expect(isValid('2014-4-30 23:60', compile('YYYY-M-D H:m'))).toBe(false);
+});
+
+test('23:59:60 is invalid', () => {
+ expect(isValid('2014-4-30 23:59:60', 'YYYY-M-D H:m:s')).toBe(false);
+ expect(isValid('2014-4-30 23:59:60', compile('YYYY-M-D H:m:s'))).toBe(false);
+});
+
+test('All zero is invalid', () => {
+ expect(isValid('00000000000000000', 'YYYYMMDDHHmmssSSS')).toBe(false);
+ expect(isValid('00000000000000000', compile('YYYYMMDDHHmmssSSS'))).toBe(false);
+});
+
+test('All nine is invalid', () => {
+ expect(isValid('99999999999999999', 'YYYYMMDDHHmmssSSS')).toBe(false);
+ expect(isValid('99999999999999999', compile('YYYYMMDDHHmmssSSS'))).toBe(false);
+});
+
+test('foo is invalid', () => {
+ expect(isValid('20150101235959', 'foo')).toBe(false);
+ expect(isValid('20150101235959', compile('foo'))).toBe(false);
+});
+
+test('bar is invalid', () => {
+ expect(isValid('20150101235959', 'bar')).toBe(false);
+ expect(isValid('20150101235959', compile('bar'))).toBe(false);
+});
+
+test('YYYYMMDD is invalid', () => {
+ expect(isValid('20150101235959', 'YYYYMMDD')).toBe(false);
+ expect(isValid('20150101235959', compile('YYYYMMDD'))).toBe(false);
+});
+
+test('20150101235959 is invalid', () => {
+ expect(isValid('20150101235959', '20150101235959')).toBe(false);
+ expect(isValid('20150101235959', compile('20150101235959'))).toBe(false);
+});
+
+describe('options', () => {
+ test('hour12: h11', () => {
+ expect(isValid('2000-01-01 00:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toBe(true);
+ expect(isValid('2000-01-01 11:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toBe(true);
+ expect(isValid('2000-01-01 00:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toBe(true);
+ expect(isValid('2000-01-01 11:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toBe(true);
+
+ expect(isValid('2000-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toBe(false);
+ expect(isValid('2000-01-01 12:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toBe(false);
+ });
+
+ test('hour12: h12', () => {
+ expect(isValid('2000-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toBe(true);
+ expect(isValid('2000-01-01 11:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toBe(true);
+ expect(isValid('2000-01-01 12:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toBe(true);
+ expect(isValid('2000-01-01 11:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toBe(true);
+
+ expect(isValid('2000-01-01 00:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toBe(false);
+ expect(isValid('2000-01-01 00:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toBe(false);
+ });
+
+ test('hour24: h23', () => {
+ expect(isValid('2000-01-01 00:00', 'YYYY-MM-DD HH:mm', { hour24: 'h23' })).toBe(true);
+ expect(isValid('2000-01-01 01:00', 'YYYY-MM-DD HH:mm', { hour24: 'h23' })).toBe(true);
+ expect(isValid('2000-01-01 23:00', 'YYYY-MM-DD HH:mm', { hour24: 'h23' })).toBe(true);
+
+ expect(isValid('2000-01-01 24:00', 'YYYY-MM-DD HH:mm', { hour24: 'h23' })).toBe(false);
+ });
+
+ test('hour24: h24', () => {
+ expect(isValid('2000-01-01 00:00', 'YYYY-MM-DD HH:mm', { hour24: 'h24' })).toBe(false);
+
+ expect(isValid('2000-01-01 01:00', 'YYYY-MM-DD HH:mm', { hour24: 'h24' })).toBe(true);
+ expect(isValid('2000-01-01 23:00', 'YYYY-MM-DD HH:mm', { hour24: 'h24' })).toBe(true);
+ expect(isValid('2000-01-01 24:00', 'YYYY-MM-DD HH:mm', { hour24: 'h24' })).toBe(true);
+ });
+
+ test('ignoreCase: true', () => {
+ expect(isValid('2025 May 4 Sunday 11 AM', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toBe(true);
+ expect(isValid('2025 may 4 sunday 11 am', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toBe(true);
+ expect(isValid('2025 MAY 4 SUNDAY 11 AM', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toBe(true);
+ });
+
+ test('calendar: buddhist', () => {
+ expect(isValid('9999-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toBe(true);
+ expect(isValid('0544-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toBe(true);
+ expect(isValid('0543-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toBe(false);
+ });
+});
diff --git a/tests/locales/ar.spec.ts b/tests/locales/ar.spec.ts
new file mode 100644
index 0000000..5a670a7
--- /dev/null
+++ b/tests/locales/ar.spec.ts
@@ -0,0 +1,217 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/ar.ts';
+
+const locale = {
+ MMMM: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
+ MMM: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
+ dddd: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
+ ddd: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
+ dd: ['أح', 'اث', 'ثل', 'أر', 'خم', 'جم', 'سب'],
+ A: ['ص', 'م'],
+ AA: ['ص', 'م'],
+ a: ['ص', 'م'],
+ aa: ['ص', 'م']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/az.spec.ts b/tests/locales/az.spec.ts
new file mode 100644
index 0000000..c3e87fd
--- /dev/null
+++ b/tests/locales/az.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/az.ts';
+
+const locale = {
+ MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
+ MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
+ dddd: ['bazar', 'bazar ertəsi', 'çərşənbə axşamı', 'çərşənbə', 'cümə axşamı', 'cümə', 'şənbə'],
+ ddd: ['B.', 'B.E.', 'Ç.A.', 'Ç.', 'C.A.', 'C.', 'Ş.'],
+ dd: ['7', '1', '2', '3', '4', '5', '6'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/bn.spec.ts b/tests/locales/bn.spec.ts
new file mode 100644
index 0000000..ec46f75
--- /dev/null
+++ b/tests/locales/bn.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/bn.ts';
+
+const locale = {
+ MMMM: ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
+ MMM: ['জানু', 'ফেব', 'মার্চ', 'এপ্রি', 'মে', 'জুন', 'জুল', 'আগ', 'সেপ', 'অক্টো', 'নভে', 'ডিসে'],
+ dddd: ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পতিবার', 'শুক্রবার', 'শনিবার'],
+ ddd: ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'],
+ dd: ['র', 'সো', 'ম', 'বু', 'বৃ', 'শু', 'শ'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/cs.spec.ts b/tests/locales/cs.spec.ts
new file mode 100644
index 0000000..d3e2a57
--- /dev/null
+++ b/tests/locales/cs.spec.ts
@@ -0,0 +1,258 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/cs.ts';
+
+const locale = {
+ MMMM: [
+ ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
+ ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince']
+ ],
+ MMM: [
+ ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'],
+ ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro']
+ ],
+ dddd: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
+ ddd: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
+ dd: ['N', 'P', 'Ú', 'S', 'Č', 'P', 'S'],
+ A: ['dop.', 'odp.'],
+ AA: ['dop.', 'odp.'],
+ a: ['dop.', 'odp.'],
+ aa: ['dop.', 'odp.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM D', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM D ignoreCase', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM D', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM D ignoreCase', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/da.spec.ts b/tests/locales/da.spec.ts
new file mode 100644
index 0000000..a0807ba
--- /dev/null
+++ b/tests/locales/da.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/da.ts';
+
+const locale = {
+ MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
+ MMM: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
+ dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
+ ddd: ['søn.', 'man.', 'tirs.', 'ons.', 'tors.', 'fre.', 'lør.'],
+ dd: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/de.spec.ts b/tests/locales/de.spec.ts
new file mode 100644
index 0000000..86909f7
--- /dev/null
+++ b/tests/locales/de.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/de.ts';
+
+const locale = {
+ MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
+ MMM: ['Jan.', 'Feb.', 'März', 'Apr.', 'Mai', 'Juni', 'Juli', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'],
+ dddd: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
+ ddd: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
+ dd: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/el.spec.ts b/tests/locales/el.spec.ts
new file mode 100644
index 0000000..3471bc5
--- /dev/null
+++ b/tests/locales/el.spec.ts
@@ -0,0 +1,234 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/el.ts';
+
+const locale = {
+ MMMM: [
+ ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
+ ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
+ ],
+ MMM: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαΐ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
+ dddd: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
+ ddd: ['Κυρ', 'Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ'],
+ dd: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
+ A: ['ΠΜ', 'ΜΜ'],
+ AA: ['Π.Μ.', 'Μ.Μ.'],
+ a: ['πμ', 'μμ'],
+ aa: ['π.μ.', 'μ.μ.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM D ignoreCase', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/en.spec.ts b/tests/locales/en.spec.ts
new file mode 100644
index 0000000..4309076
--- /dev/null
+++ b/tests/locales/en.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/en.ts';
+
+const locale = {
+ MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ dddd: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+ ddd: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ dd: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/es.spec.ts b/tests/locales/es.spec.ts
new file mode 100644
index 0000000..a270668
--- /dev/null
+++ b/tests/locales/es.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/es.ts';
+
+const locale = {
+ MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
+ MMM: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sept', 'oct', 'nov', 'dic'],
+ dddd: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
+ ddd: ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb'],
+ dd: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/fa.spec.ts b/tests/locales/fa.spec.ts
new file mode 100644
index 0000000..b961569
--- /dev/null
+++ b/tests/locales/fa.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/fa.ts';
+
+const locale = {
+ MMMM: ['دی', 'بهمن', 'اسفند', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر'],
+ MMM: ['دی', 'بهمن', 'اسفند', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر'],
+ dddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
+ ddd: ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
+ dd: ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
+ A: ['قبلازظهر', 'بعدازظهر'],
+ AA: ['قبلازظهر', 'بعدازظهر'],
+ a: ['قبلازظهر', 'بعدازظهر'],
+ aa: ['قبلازظهر', 'بعدازظهر']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/fi.spec.ts b/tests/locales/fi.spec.ts
new file mode 100644
index 0000000..5c2b4e3
--- /dev/null
+++ b/tests/locales/fi.spec.ts
@@ -0,0 +1,258 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/fi.ts';
+
+const locale = {
+ MMMM: [
+ ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
+ ['tammikuuta', 'helmikuuta', 'maaliskuuta', 'huhtikuuta', 'toukokuuta', 'kesäkuuta', 'heinäkuuta', 'elokuuta', 'syyskuuta', 'lokakuuta', 'marraskuuta', 'joulukuuta']
+ ],
+ MMM: [
+ ['tammi', 'helmi', 'maalis', 'huhti', 'touko', 'kesä', 'heinä', 'elo', 'syys', 'loka', 'marras', 'joulu'],
+ ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
+ ],
+ dddd: ['sunnuntai', 'maanantaina', 'tiistaina', 'keskiviikkona', 'torstaina', 'perjantaina', 'lauantaina'],
+ ddd: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
+ dd: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
+ A: ['ap.', 'ip.'],
+ AA: ['ap.', 'ip.'],
+ a: ['ap.', 'ip.'],
+ aa: ['ap.', 'ip.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM D', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM D ignoreCase', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM D', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM D ignoreCase', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/fr.spec.ts b/tests/locales/fr.spec.ts
new file mode 100644
index 0000000..e6cf71e
--- /dev/null
+++ b/tests/locales/fr.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/fr.ts';
+
+const locale = {
+ MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
+ MMM: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
+ dddd: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
+ ddd: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
+ dd: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/he.spec.ts b/tests/locales/he.spec.ts
new file mode 100644
index 0000000..da1b780
--- /dev/null
+++ b/tests/locales/he.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/he.ts';
+
+const locale = {
+ MMMM: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
+ MMM: ['ינו׳', 'פבר׳', 'מרץ', 'אפר׳', 'מאי', 'יוני', 'יולי', 'אוג׳', 'ספט׳', 'אוק׳', 'נוב׳', 'דצמ׳'],
+ dddd: ['יום ראשון', 'יום שני', 'יום שלישי', 'יום רביעי', 'יום חמישי', 'יום שישי', 'יום שבת'],
+ ddd: ['יום א׳', 'יום ב׳', 'יום ג׳', 'יום ד׳', 'יום ה׳', 'יום ו׳', 'שבת'],
+ dd: ['א׳', 'ב׳', 'ג׳', 'ד׳', 'ה׳', 'ו׳', 'ש׳'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/hi.spec.ts b/tests/locales/hi.spec.ts
new file mode 100644
index 0000000..9d4f504
--- /dev/null
+++ b/tests/locales/hi.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/hi.ts';
+
+const locale = {
+ MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्तूबर', 'नवंबर', 'दिसंबर'],
+ MMM: ['जन॰', 'फ़र॰', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुल॰', 'अग॰', 'सित॰', 'अक्तू॰', 'नव॰', 'दिस॰'],
+ dddd: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरुवार', 'शुक्रवार', 'शनिवार'],
+ ddd: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'],
+ dd: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/hu.spec.ts b/tests/locales/hu.spec.ts
new file mode 100644
index 0000000..7938170
--- /dev/null
+++ b/tests/locales/hu.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/hu.ts';
+
+const locale = {
+ MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'],
+ MMM: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
+ dddd: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'],
+ ddd: ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'],
+ dd: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
+ A: ['DE', 'DU'],
+ AA: ['DE.', 'DU.'],
+ a: ['de', 'du'],
+ aa: ['de.', 'du.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/id.spec.ts b/tests/locales/id.spec.ts
new file mode 100644
index 0000000..2b3d9ed
--- /dev/null
+++ b/tests/locales/id.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/id.ts';
+
+const locale = {
+ MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
+ MMM: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'],
+ dddd: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
+ ddd: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
+ dd: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/it.spec.ts b/tests/locales/it.spec.ts
new file mode 100644
index 0000000..84ced38
--- /dev/null
+++ b/tests/locales/it.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/it.ts';
+
+const locale = {
+ MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],
+ MMM: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
+ dddd: ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato'],
+ ddd: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
+ dd: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/ja.spec.ts b/tests/locales/ja.spec.ts
new file mode 100644
index 0000000..8f17e9f
--- /dev/null
+++ b/tests/locales/ja.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/ja.ts';
+
+const locale = {
+ MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ MMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ dddd: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
+ ddd: ['日', '月', '火', '水', '木', '金', '土'],
+ dd: ['日', '月', '火', '水', '木', '金', '土'],
+ A: ['午前', '午後'],
+ AA: ['午前', '午後'],
+ a: ['午前', '午後'],
+ aa: ['午前', '午後']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/ko.spec.ts b/tests/locales/ko.spec.ts
new file mode 100644
index 0000000..03def25
--- /dev/null
+++ b/tests/locales/ko.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/ko.ts';
+
+const locale = {
+ MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
+ MMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
+ dddd: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
+ ddd: ['일', '월', '화', '수', '목', '금', '토'],
+ dd: ['일', '월', '화', '수', '목', '금', '토'],
+ A: ['오전', '오후'],
+ AA: ['오전', '오후'],
+ a: ['오전', '오후'],
+ aa: ['오전', '오후']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/ms.spec.ts b/tests/locales/ms.spec.ts
new file mode 100644
index 0000000..4aaa664
--- /dev/null
+++ b/tests/locales/ms.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/ms.ts';
+
+const locale = {
+ MMMM: ['Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'],
+ MMM: ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ogo', 'Sep', 'Okt', 'Nov', 'Dis'],
+ dddd: ['Ahad', 'Isnin', 'Selasa', 'Rabu', 'Khamis', 'Jumaat', 'Sabtu'],
+ ddd: ['Ahd', 'Isn', 'Sel', 'Rab', 'Kha', 'Jum', 'Sab'],
+ dd: ['Ahd', 'Isn', 'Sel', 'Rab', 'Kha', 'Jum', 'Sab'],
+ A: ['PG', 'PTG'],
+ AA: ['PG', 'PTG'],
+ a: ['PG', 'PTG'],
+ aa: ['PG', 'PTG']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/my.spec.ts b/tests/locales/my.spec.ts
new file mode 100644
index 0000000..63f833a
--- /dev/null
+++ b/tests/locales/my.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/my.ts';
+
+const locale = {
+ MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'ဩဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'],
+ MMM: ['ဇန်', 'ဖေ', 'မတ်', 'ဧ', 'မေ', 'ဇွန်', 'ဇူ', 'ဩ', 'စက်', 'အောက်', 'နို', 'ဒီ'],
+ dddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
+ ddd: ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'],
+ dd: ['တ', 'တ', 'အ', 'ဗ', 'က', 'သ', 'စ'],
+ A: ['နံနက်', 'ညနေ'],
+ AA: ['နံနက်', 'ညနေ'],
+ a: ['နံနက်', 'ညနေ'],
+ aa: ['နံနက်', 'ညနေ']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/nl.spec.ts b/tests/locales/nl.spec.ts
new file mode 100644
index 0000000..57ab17b
--- /dev/null
+++ b/tests/locales/nl.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/nl.ts';
+
+const locale = {
+ MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
+ MMM: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
+ dddd: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
+ ddd: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
+ dd: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/no.spec.ts b/tests/locales/no.spec.ts
new file mode 100644
index 0000000..5e7ce97
--- /dev/null
+++ b/tests/locales/no.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/no.ts';
+
+const locale = {
+ MMMM: ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'],
+ MMM: ['jan.', 'feb.', 'mars', 'apr.', 'mai', 'juni', 'juli', 'aug.', 'sep.', 'okt.', 'nov.', 'des.'],
+ dddd: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
+ ddd: ['søn.', 'man.', 'tir.', 'ons.', 'tor.', 'fre.', 'lør.'],
+ dd: ['søn.', 'man.', 'tir.', 'ons.', 'tor.', 'fre.', 'lør.'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/pl.spec.ts b/tests/locales/pl.spec.ts
new file mode 100644
index 0000000..27f41ff
--- /dev/null
+++ b/tests/locales/pl.spec.ts
@@ -0,0 +1,234 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/pl.ts';
+
+const locale = {
+ MMMM: [
+ ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'],
+ ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia']
+ ],
+ MMM: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
+ dddd: ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'],
+ ddd: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
+ dd: ['ndz.', 'pn.', 'wt.', 'śr.', 'cz.', 'pt.', 'so.'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM D ignoreCase', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/pt-BR.spec.ts b/tests/locales/pt-BR.spec.ts
new file mode 100644
index 0000000..58ce2a4
--- /dev/null
+++ b/tests/locales/pt-BR.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/pt-BR.ts';
+
+const locale = {
+ MMMM: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'],
+ MMM: ['jan.', 'fev.', 'mar.', 'abr.', 'mai.', 'jun.', 'jul.', 'ago.', 'set.', 'out.', 'nov.', 'dez.'],
+ dddd: ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'],
+ ddd: ['dom.', 'seg.', 'ter.', 'qua.', 'qui.', 'sex.', 'sáb.'],
+ dd: ['1ª', '2ª', '3ª', '4ª', '5ª', '6ª', '7ª'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/pt-PT.spec.ts b/tests/locales/pt-PT.spec.ts
new file mode 100644
index 0000000..9d84e48
--- /dev/null
+++ b/tests/locales/pt-PT.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/pt-PT.ts';
+
+const locale = {
+ MMMM: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'],
+ MMM: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
+ dddd: ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'],
+ ddd: ['domingo', 'segunda', 'terça', 'quarta', 'quinta', 'sexta', 'sábado'],
+ dd: ['Do', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sa'],
+ A: ['da manhã', 'da tarde'],
+ AA: ['da manhã', 'da tarde'],
+ a: ['da manhã', 'da tarde'],
+ aa: ['da manhã', 'da tarde']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/ro.spec.ts b/tests/locales/ro.spec.ts
new file mode 100644
index 0000000..1581619
--- /dev/null
+++ b/tests/locales/ro.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/ro.ts';
+
+const locale = {
+ MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'],
+ MMM: ['ian.', 'feb.', 'mar.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'],
+ dddd: ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'],
+ ddd: ['dum.', 'lun.', 'mar.', 'mie.', 'joi', 'vin.', 'sâm.'],
+ dd: ['du', 'lu', 'ma', 'mi', 'jo', 'vi', 'sâ'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/ru.spec.ts b/tests/locales/ru.spec.ts
new file mode 100644
index 0000000..3e7d952
--- /dev/null
+++ b/tests/locales/ru.spec.ts
@@ -0,0 +1,258 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/ru.ts';
+
+const locale = {
+ MMMM: [
+ ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'],
+ ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря']
+ ],
+ MMM: [
+ ['янв.', 'февр.', 'март', 'апр.', 'май', 'июнь', 'июль', 'авг.', 'сент.', 'окт.', 'нояб.', 'дек.'],
+ ['янв.', 'февр.', 'мар.', 'апр.', 'мая', 'июн.', 'июл.', 'авг.', 'сент.', 'окт.', 'нояб.', 'дек.']
+ ],
+ dddd: ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота'],
+ ddd: ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
+ dd: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM D', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM D ignoreCase', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM D', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM D ignoreCase', () => {
+ locale.MMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/rw.spec.ts b/tests/locales/rw.spec.ts
new file mode 100644
index 0000000..d17af55
--- /dev/null
+++ b/tests/locales/rw.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/rw.ts';
+
+const locale = {
+ MMMM: ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'],
+ MMM: ['mut.', 'gas.', 'wer.', 'mat.', 'gic.', 'kam.', 'nya.', 'kan.', 'nze.', 'ukw.', 'ugu.', 'uku.'],
+ dddd: ['Ku cyumweru', 'Kuwa mbere', 'Kuwa kabiri', 'Kuwa gatatu', 'Kuwa kane', 'Kuwa gatanu', 'Kuwa gatandatu'],
+ ddd: ['cyu.', 'mbe.', 'kab.', 'gtu.', 'kan.', 'gnu.', 'gnd.'],
+ dd: ['cyu.', 'mbe.', 'kab.', 'gtu.', 'kan.', 'gnu.', 'gnd.'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/sr-Cyrl.spec.ts b/tests/locales/sr-Cyrl.spec.ts
new file mode 100644
index 0000000..91cbc87
--- /dev/null
+++ b/tests/locales/sr-Cyrl.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/sr-Cyrl.ts';
+
+const locale = {
+ MMMM: ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'],
+ MMM: ['јан', 'феб', 'мар', 'апр', 'мај', 'јун', 'јул', 'авг', 'сеп', 'окт', 'нов', 'дец'],
+ dddd: ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'],
+ ddd: ['нед', 'пон', 'уто', 'сре', 'чет', 'пет', 'суб'],
+ dd: ['нед', 'пон', 'уто', 'сре', 'чет', 'пет', 'суб'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/sr-Latn.spec.ts b/tests/locales/sr-Latn.spec.ts
new file mode 100644
index 0000000..0a2aac7
--- /dev/null
+++ b/tests/locales/sr-Latn.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/sr-Latn.ts';
+
+const locale = {
+ MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
+ MMM: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
+ dddd: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
+ ddd: ['ned', 'pon', 'uto', 'sre', 'čet', 'pet', 'sub'],
+ dd: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/sv.spec.ts b/tests/locales/sv.spec.ts
new file mode 100644
index 0000000..9ceb723
--- /dev/null
+++ b/tests/locales/sv.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/sv.ts';
+
+const locale = {
+ MMMM: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
+ MMM: ['jan.', 'feb.', 'mars', 'apr.', 'maj', 'juni', 'juli', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
+ dddd: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
+ ddd: ['sön', 'mån', 'tis', 'ons', 'tors', 'fre', 'lör'],
+ dd: ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö'],
+ A: ['fm', 'em'],
+ AA: ['fm', 'em'],
+ a: ['fm', 'em'],
+ aa: ['fm', 'em']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/ta.spec.ts b/tests/locales/ta.spec.ts
new file mode 100644
index 0000000..8756076
--- /dev/null
+++ b/tests/locales/ta.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/ta.ts';
+
+const locale = {
+ MMMM: ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'],
+ MMM: ['ஜன.', 'பிப்.', 'மார்.', 'ஏப்.', 'மே', 'ஜூன்', 'ஜூலை', 'ஆக.', 'செப்.', 'அக்.', 'நவ.', 'டிச.'],
+ dddd: ['ஞாயிறு', 'திங்கள்', 'செவ்வாய்', 'புதன்', 'வியாழன்', 'வெள்ளி', 'சனி'],
+ ddd: ['ஞாயி.', 'திங்.', 'செவ்.', 'புத.', 'வியா.', 'வெள்.', 'சனி'],
+ dd: ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'],
+ A: ['AM', 'PM'],
+ AA: ['A.M.', 'P.M.'],
+ a: ['am', 'pm'],
+ aa: ['a.m.', 'p.m.']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/th.spec.ts b/tests/locales/th.spec.ts
new file mode 100644
index 0000000..06cb764
--- /dev/null
+++ b/tests/locales/th.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/th.ts';
+
+const locale = {
+ MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'],
+ MMM: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'],
+ dddd: ['วันอาทิตย์', 'วันจันทร์', 'วันอังคาร', 'วันพุธ', 'วันพฤหัสบดี', 'วันศุกร์', 'วันเสาร์'],
+ ddd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
+ dd: ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'],
+ A: ['ก่อนเที่ยง', 'หลังเที่ยง'],
+ AA: ['ก่อนเที่ยง', 'หลังเที่ยง'],
+ a: ['ก่อนเที่ยง', 'หลังเที่ยง'],
+ aa: ['ก่อนเที่ยง', 'หลังเที่ยง']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/tr.spec.ts b/tests/locales/tr.spec.ts
new file mode 100644
index 0000000..bb31678
--- /dev/null
+++ b/tests/locales/tr.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/tr.ts';
+
+const locale = {
+ MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
+ MMM: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
+ dddd: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
+ ddd: ['Paz', 'Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cmt'],
+ dd: ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'],
+ A: ['ÖÖ', 'ÖS'],
+ AA: ['ÖÖ', 'ÖS'],
+ a: ['ÖÖ', 'ÖS'],
+ aa: ['ÖÖ', 'ÖS']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/uk.spec.ts b/tests/locales/uk.spec.ts
new file mode 100644
index 0000000..23e8d23
--- /dev/null
+++ b/tests/locales/uk.spec.ts
@@ -0,0 +1,234 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/uk.ts';
+
+const locale = {
+ MMMM: [
+ ['січень', 'лютий', 'березень', 'квітень', 'травень', 'червень', 'липень', 'серпень', 'вересень', 'жовтень', 'листопад', 'грудень'],
+ ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня']
+ ],
+ MMM: ['січ.', 'лют.', 'бер.', 'квіт.', 'трав.', 'черв.', 'лип.', 'серп.', 'вер.', 'жовт.', 'лист.', 'груд.'],
+ dddd: ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'пʼятниця', 'субота'],
+ ddd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
+ dd: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
+ A: ['дп', 'пп'],
+ AA: ['дп', 'пп'],
+ a: ['дп', 'пп'],
+ aa: ['дп', 'пп']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM D', { locale: lo })).toBe(`${v} 1`);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM[0].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMMM D', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM D ignoreCase', () => {
+ locale.MMMM[1].forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(`${v} 1`, 'MMMM D', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/uz-Cyrl.spec.ts b/tests/locales/uz-Cyrl.spec.ts
new file mode 100644
index 0000000..b26215a
--- /dev/null
+++ b/tests/locales/uz-Cyrl.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/uz-Cyrl.ts';
+
+const locale = {
+ MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'],
+ MMM: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'],
+ dddd: ['якшанба', 'душанба', 'сешанба', 'чоршанба', 'пайшанба', 'жума', 'шанба'],
+ ddd: ['якш', 'душ', 'сеш', 'чор', 'пай', 'жум', 'шан'],
+ dd: ['Як', 'Ду', 'Се', 'Чо', 'Па', 'Жу', 'Ша'],
+ A: ['ТО', 'ТК'],
+ AA: ['ТО', 'ТК'],
+ a: ['ТО', 'ТК'],
+ aa: ['ТО', 'ТК']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/uz-Latn.spec.ts b/tests/locales/uz-Latn.spec.ts
new file mode 100644
index 0000000..4891dde
--- /dev/null
+++ b/tests/locales/uz-Latn.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/uz-Latn.ts';
+
+const locale = {
+ MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avgust', 'sentabr', 'oktabr', 'noyabr', 'dekabr'],
+ MMM: ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avg', 'sen', 'okt', 'noy', 'dek'],
+ dddd: ['yakshanba', 'dushanba', 'seshanba', 'chorshanba', 'payshanba', 'juma', 'shanba'],
+ ddd: ['Yak', 'Dush', 'Sesh', 'Chor', 'Pay', 'Jum', 'Shan'],
+ dd: ['Yak', 'Dush', 'Sesh', 'Chor', 'Pay', 'Jum', 'Shan'],
+ A: ['TO', 'TK'],
+ AA: ['TO', 'TK'],
+ a: ['TO', 'TK'],
+ aa: ['TO', 'TK']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/vi.spec.ts b/tests/locales/vi.spec.ts
new file mode 100644
index 0000000..9713187
--- /dev/null
+++ b/tests/locales/vi.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/vi.ts';
+
+const locale = {
+ MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'],
+ MMM: ['thg 1', 'thg 2', 'thg 3', 'thg 4', 'thg 5', 'thg 6', 'thg 7', 'thg 8', 'thg 9', 'thg 10', 'thg 11', 'thg 12'],
+ dddd: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],
+ ddd: ['CN', 'Th 2', 'Th 3', 'Th 4', 'Th 5', 'Th 6', 'Th 7'],
+ dd: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
+ A: ['SA', 'CH'],
+ AA: ['SA', 'CH'],
+ a: ['SA', 'CH'],
+ aa: ['SA', 'CH']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/zh-Hans.spec.ts b/tests/locales/zh-Hans.spec.ts
new file mode 100644
index 0000000..a1a91f7
--- /dev/null
+++ b/tests/locales/zh-Hans.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/zh-Hans.ts';
+
+const locale = {
+ MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ MMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
+ ddd: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
+ dd: ['日', '一', '二', '三', '四', '五', '六'],
+ A: ['上午', '下午'],
+ AA: ['上午', '下午'],
+ a: ['上午', '下午'],
+ aa: ['上午', '下午']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/locales/zh-Hant.spec.ts b/tests/locales/zh-Hant.spec.ts
new file mode 100644
index 0000000..71fbcca
--- /dev/null
+++ b/tests/locales/zh-Hant.spec.ts
@@ -0,0 +1,210 @@
+import { describe, expect, test } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { parser } from '../../src/plugins/day-of-week.ts';
+
+import lo from '../../src/locales/zh-Hant.ts';
+
+const locale = {
+ MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ MMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ dddd: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
+ ddd: ['週日', '週一', '週二', '週三', '週四', '週五', '週六'],
+ dd: ['日', '一', '二', '三', '四', '五', '六'],
+ A: ['上午', '下午'],
+ AA: ['上午', '下午'],
+ a: ['上午', '下午'],
+ aa: ['上午', '下午']
+};
+
+describe('formatter', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(format(d, 'MMM', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'ddd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach((v, i) => {
+ const d = new Date(1970, 0, i + 4);
+ expect(format(d, 'dd', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'A', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'AA', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'a', { locale: lo })).toBe(v);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(format(d, 'aa', { locale: lo })).toBe(v);
+ });
+ });
+});
+
+describe('parser', () => {
+ test('MMMM', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMMM ignoreCase', () => {
+ locale.MMMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('MMM', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('MMM ignoreCase', () => {
+ locale.MMM.forEach((v, i) => {
+ const d = new Date(1970, i, 1);
+ expect(parse(v, 'MMM', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dddd', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dddd ignoreCase', () => {
+ locale.dddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('ddd', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('ddd ignoreCase', () => {
+ locale.ddd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'ddd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('dd', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser] })).toEqual(d);
+ });
+ });
+
+ test('dd ignoreCase', () => {
+ locale.dd.forEach(v => {
+ const d = new Date(1970, 0, 1);
+ expect(parse(v, 'dd', { locale: lo, plugins: [parser], ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('A', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('A ignoreCase', () => {
+ locale.A.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'A', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('AA', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('AA ignoreCase', () => {
+ locale.AA.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'AA', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('a', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('a ignoreCase', () => {
+ locale.a.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'a', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+
+ test('aa', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo })).toEqual(d);
+ });
+ });
+
+ test('aa ignoreCase', () => {
+ locale.aa.forEach((v, i) => {
+ const d = new Date(1970, 0, 1, i * 12);
+ expect(parse(v, 'aa', { locale: lo, ignoreCase: true })).toEqual(d);
+ });
+ });
+});
diff --git a/tests/numerals/arab.spec.ts b/tests/numerals/arab.spec.ts
new file mode 100644
index 0000000..498db69
--- /dev/null
+++ b/tests/numerals/arab.spec.ts
@@ -0,0 +1,12 @@
+import { describe, expect, test } from 'vitest';
+import numeral from '../../src/numerals/arab.ts';
+
+describe('arab', () => {
+ test('encode', () => {
+ expect(numeral.encode('0 1 2 3 4 5 6 7 8 9')).toBe('٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩');
+ });
+
+ test('decode', () => {
+ expect(numeral.decode('٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩')).toBe('0 1 2 3 4 5 6 7 8 9');
+ });
+});
diff --git a/tests/numerals/arabext.spec.ts b/tests/numerals/arabext.spec.ts
new file mode 100644
index 0000000..dadb5ef
--- /dev/null
+++ b/tests/numerals/arabext.spec.ts
@@ -0,0 +1,12 @@
+import { describe, expect, test } from 'vitest';
+import numeral from '../../src/numerals/arabext.ts';
+
+describe('arabext', () => {
+ test('encode', () => {
+ expect(numeral.encode('0 1 2 3 4 5 6 7 8 9')).toBe('۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹');
+ });
+
+ test('decode', () => {
+ expect(numeral.decode('۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹')).toBe('0 1 2 3 4 5 6 7 8 9');
+ });
+});
diff --git a/tests/numerals/beng.spec.ts b/tests/numerals/beng.spec.ts
new file mode 100644
index 0000000..5a747f1
--- /dev/null
+++ b/tests/numerals/beng.spec.ts
@@ -0,0 +1,12 @@
+import { describe, expect, test } from 'vitest';
+import numeral from '../../src/numerals/beng.ts';
+
+describe('beng', () => {
+ test('encode', () => {
+ expect(numeral.encode('0 1 2 3 4 5 6 7 8 9')).toBe('০ ১ ২ ৩ ৪ ৫ ৬ ৭ ৮ ৯');
+ });
+
+ test('decode', () => {
+ expect(numeral.decode('০ ১ ২ ৩ ৪ ৫ ৬ ৭ ৮ ৯')).toBe('0 1 2 3 4 5 6 7 8 9');
+ });
+});
diff --git a/tests/numerals/latn.spec.ts b/tests/numerals/latn.spec.ts
new file mode 100644
index 0000000..01b3870
--- /dev/null
+++ b/tests/numerals/latn.spec.ts
@@ -0,0 +1,12 @@
+import { describe, expect, test } from 'vitest';
+import numeral from '../../src/numerals/latn.ts';
+
+describe('latn', () => {
+ test('encode', () => {
+ expect(numeral.encode('0 1 2 3 4 5 6 7 8 9')).toBe('0 1 2 3 4 5 6 7 8 9');
+ });
+
+ test('decode', () => {
+ expect(numeral.decode('0 1 2 3 4 5 6 7 8 9')).toBe('0 1 2 3 4 5 6 7 8 9');
+ });
+});
diff --git a/tests/numerals/mymr.spec.ts b/tests/numerals/mymr.spec.ts
new file mode 100644
index 0000000..4bc179c
--- /dev/null
+++ b/tests/numerals/mymr.spec.ts
@@ -0,0 +1,12 @@
+import { describe, expect, test } from 'vitest';
+import numeral from '../../src/numerals/mymr.ts';
+
+describe('mymr', () => {
+ test('encode', () => {
+ expect(numeral.encode('0 1 2 3 4 5 6 7 8 9')).toBe('၀ ၁ ၂ ၃ ၄ ၅ ၆ ၇ ၈ ၉');
+ });
+
+ test('decode', () => {
+ expect(numeral.decode('၀ ၁ ၂ ၃ ၄ ၅ ၆ ၇ ၈ ၉')).toBe('0 1 2 3 4 5 6 7 8 9');
+ });
+});
diff --git a/tests/parse.spec.ts b/tests/parse.spec.ts
new file mode 100644
index 0000000..0e43ae2
--- /dev/null
+++ b/tests/parse.spec.ts
@@ -0,0 +1,760 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { parse } from '../src/index.ts';
+import { parser } from '../src/plugins/day-of-week.ts';
+import Los_Angeles from '../src/timezones/America/Los_Angeles.ts';
+import Tokyo from '../src/timezones/Asia/Tokyo.ts';
+import Adelaide from '../src/timezones/Australia/Adelaide.ts';
+import Apia from '../src/timezones/Pacific/Apia.ts';
+
+test('YYYY', () => {
+ expect(Number.isNaN(parse('0000', 'YYYY').getTime())).toBe(true);
+});
+
+test('YYYY', () => {
+ const now = new Date(0, -1899 * 12, 1);
+ expect(parse('0001', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(0, -1801 * 12, 1);
+ expect(parse('0099', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(100, 0, 1);
+ expect(parse('0100', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(1899, 0, 1);
+ expect(parse('1899', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(1900, 0, 1);
+ expect(parse('1900', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(1969, 0, 1);
+ expect(parse('1969', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(1970, 0, 1);
+ expect(parse('1970', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(1999, 0, 1);
+ expect(parse('1999', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(2000, 0, 1);
+ expect(parse('2000', 'YYYY')).toEqual(now);
+});
+
+test('YYYY', () => {
+ const now = new Date(9999, 0, 1);
+ expect(parse('9999', 'YYYY')).toEqual(now);
+});
+
+test('Y', () => {
+ expect(Number.isNaN(parse('0', 'Y').getTime())).toBe(true);
+});
+
+test('Y', () => {
+ const now = new Date(0, -1899 * 12, 1);
+ expect(parse('1', 'Y')).toEqual(now);
+});
+
+test('Y', () => {
+ const now = new Date(0, -1801 * 12, 1);
+ expect(parse('99', 'Y')).toEqual(now);
+});
+
+test('Y', () => {
+ const now = new Date(100, 0, 1);
+ expect(parse('100', 'Y')).toEqual(now);
+});
+
+test('YYYY MMMM', () => {
+ const now = new Date(2015, 0, 1);
+ expect(parse('2015 January', 'YYYY MMMM')).toEqual(now);
+});
+
+test('YYYY MMMM', () => {
+ const now = new Date(2015, 11, 1);
+ expect(parse('2015 December', 'YYYY MMMM')).toEqual(now);
+});
+
+test('YYYY MMMM', () => {
+ expect(Number.isNaN(parse('2015 Zero', 'YYYY MMMM').getTime())).toBe(true);
+});
+
+test('YYYY MMM', () => {
+ const now = new Date(2015, 0, 1);
+ expect(parse('2015 Jan', 'YYYY MMM')).toEqual(now);
+});
+
+test('YYYY MMM', () => {
+ const now = new Date(2015, 11, 1);
+ expect(parse('2015 Dec', 'YYYY MMM')).toEqual(now);
+});
+
+test('YYYY MMM', () => {
+ expect(Number.isNaN(parse('2015 Zero', 'YYYY MMM').getTime())).toBe(true);
+});
+
+test('YYYY-MM', () => {
+ const now = new Date(2015, 0, 1);
+ expect(parse('2015-01', 'YYYY-MM')).toEqual(now);
+});
+
+test('YYYY-MM', () => {
+ const now = new Date(2015, 11, 1);
+ expect(parse('2015-12', 'YYYY-MM')).toEqual(now);
+});
+
+test('YYYY-MM', () => {
+ expect(Number.isNaN(parse('2015-00', 'YYYY-MM').getTime())).toBe(true);
+});
+
+test('YYYY-M', () => {
+ const now = new Date(2015, 0, 1);
+ expect(parse('2015-1', 'YYYY-M')).toEqual(now);
+});
+
+test('YYYY-M', () => {
+ const now = new Date(2015, 11, 1);
+ expect(parse('2015-12', 'YYYY-M')).toEqual(now);
+});
+
+test('YYYY-M', () => {
+ expect(Number.isNaN(parse('2015-0', 'YYYY-M').getTime())).toBe(true);
+});
+
+test('YYYY-MM-DD', () => {
+ const now = new Date(2015, 0, 1);
+ expect(parse('2015-01-01', 'YYYY-MM-DD')).toEqual(now);
+});
+
+test('YYYY-MM-DD', () => {
+ const now = new Date(2015, 11, 31);
+ expect(parse('2015-12-31', 'YYYY-MM-DD')).toEqual(now);
+});
+
+test('YYYY-MM-DD', () => {
+ expect(Number.isNaN(parse('2015-00-00', 'YYYY-MM-DD').getTime())).toBe(true);
+});
+
+test('YYYY-M-D', () => {
+ const now = new Date(2015, 0, 1);
+ expect(parse('2015-1-1', 'YYYY-M-D')).toEqual(now);
+});
+
+test('YYYY-M-D', () => {
+ const now = new Date(2015, 11, 31);
+ expect(parse('2015-12-31', 'YYYY-M-D')).toEqual(now);
+});
+
+test('YYYY-M-D', () => {
+ expect(Number.isNaN(parse('2015-0-0', 'YYYY-M-D').getTime())).toBe(true);
+});
+
+test('YYYY-MM-DD HH', () => {
+ const now = new Date(2015, 0, 1, 0);
+ expect(parse('2015-01-01 00', 'YYYY-MM-DD HH')).toEqual(now);
+});
+
+test('YYYY-MM-DD HH', () => {
+ const now = new Date(2015, 11, 31, 23);
+ expect(parse('2015-12-31 23', 'YYYY-MM-DD HH')).toEqual(now);
+});
+
+test('YYYY-MM-DD HH', () => {
+ expect(Number.isNaN(parse('2015-00-00 24', 'YYYY-MM-DD HH').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H', () => {
+ const now = new Date(2015, 0, 1, 0);
+ expect(parse('2015-1-1 0', 'YYYY-M-D H')).toEqual(now);
+});
+
+test('YYYY-M-D H', () => {
+ const now = new Date(2015, 11, 31, 23);
+ expect(parse('2015-12-31 23', 'YYYY-M-D H')).toEqual(now);
+});
+
+test('YYYY-M-D H', () => {
+ expect(Number.isNaN(parse('2015-0-0 24', 'YYYY-M-D H').getTime())).toBe(true);
+});
+
+test('YYYY-M-D hh A', () => {
+ const now = new Date(2015, 0, 1, 0);
+ expect(parse('2015-1-1 12 AM', 'YYYY-M-D hh A')).toEqual(now);
+});
+
+test('YYYY-M-D hh A', () => {
+ const now = new Date(2015, 11, 31, 23);
+ expect(parse('2015-12-31 11 PM', 'YYYY-M-D hh A')).toEqual(now);
+});
+
+test('YYYY-M-D hh A', () => {
+ expect(Number.isNaN(parse('2015-0-0 12 AM', 'YYYY-M-D hh A').getTime())).toBe(true);
+});
+
+test('YYYY-M-D h A', () => {
+ const now = new Date(2015, 0, 1, 0);
+ expect(parse('2015-1-1 12 AM', 'YYYY-M-D h A')).toEqual(now);
+});
+
+test('YYYY-M-D h A', () => {
+ const now = new Date(2015, 11, 31, 23);
+ expect(parse('2015-12-31 11 PM', 'YYYY-M-D h A')).toEqual(now);
+});
+
+test('YYYY-M-D h A', () => {
+ expect(Number.isNaN(parse('2015-0-0 12 AM', 'YYYY-M-D h A').getTime())).toBe(true);
+});
+
+test('YYYY-MM-DD HH:mm', () => {
+ const now = new Date(2015, 0, 1, 0, 0);
+ expect(parse('2015-01-01 00:00', 'YYYY-MM-DD HH:mm')).toEqual(now);
+});
+
+test('YYYY-MM-DD HH:mm', () => {
+ const now = new Date(2015, 11, 31, 23, 59);
+ expect(parse('2015-12-31 23:59', 'YYYY-MM-DD HH:mm')).toEqual(now);
+});
+
+test('YYYY-MM-DD HH:mm', () => {
+ expect(Number.isNaN(parse('2015-00-00 24:60', 'YYYY-MM-DD HH:mm').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m', () => {
+ const now = new Date(2015, 0, 1, 0, 0);
+ expect(parse('2015-1-1 0:0', 'YYYY-M-D H:m')).toEqual(now);
+});
+
+test('YYYY-M-D H:m', () => {
+ const now = new Date(2015, 11, 31, 23, 59);
+ expect(parse('2015-12-31 23:59', 'YYYY-M-D H:m')).toEqual(now);
+});
+
+test('YYYY-M-D H:m', () => {
+ expect(Number.isNaN(parse('2015-0-0 24:60', 'YYYY-M-D H:m').getTime())).toBe(true);
+});
+
+test('YYYY-MM-DD HH:mm:ss', () => {
+ const now = new Date(2015, 0, 1, 0, 0, 0);
+ expect(parse('2015-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss')).toEqual(now);
+});
+
+test('YYYY-MM-DD HH:mm:ss', () => {
+ const now = new Date(2015, 11, 31, 23, 59, 59);
+ expect(parse('2015-12-31 23:59:59', 'YYYY-MM-DD HH:mm:ss')).toEqual(now);
+});
+
+test('YYYY-MM-DD HH:mm:ss', () => {
+ expect(Number.isNaN(parse('2015-00-00 24:60:60', 'YYYY-MM-DD HH:mm:ss').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m:s', () => {
+ const now = new Date(2015, 0, 1, 0, 0);
+ expect(parse('2015-1-1 0:0:0', 'YYYY-M-D H:m:s')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s', () => {
+ const now = new Date(2015, 11, 31, 23, 59, 59);
+ expect(parse('2015-12-31 23:59:59', 'YYYY-M-D H:m:s')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s', () => {
+ expect(Number.isNaN(parse('2015-0-0 24:60:60', 'YYYY-M-D H:m:s').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m:s.SSS', () => {
+ const now = new Date(2015, 0, 1, 0, 0, 0);
+ expect(parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SSS')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS', () => {
+ const now = new Date(2015, 11, 31, 23, 59, 59, 999);
+ expect(parse('2015-12-31 23:59:59.999', 'YYYY-M-D H:m:s.SSS')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS', () => {
+ expect(Number.isNaN(parse('2015-0-0 24:60:61.000', 'YYYY-M-D H:m:s.SSS').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m:s.SS', () => {
+ const now = new Date(2015, 0, 1, 0, 0, 0);
+ expect(parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.SS')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SS', () => {
+ const now = new Date(2015, 11, 31, 23, 59, 59, 990);
+ expect(parse('2015-12-31 23:59:59.99', 'YYYY-M-D H:m:s.SS')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SS', () => {
+ expect(Number.isNaN(parse('2015-0-0 24:60:61.00', 'YYYY-M-D H:m:s.SS').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m:s.S', () => {
+ const now = new Date(2015, 0, 1, 0, 0, 0);
+ expect(parse('2015-1-1 0:0:0.0', 'YYYY-M-D H:m:s.S')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.S', () => {
+ const now = new Date(2015, 11, 31, 23, 59, 59, 900);
+ expect(parse('2015-12-31 23:59:59.9', 'YYYY-M-D H:m:s.S')).toEqual(now);
+});
+
+test('YYYY M D H m s S', () => {
+ const now = new Date(2015, 11, 31, 23, 59, 59, 900);
+ expect(parse('2015-12-31 23:59:59.9', 'YYYY M D H m s S')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.S', () => {
+ expect(Number.isNaN(parse('2015-0-0 24:60:61.0', 'YYYY-M-D H:m:s.S').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m:s.SSS Z', () => {
+ const now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
+ expect(parse('2015-1-1 0:0:0.0 +0000', 'YYYY-M-D H:m:s.SSS Z')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS Z', () => {
+ const now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
+ expect(parse('2015-12-31 23:00:59.999 -0059', 'YYYY-M-D H:m:s.SSS Z')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS Z', () => {
+ const now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
+ expect(parse('2015-12-31 09:59:59.999 -1200', 'YYYY-M-D H:m:s.SSS Z')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS Z', () => {
+ expect(Number.isNaN(parse('2015-12-31 09:58:59.999 -1201', 'YYYY-M-D H:m:s.SSS Z').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m:s.SSS Z', () => {
+ const now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
+ expect(parse('2015-12-31 12:00:59.999 +1400', 'YYYY-M-D H:m:s.SSS Z')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS Z', () => {
+ expect(Number.isNaN(parse('2015-12-31 12:01:59.999 +1401', 'YYYY-M-D H:m:s.SSS Z').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m:s.SSS ZZ', () => {
+ const now = new Date(Date.UTC(2015, 0, 1, 0, 0, 0));
+ expect(parse('2015-1-1 0:0:0.0 +00:00', 'YYYY-M-D H:m:s.SSS ZZ')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS ZZ', () => {
+ const now = new Date(Date.UTC(2015, 11, 31, 23, 59, 59, 999));
+ expect(parse('2015-12-31 23:00:59.999 -00:59', 'YYYY-M-D H:m:s.SSS ZZ')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS ZZ', () => {
+ const now = new Date(Date.UTC(2015, 11, 31, 21, 59, 59, 999));
+ expect(parse('2015-12-31 09:59:59.999 -12:00', 'YYYY-M-D H:m:s.SSS ZZ')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS ZZ', () => {
+ expect(Number.isNaN(parse('2015-12-31 09:58:59.999 -12:01', 'YYYY-M-D H:m:s.SSS ZZ').getTime())).toBe(true);
+});
+
+test('YYYY-M-D H:m:s.SSS ZZ', () => {
+ const now = new Date(Date.UTC(2015, 11, 30, 22, 0, 59, 999));
+ expect(parse('2015-12-31 12:00:59.999 +14:00', 'YYYY-M-D H:m:s.SSS ZZ')).toEqual(now);
+});
+
+test('YYYY-M-D H:m:s.SSS ZZ', () => {
+ expect(Number.isNaN(parse('2015-12-31 12:01:59.999 +14:01', 'YYYY-M-D H:m:s.SSS ZZ').getTime())).toBe(true);
+});
+
+test('MMDDHHmmssSSS', () => {
+ const now = new Date(1970, 11, 31, 23, 59, 59, 999);
+ expect(parse('1231235959999', 'MMDDHHmmssSSS')).toEqual(now);
+});
+
+test('DDHHmmssSSS', () => {
+ const now = new Date(1970, 0, 31, 23, 59, 59, 999);
+ expect(parse('31235959999', 'DDHHmmssSSS')).toEqual(now);
+});
+
+test('HHmmssSSS', () => {
+ const now = new Date(1970, 0, 1, 23, 59, 59, 999);
+ expect(parse('235959999', 'HHmmssSSS')).toEqual(now);
+});
+
+test('mmssSSS', () => {
+ const now = new Date(1970, 0, 1, 0, 59, 59, 999);
+ expect(parse('5959999', 'mmssSSS')).toEqual(now);
+});
+
+test('ssSSS', () => {
+ const now = new Date(1970, 0, 1, 0, 0, 59, 999);
+ expect(parse('59999', 'ssSSS')).toEqual(now);
+});
+
+test('SSS', () => {
+ const now = new Date(1970, 0, 1, 0, 0, 0, 999);
+ expect(parse('999', 'SSS')).toEqual(now);
+});
+
+test('Z', () => {
+ expect(Number.isNaN(parse('+000', 'Z').getTime())).toBe(true);
+});
+
+test('Z', () => {
+ expect(Number.isNaN(parse('+00', 'Z').getTime())).toBe(true);
+});
+
+test('Z', () => {
+ expect(Number.isNaN(parse('+0', 'Z').getTime())).toBe(true);
+});
+
+test('Z', () => {
+ expect(Number.isNaN(parse('0', 'Z').getTime())).toBe(true);
+});
+
+test('Z', () => {
+ expect(Number.isNaN(parse('0000', 'Z').getTime())).toBe(true);
+});
+
+test('Z', () => {
+ expect(Number.isNaN(parse('00000', 'Z').getTime())).toBe(true);
+});
+
+test('ZZ', () => {
+ expect(Number.isNaN(parse('+00:0', 'ZZ').getTime())).toBe(true);
+});
+
+test('ZZ', () => {
+ expect(Number.isNaN(parse('+00:', 'ZZ').getTime())).toBe(true);
+});
+
+test('ZZ', () => {
+ expect(Number.isNaN(parse('+0:', 'ZZ').getTime())).toBe(true);
+});
+
+test('ZZ', () => {
+ expect(Number.isNaN(parse('0:', 'ZZ').getTime())).toBe(true);
+});
+
+test('ZZ', () => {
+ expect(Number.isNaN(parse('00:00', 'ZZ').getTime())).toBe(true);
+});
+
+test('ZZ', () => {
+ expect(Number.isNaN(parse('00:000', 'ZZ').getTime())).toBe(true);
+});
+
+test('foo', () => {
+ expect(Number.isNaN(parse('20150101235959', 'foo').getTime())).toBe(true);
+});
+
+test('bar', () => {
+ expect(Number.isNaN(parse('20150101235959', 'bar').getTime())).toBe(true);
+});
+
+test('YYYYMMDD', () => {
+ expect(Number.isNaN(parse('20150101235959', 'YYYYMMDD').getTime())).toBe(true);
+});
+
+test('20150101235959', () => {
+ expect(Number.isNaN(parse('20150101235959', '20150101235959').getTime())).toBe(true);
+});
+
+test('YYYY?M?D H?m?s?S', () => {
+ expect(Number.isNaN(parse('2015-12-31 23:59:59.9', 'YYYY?M?D H?m?s?S').getTime())).toBe(true);
+});
+
+test('[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S', () => {
+ const now = new Date(2015, 11, 31, 23, 59, 59, 900);
+ expect(parse('Y2015M12D31H23m59s59S9', '[Y]YYYY[M]M[D]D[H]H[m]m[s]s[S]S')).toEqual(now);
+});
+
+test('[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]', () => {
+ expect(Number.isNaN(parse('[Y]2015[M]12[D]31[H]23[m]59[s]59[S]9', '[[Y]YYYY[M]MM[D]DD[H]HH[m]mm[s]ss[S]S]').getTime())).toBe(true);
+});
+
+test(' ', () => {
+ expect(Number.isNaN(parse('20151231235959900', ' ').getTime())).toBe(true);
+});
+
+describe('options', () => {
+ test('hour12: h11', () => {
+ expect(parse('2000-01-01 00:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toEqual(new Date(2000, 0, 1, 0, 0));
+ expect(parse('2000-01-01 11:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toEqual(new Date(2000, 0, 1, 11, 0));
+ expect(parse('2000-01-01 00:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toEqual(new Date(2000, 0, 1, 12, 0));
+ expect(parse('2000-01-01 11:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toEqual(new Date(2000, 0, 1, 23, 0));
+
+ expect(Number.isNaN(parse('2000-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' }).getTime())).toBe(true);
+ expect(Number.isNaN(parse('2000-01-01 12:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' }).getTime())).toBe(true);
+ });
+
+ test('hour12: h12', () => {
+ expect(parse('2000-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toEqual(new Date(2000, 0, 1, 0, 0));
+ expect(parse('2000-01-01 11:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toEqual(new Date(2000, 0, 1, 11, 0));
+ expect(parse('2000-01-01 12:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toEqual(new Date(2000, 0, 1, 12, 0));
+ expect(parse('2000-01-01 11:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toEqual(new Date(2000, 0, 1, 23, 0));
+
+ expect(Number.isNaN(parse('2000-01-01 00:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' }).getTime())).toBe(true);
+ expect(Number.isNaN(parse('2000-01-01 00:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' }).getTime())).toBe(true);
+ });
+
+ test('ignoreCase: true', () => {
+ expect(parse('2025 May 4 Sunday 11 AM', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toEqual(new Date(2025, 4, 4, 11, 0));
+ expect(parse('2025 may 4 sunday 11 am', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toEqual(new Date(2025, 4, 4, 11, 0));
+ expect(parse('2025 MAY 4 SUNDAY 11 AM', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toEqual(new Date(2025, 4, 4, 11, 0));
+ });
+
+ test('calendar: buddhist', () => {
+ expect(parse('2000-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toEqual(new Date(2000 - 543, 0, 1, 0, 0));
+ expect(parse('9999-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toEqual(new Date(9999 - 543, 0, 1, 0, 0));
+ expect(parse('0544-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toEqual(new Date(544 - 543, -1900 * 12, 1, 0, 0));
+
+ expect(Number.isNaN(parse('0543-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' }).getTime())).toBe(true);
+ });
+
+ test('timeZone', () => {
+ const now = new Date(Date.UTC(2025, 1 - 1, 1, 0));
+ expect(parse('2024-12-31 16:00:00', 'YYYY-MM-DD HH:mm:ss', { timeZone: Los_Angeles })).toEqual(now);
+ expect(parse('2025-01-01 09:00:00', 'YYYY-MM-DD HH:mm:ss', { timeZone: Tokyo })).toEqual(now);
+ expect(parse('2025-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss', { timeZone: 'UTC' })).toEqual(now);
+
+ const dummyTimeZone = {
+ zone_name: Los_Angeles.zone_name,
+ gmt_offset: [0]
+ };
+
+ expect(Number.isNaN(parse('2025-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss', { timeZone: dummyTimeZone }).getTime())).toBe(true);
+ });
+});
+
+describe('timeZone Los_Angeles', () => {
+ test('before DST', () => {
+ const now = new Date('2021-03-14T09:59:59.999Z');
+ expect(parse('2021-03-14 01:59:59.999', 'YYYY-MM-DD HH:mm:ss.SSS', { timeZone: Los_Angeles })).toEqual(now);
+ });
+
+ test('start DST 1', () => {
+ const now = new Date('2021-03-14T10:00:00.000Z');
+ expect(parse('2021-03-14 02:00:00.000', 'YYYY-MM-DD HH:mm:ss.SSS', { timeZone: Los_Angeles })).toEqual(now);
+ });
+
+ test('start DST 2', () => {
+ const now = new Date('2021-03-14T10:00:00.000Z');
+ expect(parse('2021-03-14 03:00:00.000', 'YYYY-MM-DD HH:mm:ss.SSS', { timeZone: Los_Angeles })).toEqual(now);
+ });
+
+ test('before of PST', () => {
+ const now = new Date('2021-11-07T08:59:59.999Z');
+ expect(parse('2021-11-07 01:59:59.999', 'YYYY-MM-DD HH:mm:ss.SSS', { timeZone: Los_Angeles })).toEqual(now);
+ });
+
+ test('end of DST', () => {
+ const now = new Date('2021-11-07T10:00:00.000Z');
+ expect(parse('2021-11-07 02:00:00.000', 'YYYY-MM-DD HH:mm:ss.SSS', { timeZone: Los_Angeles })).toEqual(now);
+ });
+
+ test('after of DST', () => {
+ const now = new Date('2021-11-07T11:00:00.000Z');
+ expect(parse('2021-11-07 03:00:00.000', 'YYYY-MM-DD HH:mm:ss.SSS', { timeZone: Los_Angeles })).toEqual(now);
+ });
+});
+
+describe('timeZone Adelaide', () => {
+ test('before of DST', () => {
+ // Oct 3 2021 1:59:59.999 => 2021-10-02T16:29:59.999Z
+ const dateString = 'Oct 3 2021 1:59:59.999';
+ const formatString = 'MMM D YYYY H:mm:ss.SSS';
+ const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 29, 59, 999));
+
+ expect(parse(dateString, formatString, { timeZone: Adelaide }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('start of DST 1', () => {
+ // Oct 3 2021 2:00:00.000 => 2021-10-02T16:30:00.000Z
+ const dateString = 'Oct 3 2021 2:00:00.000';
+ const formatString = 'MMM D YYYY H:mm:ss.SSS';
+ const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
+
+ expect(parse(dateString, formatString, { timeZone: Adelaide }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('start of DST 2', () => {
+ // Oct 3 2021 2:59:59.999 => 2021-10-02T17:29:59.999Z
+ const dateString = 'Oct 3 2021 2:59:59.999';
+ const formatString = 'MMM D YYYY H:mm:ss.SSS';
+ const dateObj = new Date(Date.UTC(2021, 9, 2, 17, 29, 59, 999));
+
+ expect(parse(dateString, formatString, { timeZone: Adelaide }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('start of DST 3', () => {
+ // Oct 3 2021 3:00:00.000 => 2021-10-02T16:30:00.000Z
+ const dateString = 'Oct 3 2021 3:00:00.000';
+ const formatString = 'MMM D YYYY H:mm:ss.SSS';
+ const dateObj = new Date(Date.UTC(2021, 9, 2, 16, 30, 0, 0));
+
+ expect(parse(dateString, formatString, { timeZone: Adelaide }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('end of DST', () => {
+ // Apr 4 2021 2:59:59.999 => 2021-04-03T16:29:59.999Z
+ const dateString = 'Apr 4 2021 2:59:59.999';
+ const formatString = 'MMM D YYYY H:mm:ss.SSS';
+ const dateObj = new Date(Date.UTC(2021, 3, 3, 16, 29, 59, 999));
+
+ expect(parse(dateString, formatString, { timeZone: Adelaide }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('after DST', () => {
+ // Apr 4 2021 3:00:00.000 => 2021-04-03T17:30:00.000Z
+ const dateString = 'Apr 4 2021 3:00:00.000';
+ const formatString = 'MMM D YYYY H:mm:ss.SSS';
+ const dateObj = new Date(Date.UTC(2021, 3, 3, 17, 30, 0, 0));
+
+ expect(parse(dateString, formatString, { timeZone: Adelaide }).getTime()).toBe(dateObj.getTime());
+ });
+});
+
+describe('timeZone Apia', () => {
+ beforeAll(() => (process.env.TZ = 'Pacific/Apia'));
+
+ test('1.1', () => {
+ const dateString = '04 July, 1892 11:59:59 PM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(1892, 7 - 1, 4, 23, 59, 59);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('1.2', () => {
+ const dateString = '04 July, 1892 12:00:00 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(1892, 7 - 1, 4, 0, 0, 0);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('2.1', () => {
+ const dateString = '31 December, 1910 11:59:59 PM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(1910, 12 - 1, 31, 23, 59, 59);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('2.2', () => {
+ const dateString = '31 December, 1910 11:56:56 PM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(1910, 12 - 1, 31, 23, 56, 56);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('3.1', () => {
+ const dateString = '31 December, 1949 11:59:59 PM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(1949, 12 - 1, 31, 23, 59, 59);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('3.2', () => {
+ const dateString = '01 January, 1950 12:30:00 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(1950, 1 - 1, 1, 0, 30, 0);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('4.1', () => {
+ const dateString = '25 September, 2010 11:59:59 PM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2010, 9 - 1, 25, 23, 59, 59);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('4.2', () => {
+ const dateString = '26 September, 2010 01:00:00 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2010, 9 - 1, 26, 1, 0, 0);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('5.1', () => {
+ const dateString = '02 April, 2011 03:59:59 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2011, 4 - 1, 2, 3, 59, 59);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('5.2', () => {
+ const dateString = '02 April, 2011 03:00:00 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2011, 4 - 1, 2, 3, 0, 0);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('6.1', () => {
+ const dateString = '24 September, 2011 02:59:59 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2011, 9 - 1, 24, 2, 59, 59);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('6.2', () => {
+ const dateString = '24 September, 2011 04:00:00 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2011, 9 - 1, 24, 4, 0, 0);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('7.1', () => {
+ const dateString = '29 December, 2011 11:59:59 PM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2011, 12 - 1, 29, 23, 59, 59);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('7.2', () => {
+ const dateString = '31 December, 2011 12:00:00 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2011, 12 - 1, 31, 0, 0, 0);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('8.1', () => {
+ const dateString = '01 April, 2012 03:59:59 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2012, 4 - 1, 1, 3, 59, 59);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+
+ test('8.2', () => {
+ const dateString = '01 April, 2012 03:00:00 AM';
+ const formatString = 'DD MMMM, YYYY hh:mm:ss A';
+ const dateObj = new Date(2012, 4 - 1, 1, 3, 0, 0);
+
+ expect(parse(dateString, formatString, { timeZone: Apia }).getTime()).toBe(dateObj.getTime());
+ });
+});
diff --git a/tests/plugins/microsecond.spec.ts b/tests/plugins/microsecond.spec.ts
new file mode 100644
index 0000000..1a9d7ef
--- /dev/null
+++ b/tests/plugins/microsecond.spec.ts
@@ -0,0 +1,37 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { parse } from '../../src/index.ts';
+import { parser as microsecond } from '../../src/plugins/microsecond.ts';
+
+beforeAll(() => (process.env.TZ = 'UTC'));
+
+describe('plugins', () => {
+ test('SSSS', () => {
+ expect(parse('12:34:56 0000', 'HH:mm:ss SSSS', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 9999', 'HH:mm:ss SSSS', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('SSSSS', () => {
+ expect(parse('12:34:56 00000', 'HH:mm:ss SSSSS', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 99999', 'HH:mm:ss SSSSS', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('SSSSSS', () => {
+ expect(parse('12:34:56 000000', 'HH:mm:ss SSSSSS', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 999999', 'HH:mm:ss SSSSSS', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('f', () => {
+ expect(parse('12:34:56 000.0', 'HH:mm:ss SSS.f', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 999.9', 'HH:mm:ss SSS.f', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('ff', () => {
+ expect(parse('12:34:56 000.00', 'HH:mm:ss SSS.ff', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 999.99', 'HH:mm:ss SSS.ff', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('fff', () => {
+ expect(parse('12:34:56 000.000', 'HH:mm:ss SSS.fff', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 999.999', 'HH:mm:ss SSS.fff', { plugins: [microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+});
diff --git a/tests/plugins/nanosecond.spec.ts b/tests/plugins/nanosecond.spec.ts
new file mode 100644
index 0000000..ca948b5
--- /dev/null
+++ b/tests/plugins/nanosecond.spec.ts
@@ -0,0 +1,38 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { parse } from '../../src/index.ts';
+import { parser as nanosecond } from '../../src/plugins/nanosecond.ts';
+import { parser as microsecond } from '../../src/plugins/microsecond.ts';
+
+beforeAll(() => (process.env.TZ = 'UTC'));
+
+describe('plugins', () => {
+ test('SSSSSSS', () => {
+ expect(parse('12:34:56 0000000', 'HH:mm:ss SSSSSSS', { plugins: [nanosecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 9999999', 'HH:mm:ss SSSSSSS', { plugins: [nanosecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('SSSSSSSS', () => {
+ expect(parse('12:34:56 00000000', 'HH:mm:ss SSSSSSSS', { plugins: [nanosecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 99999999', 'HH:mm:ss SSSSSSSS', { plugins: [nanosecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('SSSSSSSSS', () => {
+ expect(parse('12:34:56 000000000', 'HH:mm:ss SSSSSSSSS', { plugins: [nanosecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 999999999', 'HH:mm:ss SSSSSSSSS', { plugins: [nanosecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('F', () => {
+ expect(parse('12:34:56 000000.0', 'HH:mm:ss SSSSSS.F', { plugins: [nanosecond, microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 999999.9', 'HH:mm:ss SSSSSS.F', { plugins: [nanosecond, microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('FF', () => {
+ expect(parse('12:34:56 000000.00', 'HH:mm:ss SSSSSS.FF', { plugins: [nanosecond, microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 999999.99', 'HH:mm:ss SSSSSS.FF', { plugins: [nanosecond, microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+
+ test('FFF', () => {
+ expect(parse('12:34:56 000000.000', 'HH:mm:ss SSSSSS.FFF', { plugins: [nanosecond, microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 0));
+ expect(parse('12:34:56 999999.999', 'HH:mm:ss SSSSSS.FFF', { plugins: [nanosecond, microsecond] })).toEqual(new Date(1970, 1 - 1, 1, 12, 34, 56, 999));
+ });
+});
diff --git a/tests/plugins/ordinal.spec.ts b/tests/plugins/ordinal.spec.ts
new file mode 100644
index 0000000..1148860
--- /dev/null
+++ b/tests/plugins/ordinal.spec.ts
@@ -0,0 +1,59 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { format, parse } from '../../src/index.ts';
+import { formatter, parser } from '../../src/plugins/ordinal.ts';
+
+beforeAll(() => (process.env.TZ = 'UTC'));
+
+describe('plugins', () => {
+ describe('formatter', () => {
+ test('DDD', () => {
+ expect(format(new Date(2025, 1 - 1, 1, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 1st, 2025');
+ expect(format(new Date(2025, 1 - 1, 2, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 2nd, 2025');
+ expect(format(new Date(2025, 1 - 1, 3, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 3rd, 2025');
+
+ expect(format(new Date(2025, 1 - 1, 11, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 11th, 2025');
+ expect(format(new Date(2025, 1 - 1, 12, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 12th, 2025');
+ expect(format(new Date(2025, 1 - 1, 13, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 13th, 2025');
+
+ expect(format(new Date(2025, 1 - 1, 21, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 21st, 2025');
+ expect(format(new Date(2025, 1 - 1, 22, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 22nd, 2025');
+ expect(format(new Date(2025, 1 - 1, 23, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 23rd, 2025');
+
+ expect(format(new Date(2025, 1 - 1, 31, 0), 'MMMM DDD, YYYY', { plugins: [formatter] })).toBe('January 31st, 2025');
+ });
+ });
+
+ describe('parser', () => {
+ test('DDD', () => {
+ expect(parse('January 1st, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 1));
+ expect(parse('January 2nd, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 2));
+ expect(parse('January 3rd, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 3));
+
+ expect(parse('January 11th, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 11));
+ expect(parse('January 12th, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 12));
+ expect(parse('January 13th, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 13));
+
+ expect(parse('January 21st, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 21));
+ expect(parse('January 22nd, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 22));
+ expect(parse('January 23rd, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 23));
+
+ expect(parse('January 31st, 2025', 'MMMM DDD, YYYY', { plugins: [parser] })).toEqual(new Date(2025, 0, 31));
+ });
+
+ test('DDD ignoreCase', () => {
+ expect(parse('JANUARY 1ST, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 1));
+ expect(parse('JANUARY 2ND, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 2));
+ expect(parse('JANUARY 3RD, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 3));
+
+ expect(parse('JANUARY 11TH, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 11));
+ expect(parse('JANUARY 12TH, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 12));
+ expect(parse('JANUARY 13TH, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 13));
+
+ expect(parse('JANUARY 21ST, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 21));
+ expect(parse('JANUARY 22ND, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 22));
+ expect(parse('JANUARY 23RD, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 23));
+
+ expect(parse('JANUARY 31ST, 2025', 'MMMM DDD, YYYY', { plugins: [parser], ignoreCase: true })).toEqual(new Date(2025, 0, 31));
+ });
+ });
+});
diff --git a/tests/plugins/two-digit-year.spec.ts b/tests/plugins/two-digit-year.spec.ts
new file mode 100644
index 0000000..8a10255
--- /dev/null
+++ b/tests/plugins/two-digit-year.spec.ts
@@ -0,0 +1,21 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { parse } from '../../src/index.ts';
+import { parser as year } from '../../src/plugins/two-digit-year.ts';
+
+beforeAll(() => (process.env.TZ = 'UTC'));
+
+describe('plugins', () => {
+ test('YY gregory', () => {
+ expect(parse('00-05-05', 'YY-MM-DD', { plugins: [year] })).toEqual(new Date(2000, 5 - 1, 5));
+ expect(parse('69-05-05', 'YY-MM-DD', { plugins: [year] })).toEqual(new Date(2069, 5 - 1, 5));
+ expect(parse('70-05-05', 'YY-MM-DD', { plugins: [year] })).toEqual(new Date(1970, 5 - 1, 5));
+ expect(parse('99-05-05', 'YY-MM-DD', { plugins: [year] })).toEqual(new Date(1999, 5 - 1, 5));
+ });
+
+ test('YY buddhist', () => {
+ expect(parse('00-05-05', 'YY-MM-DD', { plugins: [year], calendar: 'buddhist' })).toEqual(new Date(2600 - 543, 5 - 1, 5));
+ expect(parse('12-05-05', 'YY-MM-DD', { plugins: [year], calendar: 'buddhist' })).toEqual(new Date(2612 - 543, 5 - 1, 5));
+ expect(parse('13-05-05', 'YY-MM-DD', { plugins: [year], calendar: 'buddhist' })).toEqual(new Date(2513 - 543, 5 - 1, 5));
+ expect(parse('99-05-05', 'YY-MM-DD', { plugins: [year], calendar: 'buddhist' })).toEqual(new Date(2599 - 543, 5 - 1, 5));
+ });
+});
diff --git a/tests/plugins/zonename.spec.ts b/tests/plugins/zonename.spec.ts
new file mode 100644
index 0000000..de4688e
--- /dev/null
+++ b/tests/plugins/zonename.spec.ts
@@ -0,0 +1,27 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { format } from '../../src/index.ts';
+import { formatter as zonename } from '../../src/plugins/zonename.ts';
+import Los_Angeles from '../../src/timezones/America/Los_Angeles.ts';
+import Tokyo from '../../src/timezones/Asia/Tokyo.ts';
+
+beforeAll(() => (process.env.TZ = 'UTC'));
+
+describe('plugins', () => {
+ test('z', () => {
+ const now = new Date(2025, 1 - 1, 1, 0);
+
+ expect(format(now, 'z', { plugins: [zonename] })).toBe('UTC');
+ expect(format(now, 'z', { plugins: [zonename], timeZone: 'UTC' })).toBe('UTC');
+ expect(format(now, 'z', { plugins: [zonename], timeZone: Los_Angeles })).toBe('PST');
+ expect(format(now, 'z', { plugins: [zonename], timeZone: Tokyo })).toBe('JST');
+ });
+
+ test('zz', () => {
+ const now = new Date(2025, 1 - 1, 1, 0);
+
+ expect(format(now, 'zz', { plugins: [zonename] })).toBe('Coordinated Universal Time');
+ expect(format(now, 'zz', { plugins: [zonename], timeZone: 'UTC' })).toBe('Coordinated Universal Time');
+ expect(format(now, 'zz', { plugins: [zonename], timeZone: Los_Angeles })).toBe('Pacific Standard Time');
+ expect(format(now, 'zz', { plugins: [zonename], timeZone: Tokyo })).toBe('Japan Standard Time');
+ });
+});
diff --git a/tests/preparse.spec.ts b/tests/preparse.spec.ts
new file mode 100644
index 0000000..1303fb2
--- /dev/null
+++ b/tests/preparse.spec.ts
@@ -0,0 +1,597 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { preparse } from '../src/index.ts';
+import { parser } from '../src/plugins/day-of-week.ts';
+
+beforeAll(() => (process.env.TZ = 'UTC'));
+
+describe('YYYY', () => {
+ test('0000', () => {
+ const dt = { Y: 0, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('0000', 'YYYY')).toEqual(dt);
+ });
+
+ test('0001', () => {
+ const dt = { Y: 1, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('0001', 'YYYY')).toEqual(dt);
+ });
+
+ test('0099', () => {
+ const dt = { Y: 99, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('0099', 'YYYY')).toEqual(dt);
+ });
+
+ test('0100', () => {
+ const dt = { Y: 100, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('0100', 'YYYY')).toEqual(dt);
+ });
+
+ test('1899', () => {
+ const dt = { Y: 1899, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1899', 'YYYY')).toEqual(dt);
+ });
+
+ test('1900', () => {
+ const dt = { Y: 1900, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1900', 'YYYY')).toEqual(dt);
+ });
+
+ test('1969', () => {
+ const dt = { Y: 1969, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1969', 'YYYY')).toEqual(dt);
+ });
+
+ test('1970', () => {
+ const dt = { Y: 1970, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1970', 'YYYY')).toEqual(dt);
+ });
+
+ test('1999', () => {
+ const dt = { Y: 1999, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1999', 'YYYY')).toEqual(dt);
+ });
+
+ test('2000', () => {
+ const dt = { Y: 2000, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('2000', 'YYYY')).toEqual(dt);
+ });
+
+ test('9999', () => {
+ const dt = { Y: 9999, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('9999', 'YYYY')).toEqual(dt);
+ });
+});
+
+describe('Y', () => {
+ test('0', () => {
+ const dt = { Y: 0, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('0', 'Y')).toEqual(dt);
+ });
+
+ test('1', () => {
+ const dt = { Y: 1, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('1', 'Y')).toEqual(dt);
+ });
+
+ test('99', () => {
+ const dt = { Y: 99, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('99', 'Y')).toEqual(dt);
+ });
+
+ test('100', () => {
+ const dt = { Y: 100, _index: 3, _length: 3, _match: 1 };
+ expect(preparse('100', 'Y')).toEqual(dt);
+ });
+
+ test('1899', () => {
+ const dt = { Y: 1899, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1899', 'Y')).toEqual(dt);
+ });
+
+ test('1900', () => {
+ const dt = { Y: 1900, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1900', 'Y')).toEqual(dt);
+ });
+
+ test('1969', () => {
+ const dt = { Y: 1969, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1969', 'Y')).toEqual(dt);
+ });
+
+ test('1970', () => {
+ const dt = { Y: 1970, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1970', 'Y')).toEqual(dt);
+ });
+
+ test('1999', () => {
+ const dt = { Y: 1999, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('1999', 'Y')).toEqual(dt);
+ });
+
+ test('2000', () => {
+ const dt = { Y: 2000, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('2000', 'Y')).toEqual(dt);
+ });
+
+ test('9999', () => {
+ const dt = { Y: 9999, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('9999', 'Y')).toEqual(dt);
+ });
+});
+
+describe('MMMM', () => {
+ test('January', () => {
+ const dt = { M: 1, _index: 7, _length: 7, _match: 1 };
+ expect(preparse('January', 'MMMM')).toEqual(dt);
+ });
+
+ test('December', () => {
+ const dt = { M: 12, _index: 8, _length: 8, _match: 1 };
+ expect(preparse('December', 'MMMM')).toEqual(dt);
+ });
+
+ test('Zero', () => {
+ const dt = { _index: 0, _length: 4, _match: 0 };
+ expect(preparse('Zero', 'MMMM')).toEqual(dt);
+ });
+});
+
+describe('MMM', () => {
+ test('January', () => {
+ const dt = { M: 1, _index: 3, _length: 3, _match: 1 };
+ expect(preparse('Jan', 'MMM')).toEqual(dt);
+ });
+
+ test('December', () => {
+ const dt = { M: 12, _index: 3, _length: 3, _match: 1 };
+ expect(preparse('Dec', 'MMM')).toEqual(dt);
+ });
+
+ test('Zero', () => {
+ const dt = { _index: 0, _length: 4, _match: 0 };
+ expect(preparse('Zero', 'MMM')).toEqual(dt);
+ });
+});
+
+describe('MM', () => {
+ test('01', () => {
+ const dt = { M: 1, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('01', 'MM')).toEqual(dt);
+ });
+
+ test('12', () => {
+ const dt = { M: 12, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('12', 'MM')).toEqual(dt);
+ });
+
+ test('00', () => {
+ const dt = { M: 0, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('00', 'MM')).toEqual(dt);
+ });
+});
+
+describe('M', () => {
+ test('1', () => {
+ const dt = { M: 1, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('1', 'M')).toEqual(dt);
+ });
+
+ test('12', () => {
+ const dt = { M: 12, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('12', 'M')).toEqual(dt);
+ });
+
+ test('0', () => {
+ const dt = { M: 0, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('0', 'M')).toEqual(dt);
+ });
+});
+
+describe('DD', () => {
+ test('01', () => {
+ const dt = { D: 1, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('01', 'DD')).toEqual(dt);
+ });
+
+ test('31', () => {
+ const dt = { D: 31, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('31', 'DD')).toEqual(dt);
+ });
+
+ test('00', () => {
+ const dt = { D: 0, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('00', 'DD')).toEqual(dt);
+ });
+});
+
+describe('D', () => {
+ test('1', () => {
+ const dt = { D: 1, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('1', 'D')).toEqual(dt);
+ });
+
+ test('31', () => {
+ const dt = { D: 31, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('31', 'D')).toEqual(dt);
+ });
+
+ test('0', () => {
+ const dt = { D: 0, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('0', 'D')).toEqual(dt);
+ });
+});
+
+describe('HH', () => {
+ test('00', () => {
+ const dt = { H: 0, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('00', 'HH')).toEqual(dt);
+ });
+
+ test('23', () => {
+ const dt = { H: 23, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('23', 'HH')).toEqual(dt);
+ });
+
+ test('24', () => {
+ const dt = { H: 24, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('24', 'HH')).toEqual(dt);
+ });
+});
+
+describe('H', () => {
+ test('0', () => {
+ const dt = { H: 0, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('0', 'H')).toEqual(dt);
+ });
+
+ test('23', () => {
+ const dt = { H: 23, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('23', 'H')).toEqual(dt);
+ });
+
+ test('24', () => {
+ const dt = { H: 24, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('24', 'H')).toEqual(dt);
+ });
+});
+
+describe('hh', () => {
+ test('00', () => {
+ const dt = { h: 0, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('00', 'hh')).toEqual(dt);
+ });
+
+ test('11', () => {
+ const dt = { h: 11, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('11', 'hh')).toEqual(dt);
+ });
+
+ test('12', () => {
+ const dt = { h: 12, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('12', 'hh')).toEqual(dt);
+ });
+});
+
+describe('h', () => {
+ test('0', () => {
+ const dt = { h: 0, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('0', 'h')).toEqual(dt);
+ });
+
+ test('11', () => {
+ const dt = { h: 11, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('11', 'h')).toEqual(dt);
+ });
+
+ test('12', () => {
+ const dt = { h: 12, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('12', 'h')).toEqual(dt);
+ });
+});
+
+describe('AA', () => {
+ test('A.M.', () => {
+ const dt = { A: 0, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('A.M.', 'AA')).toEqual(dt);
+ });
+
+ test('P.M.', () => {
+ const dt = { A: 1, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('P.M.', 'AA')).toEqual(dt);
+ });
+
+ test('M.M.', () => {
+ const dt = { _index: 0, _length: 4, _match: 0 };
+ expect(preparse('M.M.', 'AA')).toEqual(dt);
+ });
+});
+
+describe('A', () => {
+ test('AM', () => {
+ const dt = { A: 0, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('AM', 'A')).toEqual(dt);
+ });
+
+ test('PM', () => {
+ const dt = { A: 1, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('PM', 'A')).toEqual(dt);
+ });
+
+ test('MM', () => {
+ const dt = { _index: 0, _length: 2, _match: 0 };
+ expect(preparse('MM', 'A')).toEqual(dt);
+ });
+});
+
+describe('aa', () => {
+ test('a.m.', () => {
+ const dt = { A: 0, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('a.m.', 'aa')).toEqual(dt);
+ });
+
+ test('p.m.', () => {
+ const dt = { A: 1, _index: 4, _length: 4, _match: 1 };
+ expect(preparse('p.m.', 'aa')).toEqual(dt);
+ });
+
+ test('m.m.', () => {
+ const dt = { _index: 0, _length: 4, _match: 0 };
+ expect(preparse('m.m.', 'aa')).toEqual(dt);
+ });
+});
+
+describe('a', () => {
+ test('am', () => {
+ const dt = { A: 0, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('am', 'a')).toEqual(dt);
+ });
+
+ test('pm', () => {
+ const dt = { A: 1, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('pm', 'a')).toEqual(dt);
+ });
+
+ test('mm', () => {
+ const dt = { _index: 0, _length: 2, _match: 0 };
+ expect(preparse('mm', 'a')).toEqual(dt);
+ });
+});
+
+describe('mm', () => {
+ test('00', () => {
+ const dt = { m: 0, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('00', 'mm')).toEqual(dt);
+ });
+
+ test('59', () => {
+ const dt = { m: 59, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('59', 'mm')).toEqual(dt);
+ });
+
+ test('60', () => {
+ const dt = { m: 60, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('60', 'mm')).toEqual(dt);
+ });
+});
+
+describe('m', () => {
+ test('0', () => {
+ const dt = { m: 0, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('0', 'm')).toEqual(dt);
+ });
+
+ test('59', () => {
+ const dt = { m: 59, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('59', 'm')).toEqual(dt);
+ });
+
+ test('60', () => {
+ const dt = { m: 60, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('60', 'm')).toEqual(dt);
+ });
+});
+
+describe('ss', () => {
+ test('00', () => {
+ const dt = { s: 0, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('00', 'ss')).toEqual(dt);
+ });
+
+ test('59', () => {
+ const dt = { s: 59, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('59', 'ss')).toEqual(dt);
+ });
+
+ test('60', () => {
+ const dt = { s: 60, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('60', 'ss')).toEqual(dt);
+ });
+});
+
+describe('s', () => {
+ test('0', () => {
+ const dt = { s: 0, _index: 1, _length: 1, _match: 1 };
+ expect(preparse('0', 's')).toEqual(dt);
+ });
+
+ test('59', () => {
+ const dt = { s: 59, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('59', 's')).toEqual(dt);
+ });
+
+ test('60', () => {
+ const dt = { s: 60, _index: 2, _length: 2, _match: 1 };
+ expect(preparse('60', 's')).toEqual(dt);
+ });
+});
+
+describe('SSS', () => {
+ test('000', () => {
+ const dt = { S: 0, _index: 3, _length: 3, _match: 1 };
+ expect(preparse('000', 'SSS')).toEqual(dt);
+ });
+
+ test('456', () => {
+ const dt = { S: 456, _index: 3, _length: 3, _match: 1 };
+ expect(preparse('456', 'SSS')).toEqual(dt);
+ });
+
+ test('999', () => {
+ const dt = { S: 999, _index: 3, _length: 3, _match: 1 };
+ expect(preparse('999', 'SSS')).toEqual(dt);
+ });
+});
+
+describe('SS', () => {
+ test('000', () => {
+ const dt = { S: 0, _index: 2, _length: 3, _match: 1 };
+ expect(preparse('000', 'SS')).toEqual(dt);
+ });
+
+ test('456', () => {
+ const dt = { S: 450, _index: 2, _length: 3, _match: 1 };
+ expect(preparse('456', 'SS')).toEqual(dt);
+ });
+
+ test('999', () => {
+ const dt = { S: 990, _index: 2, _length: 3, _match: 1 };
+ expect(preparse('999', 'SS')).toEqual(dt);
+ });
+});
+
+describe('S', () => {
+ test('000', () => {
+ const dt = { S: 0, _index: 1, _length: 3, _match: 1 };
+ expect(preparse('000', 'S')).toEqual(dt);
+ });
+
+ test('456', () => {
+ const dt = { S: 400, _index: 1, _length: 3, _match: 1 };
+ expect(preparse('456', 'S')).toEqual(dt);
+ });
+
+ test('999', () => {
+ const dt = { S: 900, _index: 1, _length: 3, _match: 1 };
+ expect(preparse('999', 'S')).toEqual(dt);
+ });
+});
+
+describe('ZZ', () => {
+ test('-08:00', () => {
+ const dt = { Z: 480, _index: 6, _length: 6, _match: 1 };
+ expect(preparse('-08:00', 'ZZ')).toEqual(dt);
+ });
+
+ test('+00:00', () => {
+ const dt = { Z: 0, _index: 6, _length: 6, _match: 1 };
+ expect(preparse('+00:00', 'ZZ')).toEqual(dt);
+ });
+
+ test('+09:00', () => {
+ const dt = { Z: -540, _index: 6, _length: 6, _match: 1 };
+ expect(preparse('+09:00', 'ZZ')).toEqual(dt);
+ });
+});
+
+describe('Z', () => {
+ test('-0800', () => {
+ const dt = { Z: 480, _index: 5, _length: 5, _match: 1 };
+ expect(preparse('-0800', 'Z')).toEqual(dt);
+ });
+
+ test('+0000', () => {
+ const dt = { Z: 0, _index: 5, _length: 5, _match: 1 };
+ expect(preparse('+0000', 'Z')).toEqual(dt);
+ });
+
+ test('+0900', () => {
+ const dt = { Z: -540, _index: 5, _length: 5, _match: 1 };
+ expect(preparse('+0900', 'Z')).toEqual(dt);
+ });
+});
+
+describe('special tokens', () => {
+ test('ellipsis', () => {
+ const dt1 = { Y: 2000, M: 1, D: 1, h: 0, m: 0, _index: 19, _length: 19, _match: 5 };
+ expect(preparse('2000-01-01 00:00 xx', 'YYYY-MM-DD hh:mm...')).toEqual(dt1);
+ });
+});
+
+describe('options', () => {
+ test('hour12: h11', () => {
+ const dt1 = { Y: 2000, M: 1, D: 1, A: 0, h: 0, m: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 00:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toEqual(dt1);
+
+ const dt2 = { Y: 2000, M: 1, D: 1, A: 0, h: 11, m: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 11:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toEqual(dt2);
+
+ const dt3 = { Y: 2000, M: 1, D: 1, A: 1, h: 12, m: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 12:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toEqual(dt3);
+
+ const dt4 = { Y: 2000, M: 1, D: 1, A: 1, h: 11, m: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 11:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h11' })).toEqual(dt4);
+ });
+
+ test('hour12: h12', () => {
+ const dt1 = { Y: 2000, M: 1, D: 1, A: 0, h: 12, m: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toEqual(dt1);
+
+ const dt2 = { Y: 2000, M: 1, D: 1, A: 0, h: 11, m: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 11:00 AM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toEqual(dt2);
+
+ const dt3 = { Y: 2000, M: 1, D: 1, A: 1, h: 12, m: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 12:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toEqual(dt3);
+
+ const dt4 = { Y: 2000, M: 1, D: 1, A: 1, h: 11, m: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 11:00 PM', 'YYYY-MM-DD hh:mm A', { hour12: 'h12' })).toEqual(dt4);
+ });
+
+ test('hour24: h23', () => {
+ const dt1 = { Y: 2000, M: 1, D: 1, H: 0, m: 0, _index: 16, _length: 16, _match: 5 };
+ expect(preparse('2000-01-01 00:00', 'YYYY-MM-DD HH:mm', { hour24: 'h23' })).toEqual(dt1);
+
+ const dt2 = { Y: 2000, M: 1, D: 1, H: 1, m: 0, _index: 16, _length: 16, _match: 5 };
+ expect(preparse('2000-01-01 01:00', 'YYYY-MM-DD HH:mm', { hour24: 'h23' })).toEqual(dt2);
+
+ const dt3 = { Y: 2000, M: 1, D: 1, H: 23, m: 0, _index: 16, _length: 16, _match: 5 };
+ expect(preparse('2000-01-01 23:00', 'YYYY-MM-DD HH:mm', { hour24: 'h23' })).toEqual(dt3);
+
+ const dt4 = { Y: 2000, M: 1, D: 1, H: 24, m: 0, _index: 16, _length: 16, _match: 5 };
+ expect(preparse('2000-01-01 24:00', 'YYYY-MM-DD HH:mm', { hour24: 'h23' })).toEqual(dt4);
+ });
+
+ test('hour24: h24', () => {
+ const dt1 = { Y: 2000, M: 1, D: 1, H: 0, m: 0, _index: 16, _length: 16, _match: 5 };
+ expect(preparse('2000-01-01 00:00', 'YYYY-MM-DD HH:mm', { hour24: 'h24' })).toEqual(dt1);
+
+ const dt2 = { Y: 2000, M: 1, D: 1, H: 1, m: 0, _index: 16, _length: 16, _match: 5 };
+ expect(preparse('2000-01-01 01:00', 'YYYY-MM-DD HH:mm', { hour24: 'h24' })).toEqual(dt2);
+
+ const dt3 = { Y: 2000, M: 1, D: 1, H: 23, m: 0, _index: 16, _length: 16, _match: 5 };
+ expect(preparse('2000-01-01 23:00', 'YYYY-MM-DD HH:mm', { hour24: 'h24' })).toEqual(dt3);
+
+ const dt4 = { Y: 2000, M: 1, D: 1, H: 24, m: 0, _index: 16, _length: 16, _match: 5 };
+ expect(preparse('2000-01-01 24:00', 'YYYY-MM-DD HH:mm', { hour24: 'h24' })).toEqual(dt4);
+ });
+
+ test('ignoreCase: true', () => {
+ const dt = { Y: 2025, M: 5, D: 4, h: 11, A: 0, _index: 23, _length: 23, _match: 6 };
+
+ expect(preparse('2025 May 4 Sunday 11 AM', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toEqual(dt);
+ expect(preparse('2025 may 4 sunday 11 am', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toEqual(dt);
+ expect(preparse('2025 MAY 4 SUNDAY 11 AM', 'YYYY MMMM D dddd h A', { ignoreCase: true, plugins: [parser] })).toEqual(dt);
+ });
+
+ test('calendar: buddhist', () => {
+ const dt1 = { Y: 2000, M: 1, D: 1, h: 12, m: 0, A: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('2000-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toEqual(dt1);
+
+ const dt2 = { Y: 9999, M: 1, D: 1, h: 12, m: 0, A: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('9999-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toEqual(dt2);
+
+ const dt3 = { Y: 544, M: 1, D: 1, h: 12, m: 0, A: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('0544-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toEqual(dt3);
+
+ const dt4 = { Y: 543, M: 1, D: 1, h: 12, m: 0, A: 0, _index: 19, _length: 19, _match: 6 };
+ expect(preparse('0543-01-01 12:00 AM', 'YYYY-MM-DD hh:mm A', { calendar: 'buddhist' })).toEqual(dt4);
+ });
+});
diff --git a/tests/subtract.spec.ts b/tests/subtract.spec.ts
new file mode 100644
index 0000000..a68a995
--- /dev/null
+++ b/tests/subtract.spec.ts
@@ -0,0 +1,394 @@
+import { describe, expect, test } from 'vitest';
+import { subtract } from '../src/index.ts';
+
+describe('subtraction', () => {
+ test('One year is 365 days', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2015, 11, 31, 23, 59, 59, 999);
+
+ expect(subtract(date1, date2).toDays().value).toBe(365);
+ expect(subtract(date1, date2).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: 365 });
+
+ expect(subtract(date1, date2).toHours().value).toBe(365 * 24);
+ expect(subtract(date1, date2).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 365 * 24 });
+
+ expect(subtract(date1, date2).toMinutes().value).toBe(365 * 24 * 60);
+ expect(subtract(date1, date2).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 365 * 24 * 60 });
+
+ expect(subtract(date1, date2).toSeconds().value).toBe(365 * 24 * 60 * 60);
+ expect(subtract(date1, date2).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 365 * 24 * 60 * 60 });
+
+ expect(subtract(date1, date2).toMilliseconds().value).toBe(365 * 24 * 60 * 60 * 1000);
+ expect(subtract(date1, date2).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 365 * 24 * 60 * 60 * 1000 });
+
+ expect(subtract(date1, date2).toMicroseconds().value).toBe(365 * 24 * 60 * 60 * 1000 * 1000);
+ expect(subtract(date1, date2).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 365 * 24 * 60 * 60 * 1000 * 1000 });
+
+ expect(subtract(date1, date2).toNanoseconds().value).toBe(365 * 24 * 60 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date1, date2).toNanoseconds().toParts()).toEqual({ nanoseconds: 365 * 24 * 60 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One year is 365 days (reverse)', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2015, 11, 31, 23, 59, 59, 999);
+
+ expect(subtract(date2, date1).toDays().value).toBe(-365);
+ expect(subtract(date2, date1).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: -365 });
+
+ expect(subtract(date2, date1).toHours().value).toBe(-365 * 24);
+ expect(subtract(date2, date1).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: -365 * 24 });
+
+ expect(subtract(date2, date1).toMinutes().value).toBe(-365 * 24 * 60);
+ expect(subtract(date2, date1).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: -365 * 24 * 60 });
+
+ expect(subtract(date2, date1).toSeconds().value).toBe(-365 * 24 * 60 * 60);
+ expect(subtract(date2, date1).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -365 * 24 * 60 * 60 });
+
+ expect(subtract(date2, date1).toMilliseconds().value).toBe(-365 * 24 * 60 * 60 * 1000);
+ expect(subtract(date2, date1).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -365 * 24 * 60 * 60 * 1000 });
+
+ expect(subtract(date2, date1).toMicroseconds().value).toBe(-365 * 24 * 60 * 60 * 1000 * 1000);
+ expect(subtract(date2, date1).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: -365 * 24 * 60 * 60 * 1000 * 1000 });
+
+ expect(subtract(date2, date1).toNanoseconds().value).toBe(-365 * 24 * 60 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date2, date1).toNanoseconds().toParts()).toEqual({ nanoseconds: -365 * 24 * 60 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One month is 31 days', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 12, 31, 23, 59, 59, 999);
+
+ expect(subtract(date1, date2).toDays().value).toBe(31);
+ expect(subtract(date1, date2).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: 31 });
+
+ expect(subtract(date1, date2).toHours().value).toBe(31 * 24);
+ expect(subtract(date1, date2).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 31 * 24 });
+
+ expect(subtract(date1, date2).toMinutes().value).toBe(31 * 24 * 60);
+ expect(subtract(date1, date2).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 31 * 24 * 60 });
+
+ expect(subtract(date1, date2).toSeconds().value).toBe(31 * 24 * 60 * 60);
+ expect(subtract(date1, date2).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 31 * 24 * 60 * 60 });
+
+ expect(subtract(date1, date2).toMilliseconds().value).toBe(31 * 24 * 60 * 60 * 1000);
+ expect(subtract(date1, date2).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 31 * 24 * 60 * 60 * 1000 });
+
+ expect(subtract(date1, date2).toMicroseconds().value).toBe(31 * 24 * 60 * 60 * 1000 * 1000);
+ expect(subtract(date1, date2).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 31 * 24 * 60 * 60 * 1000 * 1000 });
+
+ expect(subtract(date1, date2).toNanoseconds().value).toBe(31 * 24 * 60 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date1, date2).toNanoseconds().toParts()).toEqual({ nanoseconds: 31 * 24 * 60 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One month is 31 days (reverse)', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 12, 31, 23, 59, 59, 999);
+
+ expect(subtract(date2, date1).toDays().value).toBe(-31);
+ expect(subtract(date2, date1).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: -31 });
+
+ expect(subtract(date2, date1).toHours().value).toBe(-31 * 24);
+ expect(subtract(date2, date1).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: -31 * 24 });
+
+ expect(subtract(date2, date1).toMinutes().value).toBe(-31 * 24 * 60);
+ expect(subtract(date2, date1).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: -31 * 24 * 60 });
+
+ expect(subtract(date2, date1).toSeconds().value).toBe(-31 * 24 * 60 * 60);
+ expect(subtract(date2, date1).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -31 * 24 * 60 * 60 });
+
+ expect(subtract(date2, date1).toMilliseconds().value).toBe(-31 * 24 * 60 * 60 * 1000);
+ expect(subtract(date2, date1).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -31 * 24 * 60 * 60 * 1000 });
+
+ expect(subtract(date2, date1).toMicroseconds().value).toBe(-31 * 24 * 60 * 60 * 1000 * 1000);
+ expect(subtract(date2, date1).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: -31 * 24 * 60 * 60 * 1000 * 1000 });
+
+ expect(subtract(date2, date1).toNanoseconds().value).toBe(-31 * 24 * 60 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date2, date1).toNanoseconds().toParts()).toEqual({ nanoseconds: -31 * 24 * 60 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One day', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 11, 32, 23, 59, 59, 999);
+
+ expect(subtract(date1, date2).toDays().value).toBe(1);
+ expect(subtract(date1, date2).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: 1 });
+
+ expect(subtract(date1, date2).toHours().value).toBe(24);
+ expect(subtract(date1, date2).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 24 });
+
+ expect(subtract(date1, date2).toMinutes().value).toBe(24 * 60);
+ expect(subtract(date1, date2).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 24 * 60 });
+
+ expect(subtract(date1, date2).toSeconds().value).toBe(24 * 60 * 60);
+ expect(subtract(date1, date2).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 24 * 60 * 60 });
+
+ expect(subtract(date1, date2).toMilliseconds().value).toBe(24 * 60 * 60 * 1000);
+ expect(subtract(date1, date2).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 24 * 60 * 60 * 1000 });
+
+ expect(subtract(date1, date2).toMicroseconds().value).toBe(24 * 60 * 60 * 1000 * 1000);
+ expect(subtract(date1, date2).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 24 * 60 * 60 * 1000 * 1000 });
+
+ expect(subtract(date1, date2).toNanoseconds().value).toBe(24 * 60 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date1, date2).toNanoseconds().toParts()).toEqual({ nanoseconds: 24 * 60 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One day (reverse)', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 11, 32, 23, 59, 59, 999);
+
+ expect(subtract(date2, date1).toDays().value).toBe(-1);
+ expect(subtract(date2, date1).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 0, days: -1 });
+
+ expect(subtract(date2, date1).toHours().value).toBe(-1 * 24);
+ expect(subtract(date2, date1).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: -1 * 24 });
+
+ expect(subtract(date2, date1).toMinutes().value).toBe(-1 * 24 * 60);
+ expect(subtract(date2, date1).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: -1 * 24 * 60 });
+
+ expect(subtract(date2, date1).toSeconds().value).toBe(-1 * 24 * 60 * 60);
+ expect(subtract(date2, date1).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -1 * 24 * 60 * 60 });
+
+ expect(subtract(date2, date1).toMilliseconds().value).toBe(-1 * 24 * 60 * 60 * 1000);
+ expect(subtract(date2, date1).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1 * 24 * 60 * 60 * 1000 });
+
+ expect(subtract(date2, date1).toMicroseconds().value).toBe(-1 * 24 * 60 * 60 * 1000 * 1000);
+ expect(subtract(date2, date1).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: -1 * 24 * 60 * 60 * 1000 * 1000 });
+
+ expect(subtract(date2, date1).toNanoseconds().value).toBe(-1 * 24 * 60 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date2, date1).toNanoseconds().toParts()).toEqual({ nanoseconds: -1 * 24 * 60 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One hour', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 11, 31, 24, 59, 59, 999);
+
+ expect(subtract(date1, date2).toDays().value).toBe(1 / 24);
+ expect(subtract(date1, date2).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 1, days: 0 });
+
+ expect(subtract(date1, date2).toHours().value).toBe(1);
+ expect(subtract(date1, date2).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: 1 });
+
+ expect(subtract(date1, date2).toMinutes().value).toBe(60);
+ expect(subtract(date1, date2).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 60 });
+
+ expect(subtract(date1, date2).toSeconds().value).toBe(60 * 60);
+ expect(subtract(date1, date2).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 60 * 60 });
+
+ expect(subtract(date1, date2).toMilliseconds().value).toBe(60 * 60 * 1000);
+ expect(subtract(date1, date2).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 60 * 60 * 1000 });
+
+ expect(subtract(date1, date2).toMicroseconds().value).toBe(60 * 60 * 1000 * 1000);
+ expect(subtract(date1, date2).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 60 * 60 * 1000 * 1000 });
+
+ expect(subtract(date1, date2).toNanoseconds().value).toBe(60 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date1, date2).toNanoseconds().toParts()).toEqual({ nanoseconds: 60 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One hour (reverse)', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 11, 31, 24, 59, 59, 999);
+
+ expect(subtract(date2, date1).toDays().value).toBe(-1 / 24);
+ expect(subtract(date2, date1).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: -1, days: 0 });
+
+ expect(subtract(date2, date1).toHours().value).toBe(-1);
+ expect(subtract(date2, date1).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 0, hours: -1 });
+
+ expect(subtract(date2, date1).toMinutes().value).toBe(-1 * 60);
+ expect(subtract(date2, date1).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: -1 * 60 });
+
+ expect(subtract(date2, date1).toSeconds().value).toBe(-1 * 60 * 60);
+ expect(subtract(date2, date1).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -1 * 60 * 60 });
+
+ expect(subtract(date2, date1).toMilliseconds().value).toBe(-1 * 60 * 60 * 1000);
+ expect(subtract(date2, date1).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1 * 60 * 60 * 1000 });
+
+ expect(subtract(date2, date1).toMicroseconds().value).toBe(-1 * 60 * 60 * 1000 * 1000);
+ expect(subtract(date2, date1).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: -1 * 60 * 60 * 1000 * 1000 });
+
+ expect(subtract(date2, date1).toNanoseconds().value).toBe(-1 * 60 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date2, date1).toNanoseconds().toParts()).toEqual({ nanoseconds: -1 * 60 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One minute', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 11, 31, 23, 60, 59, 999);
+
+ expect(subtract(date1, date2).toDays().value).toBe(1 / (24 * 60));
+ expect(subtract(date1, date2).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 1, hours: 0, days: 0 });
+
+ expect(subtract(date1, date2).toHours().value).toBe(1 / 60);
+ expect(subtract(date1, date2).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 1, hours: 0 });
+
+ expect(subtract(date1, date2).toMinutes().value).toBe(1);
+ expect(subtract(date1, date2).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: 1 });
+
+ expect(subtract(date1, date2).toSeconds().value).toBe(60);
+ expect(subtract(date1, date2).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 60 });
+
+ expect(subtract(date1, date2).toMilliseconds().value).toBe(60 * 1000);
+ expect(subtract(date1, date2).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 60 * 1000 });
+
+ expect(subtract(date1, date2).toMicroseconds().value).toBe(60 * 1000 * 1000);
+ expect(subtract(date1, date2).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 60 * 1000 * 1000 });
+
+ expect(subtract(date1, date2).toNanoseconds().value).toBe(60 * 1000 * 1000 * 1000);
+ expect(subtract(date1, date2).toNanoseconds().toParts()).toEqual({ nanoseconds: 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One minute (reverse)', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 11, 31, 23, 60, 59, 999);
+
+ expect(subtract(date2, date1).toDays().value).toBe(-1 / (24 * 60));
+ expect(subtract(date2, date1).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: -1, hours: 0, days: 0 });
+
+ expect(subtract(date2, date1).toHours().value).toBe(-1 / 60);
+ expect(subtract(date2, date1).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: -1, hours: 0 });
+
+ expect(subtract(date2, date1).toMinutes().value).toBe(-1);
+ expect(subtract(date2, date1).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 0, minutes: -1 });
+
+ expect(subtract(date2, date1).toSeconds().value).toBe(-1 * 60);
+ expect(subtract(date2, date1).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -1 * 60 });
+
+ expect(subtract(date2, date1).toMilliseconds().value).toBe(-1 * 60 * 1000);
+ expect(subtract(date2, date1).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1 * 60 * 1000 });
+
+ expect(subtract(date2, date1).toMicroseconds().value).toBe(-1 * 60 * 1000 * 1000);
+ expect(subtract(date2, date1).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: -1 * 60 * 1000 * 1000 });
+
+ expect(subtract(date2, date1).toNanoseconds().value).toBe(-1 * 60 * 1000 * 1000 * 1000);
+ expect(subtract(date2, date1).toNanoseconds().toParts()).toEqual({ nanoseconds: -1 * 60 * 1000 * 1000 * 1000 });
+ });
+
+ test('One second', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 11, 31, 23, 59, 60, 999);
+
+ expect(subtract(date1, date2).toDays().value).toBe(1 / (24 * 60 * 60));
+ expect(subtract(date1, date2).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 1, minutes: 0, hours: 0, days: 0 });
+
+ expect(subtract(date1, date2).toHours().value).toBe(1 / (60 * 60));
+ expect(subtract(date1, date2).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 1, minutes: 0, hours: 0 });
+
+ expect(subtract(date1, date2).toMinutes().value).toBe(1 / 60);
+ expect(subtract(date1, date2).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 1, minutes: 0 });
+
+ expect(subtract(date1, date2).toSeconds().value).toBe(1);
+ expect(subtract(date1, date2).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: 1 });
+
+ expect(subtract(date1, date2).toMilliseconds().value).toBe(1000);
+ expect(subtract(date1, date2).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 1000 });
+
+ expect(subtract(date1, date2).toMicroseconds().value).toBe(1000 * 1000);
+ expect(subtract(date1, date2).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 1000 * 1000 });
+
+ expect(subtract(date1, date2).toNanoseconds().value).toBe(1000 * 1000 * 1000);
+ expect(subtract(date1, date2).toNanoseconds().toParts()).toEqual({ nanoseconds: 1000 * 1000 * 1000 });
+ });
+
+ test('One second (reverse)', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 999);
+ const date2 = new Date(2014, 11, 31, 23, 59, 60, 999);
+
+ expect(subtract(date2, date1).toDays().value).toBe(-1 / (24 * 60 * 60));
+ expect(subtract(date2, date1).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -1, minutes: 0, hours: 0, days: 0 });
+
+ expect(subtract(date2, date1).toHours().value).toBe(-1 / (60 * 60));
+ expect(subtract(date2, date1).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -1, minutes: 0, hours: 0 });
+
+ expect(subtract(date2, date1).toMinutes().value).toBe(-1 / 60);
+ expect(subtract(date2, date1).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -1, minutes: 0 });
+
+ expect(subtract(date2, date1).toSeconds().value).toBe(-1);
+ expect(subtract(date2, date1).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 0, seconds: -1 });
+
+ expect(subtract(date2, date1).toMilliseconds().value).toBe(-1 * 1000);
+ expect(subtract(date2, date1).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1 * 1000 });
+
+ expect(subtract(date2, date1).toMicroseconds().value).toBe(-1 * 1000 * 1000);
+ expect(subtract(date2, date1).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: -1 * 1000 * 1000 });
+
+ expect(subtract(date2, date1).toNanoseconds().value).toBe(-1 * 1000 * 1000 * 1000);
+ expect(subtract(date2, date1).toNanoseconds().toParts()).toEqual({ nanoseconds: -1 * 1000 * 1000 * 1000 });
+ });
+
+ test('One millisecond', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 998);
+ const date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
+
+ expect(subtract(date1, date2).toDays().value).toBe(1 / (24 * 60 * 60 * 1000));
+ expect(subtract(date1, date2).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 1, seconds: 0, minutes: 0, hours: 0, days: 0 });
+
+ expect(subtract(date1, date2).toHours().value).toBe(1 / (60 * 60 * 1000));
+ expect(subtract(date1, date2).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 1, seconds: 0, minutes: 0, hours: 0 });
+
+ expect(subtract(date1, date2).toMinutes().value).toBe(1 / (60 * 1000));
+ expect(subtract(date1, date2).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 1, seconds: 0, minutes: 0 });
+
+ expect(subtract(date1, date2).toSeconds().value).toBe(1 / 1000);
+ expect(subtract(date1, date2).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 1, seconds: 0 });
+
+ expect(subtract(date1, date2).toMilliseconds().value).toBe(1);
+ expect(subtract(date1, date2).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: 1 });
+
+ expect(subtract(date1, date2).toMicroseconds().value).toBe(1000);
+ expect(subtract(date1, date2).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 1000 });
+
+ expect(subtract(date1, date2).toNanoseconds().value).toBe(1000 * 1000);
+ expect(subtract(date1, date2).toNanoseconds().toParts()).toEqual({ nanoseconds: 1000 * 1000 });
+ });
+
+ test('One millisecond (reverse)', () => {
+ const date1 = new Date(2014, 11, 31, 23, 59, 59, 998);
+ const date2 = new Date(2014, 11, 31, 23, 59, 59, 999);
+
+ expect(subtract(date2, date1).toDays().value).toBe(-1 / (24 * 60 * 60 * 1000));
+ expect(subtract(date2, date1).toDays().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1, seconds: 0, minutes: 0, hours: 0, days: 0 });
+
+ expect(subtract(date2, date1).toHours().value).toBe(-1 / (60 * 60 * 1000));
+ expect(subtract(date2, date1).toHours().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1, seconds: 0, minutes: 0, hours: 0 });
+
+ expect(subtract(date2, date1).toMinutes().value).toBe(-1 / (60 * 1000));
+ expect(subtract(date2, date1).toMinutes().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1, seconds: 0, minutes: 0 });
+
+ expect(subtract(date2, date1).toSeconds().value).toBe(-1 / 1000);
+ expect(subtract(date2, date1).toSeconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1, seconds: 0 });
+
+ expect(subtract(date2, date1).toMilliseconds().value).toBe(-1);
+ expect(subtract(date2, date1).toMilliseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: 0, milliseconds: -1 });
+
+ expect(subtract(date2, date1).toMicroseconds().value).toBe(-1 * 1000);
+ expect(subtract(date2, date1).toMicroseconds().toParts()).toEqual({ nanoseconds: 0, microseconds: -1 * 1000 });
+
+ expect(subtract(date2, date1).toNanoseconds().value).toBe(-1 * 1000 * 1000);
+ expect(subtract(date2, date1).toNanoseconds().toParts()).toEqual({ nanoseconds: -1 * 1000 * 1000 });
+ });
+
+ test('format', () => {
+ const date1 = new Date(2025, 6, 13, 8, 42, 53, 998);
+ const date2 = new Date(2025, 6, 14, 9, 43, 54, 999);
+
+ expect(subtract(date1, date2).toDays().format('D[days] H[hours] m[minites] s[seconds] S.fffFFF')).toBe('1days 1hours 1minites 1seconds 1.000000');
+ expect(subtract(date1, date2).toHours().format('H[hours] m[minites] s[seconds] S.fffFFF')).toBe('25hours 1minites 1seconds 1.000000');
+ expect(subtract(date1, date2).toMinutes().format('m[minites] s[seconds] S.fffFFF')).toBe('1501minites 1seconds 1.000000');
+ expect(subtract(date1, date2).toSeconds().format('s[seconds] S.fffFFF')).toBe('90061seconds 1.000000');
+ expect(subtract(date1, date2).toMilliseconds().format('S.fffFFF')).toBe('90061001.000000');
+ expect(subtract(date1, date2).toMicroseconds().format('f.FFF')).toBe('90061001000.000');
+ expect(subtract(date1, date2).toNanoseconds().format('F')).toBe('90061001000000');
+ });
+
+ test('format (reverse)', () => {
+ const date1 = new Date(2025, 6, 13, 8, 42, 53, 998);
+ const date2 = new Date(2025, 6, 14, 9, 43, 54, 999);
+
+ expect(subtract(date2, date1).toDays().format('D[days] H[hours] m[minites] s[seconds] S.fffFFF')).toBe('-1days 1hours 1minites 1seconds 1.000000');
+ expect(subtract(date2, date1).toHours().format('H[hours] m[minites] s[seconds] S.fffFFF')).toBe('-25hours 1minites 1seconds 1.000000');
+ expect(subtract(date2, date1).toMinutes().format('m[minites] s[seconds] S.fffFFF')).toBe('-1501minites 1seconds 1.000000');
+ expect(subtract(date2, date1).toSeconds().format('s[seconds] S.fffFFF')).toBe('-90061seconds 1.000000');
+ expect(subtract(date2, date1).toMilliseconds().format('S.fffFFF')).toBe('-90061001.000000');
+ expect(subtract(date2, date1).toMicroseconds().format('f.FFF')).toBe('-90061001000.000');
+ expect(subtract(date2, date1).toNanoseconds().format('F')).toBe('-90061001000000');
+ });
+});
diff --git a/tests/timezones/timezones.spec.ts b/tests/timezones/timezones.spec.ts
new file mode 100644
index 0000000..97618f0
--- /dev/null
+++ b/tests/timezones/timezones.spec.ts
@@ -0,0 +1,32 @@
+import { expect, test, describe } from 'vitest';
+import { readdir } from 'node:fs/promises';
+import { join } from 'node:path';
+import type { TimeZone } from '../../src/timezone.ts';
+
+const importModules = async (path: string) => {
+ const items = await readdir(path, { recursive: true, withFileTypes: true });
+ const modules = [] as TimeZone[];
+
+ for (const item of items) {
+ if (item.isFile()) {
+ modules.push((await import(join('../../', item.parentPath, item.name))).default);
+ }
+ }
+ return modules;
+};
+
+describe('Timezones', async () => {
+ const modules = await importModules('src/timezones/');
+
+ for (const module of modules) {
+ test.concurrent('timezone', () => {
+ expect(typeof module === 'object').toBe(true);
+
+ expect('zone_name' in module).toBe(true);
+ expect(typeof module.zone_name === 'string').toBe(true);
+
+ expect('gmt_offset' in module).toBe(true);
+ expect(Array.isArray(module.gmt_offset)).toBe(true);
+ });
+ }
+});
diff --git a/tests/transform.spec.ts b/tests/transform.spec.ts
new file mode 100644
index 0000000..acd5450
--- /dev/null
+++ b/tests/transform.spec.ts
@@ -0,0 +1,98 @@
+import { describe, expect, test, beforeAll } from 'vitest';
+import { compile, format, transform } from '../src/index.ts';
+import Los_Angeles from '../src/timezones/America/Los_Angeles.ts';
+import New_York from '../src/timezones/America/New_York.ts';
+import Tokyo from '../src/timezones/Asia/Tokyo.ts';
+
+beforeAll(() => (process.env.TZ = 'UTC'));
+
+describe('transform', () => {
+ test('D/M/YYYY => M/D/YYYY', () => {
+ expect(transform('3/8/2020', 'D/M/YYYY', 'M/D/YYYY')).toBe('8/3/2020');
+ });
+
+ test('HH:mm => hh:mm A', () => {
+ expect(transform('13:05', 'HH:mm', 'hh:mm A')).toBe('01:05 PM');
+ });
+
+ test('HH:mm => hh:mm A, output as UTC', () => {
+ const utc = format(new Date(2020, 3, 1, 13, 5), 'hh:mm A');
+ expect(transform('13:05', 'HH:mm', 'hh:mm A')).toBe(utc);
+ });
+
+ test('D/M/YYYY => M/D/YYYY, with compile', () => {
+ const arg1 = compile('D/M/YYYY');
+ const arg2 = compile('M/D/YYYY');
+ expect(transform('3/8/2020', arg1, arg2)).toBe('8/3/2020');
+ });
+
+ test('transform EST to PST', () => {
+ const string1 = '2021-11-07T04:00:00.000'; // UTC-5
+ const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS';
+ const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
+ const string2 = 'November 7 2021 1:00:00.000'; // UTC-8
+
+ // 2021-11-07T04:00:00.000 => November 7 2021 1:00:00.000
+ expect(transform(string1, formatString1, formatString2, { timeZone: New_York }, { timeZone: Los_Angeles })).toBe(string2);
+ });
+
+ test('transform EST to PDT (End of DST)', () => {
+ const string1 = '2021-11-07T03:59:59.999'; // UTC-5
+ const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS';
+ const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
+ const string2 = 'November 7 2021 1:59:59.999'; // UTC-7
+
+ // 2021-11-07T03:59:59.999 => November 7 2021 1:59:59.999
+ expect(transform(string1, formatString1, formatString2, { timeZone: New_York }, { timeZone: Los_Angeles })).toBe(string2);
+ });
+
+ test('transform EDT to PST', () => {
+ const string1 = '2021-03-14T05:59:59.999'; // UTC-4
+ const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS';
+ const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
+ const string2 = 'March 14 2021 1:59:59.999'; // UTC-8
+
+ // 2021-03-14T05:59:59.999 => March 14 2021 1:59:59.999
+ expect(transform(string1, formatString1, formatString2, { timeZone: New_York }, { timeZone: Los_Angeles })).toBe(string2);
+ });
+
+ test('transform EDT to PDT (Start of DST)', () => {
+ const string1 = '2021-03-14T06:00:00.000'; // UTC-4
+ const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS';
+ const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
+ const string2 = 'March 14 2021 3:00:00.000'; // UTC-7
+
+ // 2021-03-14T06:00:00.000 => March 14 2021 3:00:00.000
+ expect(transform(string1, formatString1, formatString2, { timeZone: New_York }, { timeZone: Los_Angeles })).toBe(string2);
+ });
+
+ test('transform PST to JST', () => {
+ const string1 = '2021-03-14T01:59:59.999'; // UTC-8
+ const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS';
+ const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
+ const string2 = 'March 14 2021 18:59:59.999'; // UTC+9
+
+ // 2021-03-14T01:59:59.999 => March 14 2021 18:59:59.999
+ expect(transform(string1, formatString1, formatString2, { timeZone: Los_Angeles }, { timeZone: Tokyo })).toBe(string2);
+ });
+
+ test('transform PDT to JST', () => {
+ const string1 = '2021-03-14T03:00:00.000'; // UTC-7
+ const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS';
+ const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
+ const string2 = 'March 14 2021 19:00:00.000'; // UTC+9
+
+ // 2021-03-14T03:00:00.000 => March 14 2021 19:00:00.000
+ expect(transform(string1, formatString1, formatString2, { timeZone: Los_Angeles }, { timeZone: Tokyo })).toBe(string2);
+ });
+
+ test('transform UTC to JST', () => {
+ const string1 = '2021-03-14T03:00:00.000'; // UTC+0
+ const formatString1 = 'YYYY-MM-DD[T]HH:mm:ss.SSS';
+ const formatString2 = 'MMMM D YYYY H:mm:ss.SSS';
+ const string2 = 'March 14 2021 12:00:00.000'; // UTC+9
+
+ // 2021-03-14T03:00:00.000 => March 14 2021 12:00:00.000
+ expect(transform(string1, formatString1, formatString2, { timeZone: 'UTC' }, { timeZone: Tokyo })).toBe(string2);
+ });
+});
diff --git a/tests/utils.spec.ts b/tests/utils.spec.ts
new file mode 100644
index 0000000..1d01f7f
--- /dev/null
+++ b/tests/utils.spec.ts
@@ -0,0 +1,22 @@
+import { expect, test } from 'vitest';
+import { isLeapYear, isSameDay } from '../src/index.ts';
+
+test('isLeapYear', () => {
+ expect(isLeapYear(4)).toBe(true);
+ expect(isLeapYear(100)).toBe(false);
+ expect(isLeapYear(400)).toBe(true);
+ expect(isLeapYear(2024)).toBe(true);
+ expect(isLeapYear(2025)).toBe(false);
+});
+
+test('isSameDay', () => {
+ const date1 = new Date(2025, 6, 18, 0, 0, 0, 0);
+ const date2 = new Date(2025, 6, 18, 23, 59, 59, 999);
+
+ expect(isSameDay(date1, date2)).toBe(true);
+
+ const date3 = new Date(2025, 6, 18, 23, 59, 59, 999);
+ const date4 = new Date(2025, 6, 19, 0, 0, 0, 0);
+
+ expect(isSameDay(date3, date4)).toBe(false);
+});
diff --git a/tools/locale.ts b/tools/locale.ts
new file mode 100644
index 0000000..fc99014
--- /dev/null
+++ b/tools/locale.ts
@@ -0,0 +1,110 @@
+const compare = (array1: string[], array2: string[]) => {
+ if (array1.length !== array2.length) {
+ return false;
+ }
+ for (let i = 0, len = array1.length; i < len; i++) {
+ if (array1[i] !== array2[i]) {
+ return false;
+ }
+ }
+ return true;
+};
+
+const getMonths = (locale: string, style: 'long' | 'short' | 'narrow') => {
+ const options1: Intl.DateTimeFormatOptions = { hour12: true, weekday: 'long', year: 'numeric', month: style, hour: 'numeric' };
+ const options2: Intl.DateTimeFormatOptions = { ...options1, day: 'numeric' };
+ const dtf1 = new Intl.DateTimeFormat(locale, options1);
+ const dtf2 = new Intl.DateTimeFormat(locale, options2);
+ const months1 = [];
+ const months2 = [];
+
+ for (let i = 0; i < 12; i++) {
+ months1.push(dtf1.formatToParts(new Date(2024, i, 1, 0)).find(p => p.type === 'month')?.value || '');
+ }
+ for (let i = 0; i < 12; i++) {
+ months2.push(dtf2.formatToParts(new Date(2024, i, 1, 0)).find(p => p.type === 'month')?.value || '');
+ }
+ return compare(months1, months2) ? months1 : [months1, months2];
+};
+
+const getWeekdays = (locale: string, style: 'long' | 'short' | 'narrow') => {
+ const options1: Intl.DateTimeFormatOptions = { hour12: true, weekday: style, year: 'numeric', month: 'long', hour: 'numeric' };
+ const options2: Intl.DateTimeFormatOptions = { ...options1, day: 'numeric' };
+ const dtf1 = new Intl.DateTimeFormat(locale, options1);
+ const dtf2 = new Intl.DateTimeFormat(locale, options2);
+ const weekdays1 = [];
+ const weekdays2 = [];
+
+ for (let i = 1; i <= 7; i++) {
+ weekdays1.push(dtf1.formatToParts(new Date(2024, 11, i, 0)).find(p => p.type === 'weekday')?.value || '');
+ }
+ for (let i = 1; i <= 7; i++) {
+ weekdays2.push(dtf2.formatToParts(new Date(2024, 11, i, 0)).find(p => p.type === 'weekday')?.value || '');
+ }
+ return compare(weekdays1, weekdays2) ? weekdays1 : [weekdays1, weekdays2];
+};
+
+const getDayPeriod = (locale: string) => {
+ const options1: Intl.DateTimeFormatOptions = { hour12: true, hour: 'numeric' };
+ const options2: Intl.DateTimeFormatOptions = { ...options1, weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
+ const dtf1 = new Intl.DateTimeFormat(locale, options1);
+ const dtf2 = new Intl.DateTimeFormat(locale, options2);
+ const dayperiod1 = [];
+ const dayperiod2 = [];
+
+ for (let i = 0; i < 24; i++) {
+ const value = dtf1.formatToParts(new Date(2024, 11, 1, i)).find(p => p.type === 'dayPeriod')?.value || '';
+ if (dayperiod1.indexOf(value) < 0) {
+ dayperiod1.push(value);
+ }
+ }
+ for (let i = 0; i < 24; i++) {
+ const value = dtf2.formatToParts(new Date(2024, 11, 1, i)).find(p => p.type === 'dayPeriod')?.value || '';
+ if (dayperiod2.indexOf(value) < 0) {
+ dayperiod2.push(value);
+ }
+ }
+ return compare(dayperiod1, dayperiod2) ? dayperiod1 : [dayperiod1, dayperiod2];
+};
+
+const getParts = (locale: string) => {
+ const options: Intl.DateTimeFormatOptions = {
+ hour12: false, weekday: 'long',
+ year: 'numeric', month: 'long', day: 'numeric',
+ hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3,
+ timeZone: 'UTC', timeZoneName: 'longOffset'
+ };
+ const parts = new Intl.DateTimeFormat(locale, options).formatToParts(new Date());
+
+ return parts.filter(part => part.type !== 'literal');
+};
+
+const getDate = (locale: string) => {
+ const options: Intl.DateTimeFormatOptions = {
+ hour12: true, weekday: 'short',
+// year: 'numeric', month: 'long', day: 'numeric',
+ year: 'numeric', month: 'short', day: 'numeric',
+ hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3,
+ timeZone: 'Europe/Paris', timeZoneName: 'longOffset'
+ };
+ return new Intl.DateTimeFormat(locale, options).format(new Date());
+};
+
+const locale = process.argv[2];
+
+if (!locale) {
+ process.exit();
+}
+
+const list = {
+ MMMM: getMonths(locale, 'long'),
+ MMM: getMonths(locale, 'short'),
+ dddd: getWeekdays(locale, 'long'),
+ ddd: getWeekdays(locale, 'short'),
+ dd: getWeekdays(locale, 'narrow'),
+ A: getDayPeriod(locale)
+};
+
+console.log(JSON.stringify(list, undefined, 2));
+console.log(JSON.stringify(getParts(locale), undefined, 2));
+console.log(getDate(locale));
diff --git a/tools/timezone.ts b/tools/timezone.ts
new file mode 100644
index 0000000..bcedb60
--- /dev/null
+++ b/tools/timezone.ts
@@ -0,0 +1,67 @@
+/**
+ * @description
+ * This script extracts GMT offset values from a CSV file obtained from timezonedb.com,
+ * creates subdirectories for each timezone under the src/timezones directory,
+ * and outputs timezone data as TypeScript files.
+ */
+
+import { readFile, mkdir, writeFile } from 'node:fs/promises';
+import { join } from 'node:path';
+import prettier from 'prettier';
+import type { TimeZone } from '../src/timezone.ts';
+
+const createTimeZones = (csv: string) => {
+ const map = new Map();
+
+ csv.split('\n').forEach(line => {
+ const [zone_name, , , , gmt_offset] = line.split(',');
+
+ if (zone_name && !/UTC$/.test(zone_name)) {
+ const data = map.get(zone_name);
+
+ if (data) {
+ if (data.gmt_offset.indexOf(+gmt_offset) < 0) {
+ data.gmt_offset.push(+gmt_offset);
+ }
+ } else {
+ map.set(zone_name, { zone_name, gmt_offset: [+gmt_offset] });
+ }
+ }
+ });
+ return map;
+};
+
+const getPath = (timezone: TimeZone) => {
+ const re = /[^/]+$/;
+ return {
+ dir: join('src', 'timezones', timezone.zone_name.replace(re, '')),
+ name: `${re.exec(timezone.zone_name)?.[0] || ''}.ts`
+ };
+};
+
+const format = (timezone: TimeZone) => {
+ const code = `export default {
+ zone_name: '${timezone.zone_name}',
+ gmt_offset: ${JSON.stringify(timezone.gmt_offset.sort((a, b) => b - a))}
+ };`;
+ return prettier.format(code, { parser: 'typescript', singleQuote: true, trailingComma: 'none' });
+};
+
+(async () => {
+ const path = process.argv[2];
+
+ if (!path) {
+ console.error('Please provide a CSV file path');
+ process.exit();
+ }
+
+ const csv = await readFile(path, 'utf8');
+ const map = createTimeZones(csv);
+
+ map.forEach(async timezone => {
+ const { dir, name } = getPath(timezone);
+
+ await mkdir(dir, { recursive: true });
+ await writeFile(join(dir, name), await format(timezone));
+ });
+})();
diff --git a/tools/zonename.ts b/tools/zonename.ts
new file mode 100644
index 0000000..cfb3911
--- /dev/null
+++ b/tools/zonename.ts
@@ -0,0 +1,98 @@
+/**
+ * @description
+ * This script reads timezone data from a CSV file obtained from timezonedb.com,
+ * extracts unique timezone names, and generates a mapping of timezone long names
+ * to their abbreviations by analyzing timezone name variations across historical time periods.
+ */
+
+import { readFile } from 'node:fs/promises';
+import prettier from 'prettier';
+import zonenames from '../src/zonenames.ts';
+
+const getTimezone = async (path: string) => {
+ try {
+ const csv = await readFile(path, 'utf8');
+ const timezones = new Set();
+
+ csv.split('\n').forEach(line => {
+ const [zone_name] = line.split(',');
+
+ if (zone_name) {
+ timezones.add(zone_name);
+ }
+ });
+ return Array.from(timezones);
+ } catch (e) {
+ console.error(`Error reading CSV file: ${path}`);
+ console.error(e);
+ return [];
+ }
+};
+
+const getTimezoneName = (dtf: Intl.DateTimeFormat, time: number) => {
+ return dtf.formatToParts(time).find(part => part.type === 'timeZoneName')?.value.replace(/^GMT([+-].+)?$/, '') || '';
+};
+
+const getTimezoneNames = (timeZone: string, names: Record) => {
+ const dtf = new Intl.DateTimeFormat('en-US', { timeZone, timeZoneName: 'long' });
+ const map = new Map();
+ const errors = new Set();
+
+ const start = Date.UTC(0, -12 * 16, 1); // year 1884
+ const end = Date.UTC(new Date().getUTCFullYear(), 0, 1); // current year
+ const step = 30 * 24 * 60 * 60 * 1000; // 30days
+
+ for (let i = start, len = end; i < len; i += step) {
+ const timeZoneName = getTimezoneName(dtf, i);
+
+ if (timeZoneName && !map.has(timeZoneName)) {
+ const abbreviation = names[timeZoneName];
+
+ if (abbreviation) {
+ map.set(timeZoneName, abbreviation);
+ } else {
+ errors.add(timeZoneName);
+ }
+ }
+ }
+ return { names: map, errors };
+};
+
+const sort = (timeZoneNames: Map) => {
+ return new Map(Array.from(timeZoneNames).sort((a, b) => a[0].localeCompare(b[0])));
+};
+
+const format = (code: Map) => {
+ return prettier.format(`export default {
+ ${Array.from(code).map(([key, value]) => `'${key}': '${value}',`).join('\n')}
+ };`, { parser: 'typescript', singleQuote: true, trailingComma: 'none' });
+};
+
+(async () => {
+ const path = process.argv[2];
+
+ if (!path) {
+ console.error('Please provide a CSV file path');
+ process.exit();
+ }
+
+ const timezones = await getTimezone(path);
+ const timeZoneNames = new Map();
+ const errorNames = new Set();
+
+ timezones.forEach(timeZone => {
+ const { names, errors } = getTimezoneNames(timeZone, zonenames);
+
+ for (const [key, value] of names.entries()) {
+ timeZoneNames.set(key, value);
+ }
+ errors.forEach(err => errorNames.add(err));
+ });
+
+ if (errorNames.size) {
+ console.error('Not Found');
+ console.error(Array.from(errorNames));
+ } else {
+ process.stdout.write(await format(sort(timeZoneNames)));
+ }
+})();
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..1e856fc
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,108 @@
+{
+ "compilerOptions": {
+ /* Visit https://aka.ms/tsconfig to read more about this file */
+
+ /* Projects */
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
+
+ /* Language and Environment */
+ "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
+ "lib": ["ES2021", "DOM"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
+
+ /* Modules */
+ "module": "ESNext", /* Specify what module code is generated. */
+ // "rootDir": "./", /* Specify the root folder within your source files. */
+ "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
+ "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
+ // "resolveJsonModule": true, /* Enable importing .json files. */
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
+ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */
+
+ /* JavaScript Support */
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
+
+ /* Emit */
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
+ "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
+ // "removeComments": true, /* Disable emitting comments. */
+ // "noEmit": true, /* Disable emitting files from a compilation. */
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
+
+ /* Interop Constraints */
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
+ // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
+ // "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
+ // "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
+
+ /* Type Checking */
+ "strict": true, /* Enable all strict type-checking options. */
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
+
+ /* Completeness */
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
+ }
+}
\ No newline at end of file
diff --git a/vitest.config.ts b/vitest.config.ts
new file mode 100644
index 0000000..6d935c5
--- /dev/null
+++ b/vitest.config.ts
@@ -0,0 +1,17 @@
+import { defineConfig } from 'vitest/config';
+
+export default defineConfig({
+ esbuild: {
+ target: 'es2021',
+ sourcemap: true
+ },
+ test: {
+ coverage: {
+ exclude: ['src/**/*.d.ts'],
+ include: ['src/**/*.ts'],
+ provider: 'v8',
+ reporter: ['json-summary', 'html']
+ },
+ include: ['tests/**/*.spec.ts']
+ }
+});