diff --git a/README.md b/README.md index e2982cc07..5b9bfe216 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,10 @@ This project exists thanks to all the people who contribute. Please give us a 💖 star 💖 to support us. Thank you. And thank you to all our backers! 🙏 + + + + ## License diff --git a/docs/en/API-reference.md b/docs/en/API-reference.md index 75788edee..aa8ad550e 100644 --- a/docs/en/API-reference.md +++ b/docs/en/API-reference.md @@ -270,7 +270,7 @@ Returns a `string` with the `Dayjs`'s formatted date. To escape characters, wrap them in square brackets (e.g. `[A] [MM]`). ```js -dayjs().format() // current date in ISO6801, without fraction seconds e.g. '2020-04-02T08:02:17-05:00' +dayjs().format() // current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00' dayjs('2019-01-25').format('[YYYY] YYYY-MM-DDTHH:mm:ssZ[Z]') // 'YYYY 2019-01-25T00:00:00-02:00Z' @@ -455,6 +455,12 @@ plugin [`IsLeapYear`](./Plugin.md#isleapyear) plugin [`WeekOfYear`](./Plugin.md#weekofyear) +### WeekDay + +`.weekday` to get or set locale aware day of the week + +plugin [`WeekDay`](./Plugin.md#weekday) + ### IsoWeeksInYear `.isoWeeksInYear` to get the number of weeks in year diff --git a/docs/en/I18n.md b/docs/en/I18n.md index 6226e32f6..045cb8c1e 100644 --- a/docs/en/I18n.md +++ b/docs/en/I18n.md @@ -122,6 +122,10 @@ const localeObject = { MM: '%d months', y: 'a year', yy: '%d years' + }, + meridiem: (hour, minute, isLowercase) => { + // OPTIONAL, AM/PM + return hour > 12 ? 'PM' : 'AM' } } ``` diff --git a/docs/en/Plugin.md b/docs/en/Plugin.md index c54ec91cd..506e6a992 100644 --- a/docs/en/Plugin.md +++ b/docs/en/Plugin.md @@ -286,6 +286,19 @@ dayjs('2018-06-27').week() // 26 dayjs('2018-06-27').week(5) // set week ``` +### WeekDay + +- WeekDay adds `.weekday()` API to get or set locale aware day of the week. + +```javascript +import weekDay from 'dayjs/plugin/weekDay' + +dayjs.extend(weekDay) +// when Monday is the first day of the week +dayjs().weekday(-7) // last Monday +dayjs().weekday(7) // next Monday +``` + ### IsoWeeksInYear - IsoWeeksInYear adds `.isoWeeksInYear()` API to return a `number` to get the number of weeks in year, according to ISO weeks. diff --git a/docs/es-es/API-reference.md b/docs/es-es/API-reference.md index 3c8913700..01e397d75 100644 --- a/docs/es-es/API-reference.md +++ b/docs/es-es/API-reference.md @@ -270,7 +270,7 @@ Devuelve un dato de tipo `string` con la fecha del objeto `Dayjs` formateada. Para escapar caracteres, estos se han de encerrar entre corchetes (p.ej.: `[A] [MM]`). ```js -dayjs().format() // fecha actual en ISO6801, sin fracciones de segundo p.ej. '2020-04-02T08:02:17-05:00' +dayjs().format() // fecha actual en ISO8601, sin fracciones de segundo p.ej. '2020-04-02T08:02:17-05:00' dayjs('2019-01-25').format('[YYYY] YYYY-MM-DDTHH:mm:ssZ[Z]') // 'YYYY 2019-01-25T00:00:00-02:00Z' @@ -455,6 +455,12 @@ complemento [`IsLeapYear`](./Plugin.md#isleapyear) complemento [`WeekOfYear`](./Plugin.md#weekofyear) +### WeekDay + +`.weekday` to get or set locale aware day of the week + +plugin [`WeekDay`](./Plugin.md#weekday) + ### IsoWeeksInYear `.isoWeeksInYear` to get the number of weeks in year diff --git a/docs/es-es/I18n.md b/docs/es-es/I18n.md index 30a950d52..551f38787 100644 --- a/docs/es-es/I18n.md +++ b/docs/es-es/I18n.md @@ -111,6 +111,10 @@ const localeObject = { MM: '%d months', y: 'a year', yy: '%d years' + }, + meridiem: (hour, minute, isLowercase) => { + // OPTIONAL, AM/PM + return hour > 12 ? 'PM' : 'AM' } } ``` diff --git a/docs/es-es/Plugin.md b/docs/es-es/Plugin.md index 1b5362afd..fe05f0806 100644 --- a/docs/es-es/Plugin.md +++ b/docs/es-es/Plugin.md @@ -282,6 +282,19 @@ dayjs('2018-06-27').week() // 26 dayjs('2018-06-27').week(5) // set week ``` +### WeekDay + +- WeekDay adds `.weekday()` API to get or set locale aware day of the week. + +```javascript +import weekDay from 'dayjs/plugin/weekDay' + +dayjs.extend(weekDay) +// when Monday is the first day of the week +dayjs().weekday(-7) // last Monday +dayjs().weekday(7) // next Monday +``` + ### IsoWeeksInYear - IsoWeeksInYear adds `.isoWeeksInYear()` API to return a `number` to get the number of weeks in year, according to ISO weeks. diff --git a/docs/ja/API-reference.md b/docs/ja/API-reference.md index c86257732..529e632f3 100644 --- a/docs/ja/API-reference.md +++ b/docs/ja/API-reference.md @@ -4,326 +4,299 @@ Day.js は組み込みの `Date.prototype` を変更する代わりに `Dayjs` `Dayjs` オブジェクトは不変 (immutable) です。すなわち、すべての API 操作は新しい `Dayjs` オブジェクトを返します。 -- [Parse](#parse) - - [Now](#now) - - [String](#string) - - [Date](#date) - - [Unix Timestamp (milliseconds)](#unix-timestamp-milliseconds) - - [Unix Timestamp (seconds)](#unix-timestamp-seconds) +- [API Reference](#api-reference) +- [Parsing](#parsing) + - [Constructor `dayjs(dateType?: string | number | Date | Dayjs)`](#constructor-dayjsdatetype-string--number--date--dayjs) + - [ISO 8601 形式](#iso-8601-%E5%BD%A2%E5%BC%8F) + - [Native Javascript Date object](#native-javascript-date-object) + - [Unix Timestamp (milliseconds)](#unix-timestamp-milliseconds) + - [Unix Timestamp (seconds) `.unix(value: number)`](#unix-timestamp-seconds-unixvalue-number) - [Custom Parse Format](#custom-parse-format) - - [Clone](#clone) - - [Validation](#validation) -- [Get + Set](#get--set) - - [Year](#year) - - [Month](#month) - - [Date of Month](#date-of-month) - - [Day of Week](#day-of-week) - - [Hour](#hour) - - [Minute](#minute) - - [Second](#second) - - [Millisecond](#millisecond) - - [Get](#get) - - [Set](#set) -- [Manipulate](#manipulate) - - [Add](#add) - - [Subtract](#subtract) - - [Start of Time](#start-of-time) - - [End of Time](#end-of-time) -- [Display](#display) - - [Format](#format) - - [Difference](#difference) - - [Unix Timestamp (milliseconds)](#unix-timestamp-milliseconds-1) - - [Unix Timestamp (seconds)](#unix-timestamp-seconds) - - [UTC offset (minutes)](#utc-offset-minutes-utcoffset) - - [Days in Month](#days-in-month) - - [As Javascript Date](#as-javascript-date) - - [As JSON](#as-json) - - [As ISO 8601 String](#as-iso-8601-string) - - [As String](#as-string) + - [Clone `.clone() | dayjs(original: Dayjs)`](#clone-clone--dayjsoriginal-dayjs) + - [Validation `.isValid()`](#validation-isvalid) +- [Get and Set](#get-and-set) + - [Year `.year()`](#year-year) + - [Month `.month()`](#month-month) + - [Day of the Month `.date()`](#day-of-the-month-date) + - [Day of the Week `.day()`](#day-of-the-week-day) + - [Hour `.hour()`](#hour-hour) + - [Minute `.minute()`](#minute-minute) + - [Second `.second()`](#second-second) + - [Millisecond `.millisecond()`](#millisecond-millisecond) + - [Get `.get(unit: string)`](#get-getunit-string) + - [List of all available units](#list-of-all-available-units) + - [Set `.set(unit: string, value: number)`](#set-setunit-string-value-number) +- [Manipulating](#manipulating) + - [Add `.add(value: number, unit: string)`](#add-addvalue-number-unit-string) + - [Subtract `.subtract(value: number, unit: string)`](#subtract-subtractvalue-number-unit-string) + - [Start of Time `.startOf(unit: string)`](#start-of-time-startofunit-string) + - [End of Time `.endOf(unit: string)`](#end-of-time-endofunit-string) +- [Displaying](#displaying) + - [Format `.format(stringWithTokens: string)`](#format-formatstringwithtokens-string) + - [List of all available formats](#list-of-all-available-formats) + - [Difference `.diff(compared: Dayjs, unit: string (default: 'milliseconds'), float?: boolean)`](#difference-diffcompared-dayjs-unit-string-default-milliseconds-float-boolean) + - [Unix Timestamp (milliseconds) `.valueOf()`](#unix-timestamp-milliseconds-valueof) + - [Unix Timestamp (seconds) `.unix()`](#unix-timestamp-seconds-unix) + - [UTC Offset (minutes) `.utcOffset()`](#utc-offset-minutes-utcoffset) + - [Days in the Month `.daysInMonth()`](#days-in-the-month-daysinmonth) + - [As Javascript Date `.toDate()`](#as-javascript-date-todate) + - [As JSON `.toJSON()`](#as-json-tojson) + - [As ISO 8601 String `.toISOString()`](#as-iso-8601-string-toisostring) + - [As String `.toString()`](#as-string-tostring) - [Query](#query) - - [Is Before](#is-before) - - [Is Same](#is-same) - - [Is After](#is-after) - - [Is a Dayjs](#is-a-dayjs) + - [Is Before `.isBefore(compared: Dayjs, unit?: string)`](#is-before-isbeforecompared-dayjs-unit-string) + - [Is Same `.isSame(compared: Dayjs, unit?: string)`](#is-same-issamecompared-dayjs-unit-string) + - [Is After `.isAfter(compared: Dayjs, unit?: string)`](#is-after-isaftercompared-dayjs-unit-string) + - [Is a Dayjs `.isDayjs(compared: any)`](#is-a-dayjs-isdayjscompared-any) - [UTC](#utc) - [Plugin APIs](#plugin-apis) ---- +## Parsing -Day.js は指定されない限り、常に新しい Dayjs オブジェクトを返します。 +### Constructor `dayjs(dateType?: string | number | Date | Dayjs)` -### Parse - -サポートされている入力形式のいずれかで `dayjs()` を呼び出します。 - -#### Now - -現在の日付と時間を取得するには、パラメータなしで dayjs() を呼び出します。 +パラメータなしで実行すると現在の日付と時刻を持った新しい`Dayjs`オブジェクトを返します。 ```js dayjs() ``` -### String +Day.js は他の日付フォーマットもパースします。 -[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) に準拠する形式から作成します。 +#### [ISO 8601](https://ja.wikipedia.org/wiki/ISO_8601) 形式 ```js -dayjs(String) -dayjs('1995-12-25') +dayjs('2018-04-04T16:00:00.000Z') ``` -### Date - -JavaScript の組み込みの Date オブジェクトを渡します。 +#### Native Javascript Date object ```js -dayjs(Date) dayjs(new Date(2018, 8, 18)) ``` -### Unix Timestamp (milliseconds) +#### Unix Timestamp (milliseconds) -Unix エポック (1970 年 1 月 1 日 12:00AM UTC) 以降のミリ秒数を表す整数値を渡します。 +Unix タイムスタンプ(Unix エポックのミリ秒)から`Dayjs`オブジェクトを返します。 ```js -dayjs(Number) dayjs(1318781876406) ``` -### Unix Timestamp (seconds) +### Unix Timestamp (seconds) `.unix(value: number)` + +Unix タイムスタンプ(Unix エポックの秒)から`Dayjs`オブジェクトを返します。 ```js -dayjs.unix(Number) dayjs.unix(1318781876) +dayjs.unix(1318781876.721) ``` ### Custom Parse Format -- parse custom formats `dayjs("12-25-1995", "MM-DD-YYYY")` in plugin [`CustomParseFormat`](./Plugin.md#customparseformat) +- `dayjs("12-25-1995", "MM-DD-YYYY")` といった独自フォーマットのパースは[`CustomParseFormat`](./Plugin.md#customparseformat)で利用できます。 -### Clone +### Clone `.clone() | dayjs(original: Dayjs)` -すべての `Dayjs` は不変 (immutable) です。 オブジェクトのコピーが必要な場合は、 `.clone()` を呼び出してください。 -`Dayjs` オブジェクトに対して dayjs() を呼び出すと、それもクローンされます。 +`Dayjs`オブジェクトを複製して返します。 ```js -dayjs(Dayjs) dayjs().clone() +dayjs(dayjs('2019-01-25')) // Dayjsオブジェクトをコンストラクタに渡しても複製されます ``` -### Validation - -- Boolean を返します +### Validation `.isValid()` -`Dayjs` オブジェクトが有効な日付かどうかをチェックします。 +`Dayjs`の日付が有効かの真偽値を返します。 ```js dayjs().isValid() ``` ---- - -### Get + Set - -日付の取得と設定です。 +## Get and Set -#### Year +### Year `.year()` -Gets or sets the year. +年の取得と設定。 ```js dayjs().year() dayjs().year(2000) ``` -#### Month +### Month `.month()` -Gets or sets the month. Starts at 0 +月の取得と設定です。月は`0`から始まります。 ```js dayjs().month() dayjs().month(0) ``` -#### Date of Month +### Day of the Month `.date()` -Gets or sets the day of the month. Starts at 1 +月の日にちの取得と設定です。日にちは`1`から始まります。 ```js dayjs().date() dayjs().date(1) ``` -#### Day of Week +### Day of the Week `.day()` -Gets or sets the day of the week. Starts on Sunday with 0 +曜日の取得と設定です。`0`で日曜日から始まります。 ```js dayjs().day() dayjs().day(0) ``` -#### Hour +### Hour `.hour()` -Gets or sets the hour. +時の取得と設定です。 ```js dayjs().hour() dayjs().hour(12) ``` -#### Minute +### Minute `.minute()` -Gets or sets the minute. +分の取得と設定です。 ```js dayjs().minute() dayjs().minute(59) ``` -#### Second +### Second `.second()` -Gets or sets the second. +秒の取得と設定です。 ```js dayjs().second() dayjs().second(1) ``` -#### Millisecond +### Millisecond `.millisecond()` -Gets or sets the millisecond. +ミリ秒の取得と設定です。 ```js dayjs().millisecond() dayjs().millisecond(1) ``` -#### Get +### Get `.get(unit: string)` -Returns a `number` with information getting from `Dayjs` object -単位は大文字・小文字を区別しません。 +`Dayjs` オブジェクトから`数値`を返します。 ```js -dayjs().get(unit: String) -dayjs().get('month') // start 0 +dayjs().get('month') // `0`始まり dayjs().get('day') ``` #### List of all available units -| Unit | Shorthand | Description | -| ------------- | --------- | ---------------------------------------- | -| `date` | | Date of Month | -| `day` | `d` | Day of Week (Sunday as 0, Saturday as 6) | -| `month` | `M` | Month (January as 0, December as 11) | -| `year` | `y` | Year | -| `hour` | `h` | Hour | -| `minute` | `m` | Minute | -| `second` | `s` | Second | -| `millisecond` | `ms` | Millisecond | +| 単位 | ショートハンド | 説明 | +| ------------- | -------------- | -------------------------------- | +| `date` | | 月の日ひち | +| `day` | `d` | 曜日(日曜日は`0`、土曜日は`6`) | +| `month` | `M` | 月(1 月は`0`、12 月は`11`) | +| `year` | `y` | 年 | +| `hour` | `h` | 時 | +| `minute` | `m` | 分 | +| `second` | `s` | 秒 | +| `millisecond` | `ms` | ミリ秒 | -#### Set +### Set `.set(unit: string, value: number)` -日付のセッターです。 +変更を適応した`Dayjs`オブジェクトを返します。 ```js -dayjs().set(unit: String, value: Int) dayjs().set('date', 1) dayjs().set('month', 3) // 4月 dayjs().set('second', 30) ``` -### Manipulate +## Manipulating -`Dayjs` オブジェクトは次のような方法で操作することができます: +様々な方法で`Dayjs`オブジェクトを操作できます。 ```js -dayjs() - .startOf('month') +dayjs('2019-01-25') .add(1, 'day') .subtract(1, 'year') + .toString() // Fri, 26 Jan 2018 00:00:00 GMT ``` -#### Add +### Add `.add(value: number, unit: string)` -時間を足して新しい `Dayjs` オブジェクトを返します。 +指定した時間を追加した`Dayjs`オブジェクトを複製して返します。 ```js -dayjs().add(value: Number, unit: String) dayjs().add(7, 'day') ``` -#### Subtract +### Subtract `.subtract(value: number, unit: string)` -時間を引いて新しい `Dayjs` オブジェクトを返します。 `dayjs#add` と全く同じです。 +指定した時間を引いた`Dayjs`オブジェクトを複製して返します。 ```js -dayjs().subtract((value: Number), (unit: String)) dayjs().subtract(7, 'year') ``` -#### Start of Time - -Returns a new `Dayjs` object by by setting it to the start of a unit of time. +### Start of Time `.startOf(unit: string)` -ある単位の始まりの時間の新しい `Dayjs` オブジェクトを返します。 +指定した単位の開始時点に設定された`Dayjs`オブジェクトを複製して返します。 ```js -dayjs().startOf((unit: String)) -dayjs().startOf('week') // Depends on `weekStart` in locale +dayjs().startOf('week') // locale の `weekStart` に依存 ``` -#### End of Time +### End of Time `.endOf(unit: string)` -ある単位の終わりの時間の新しい `Dayjs` オブジェクトを返します。 +指定した単位の終了時点に設定された`Dayjs`オブジェクトを複製して返します。 ```js -dayjs().endOf((unit: String)) dayjs().endOf('month') ``` ---- - -### Display - -パースや操作が完了したならば `Dayjs` オブジェクトを表示する方法が求められるはずです。 +## Displaying -#### Format +### Format `.format(stringWithTokens: string)` -- String を返します - -文字列を受け取り、対応する日付の値で置き換えます。 +フォーマットされた日付の文字列を返します。 +文字をエスケープするにはブラケットで囲みます。(例 `[A][MM]`) ```js -dayjs().format(String) -dayjs().format() // "2014-09-08T08:02:17-05:00" (ISO 8601 形式、小数部は含まない) +dayjs().format() // ISO8601形式で、端数秒なしの現在の日時。例 '2020-04-02T08:02:17-05:00' + dayjs('2019-01-25').format('[YYYY] YYYY-MM-DDTHH:mm:ssZ[Z]') // 'YYYY 2019-01-25T00:00:00-02:00Z' -``` -- 文字列内の文字をエスケープするには、文字を角括弧で囲みます (例: [Z]) 。 +dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019' +``` -使用可能なフォーマットの一覧: +#### List of all available formats | フォーマット | 出力 | 説明 | | ------------ | ---------------- | --------------------------- | | `YY` | 18 | 2 桁の年 | | `YYYY` | 2018 | 4 桁の年 | | `M` | 1-12 | 1 始まりの月 | -| `MM` | 01-12 | 1 始まりかつ 2 桁の月 | +| `MM` | 01-12 | 1 始まりの 2 桁の月 | | `MMM` | Jan-Dec | 月の略称 | | `MMMM` | January-December | 月の正式名 | -| `D` | 1-31 | 日 | -| `DD` | 01-31 | 2 桁の日 | -| `d` | 0-6 | 曜日 (日曜は 0) | +| `D` | 1-31 | 月ごとの日にち | +| `DD` | 01-31 | 月ごとの 2 桁の日にち | +| `d` | 0-6 | `0`で日曜日から始まる曜日 | | `dd` | Su-Sa | 最も短い曜日の略称 | | `ddd` | Sun-Sat | 曜日の略称 | | `dddd` | Sunday-Saturday | 曜日名 | | `H` | 0-23 | 時間 | | `HH` | 00-23 | 2 桁の時間 | | `h` | 1-12 | 12 時制の時間 | -| `hh` | 01-12 | 12 時制かつ 2 桁の時間 | +| `hh` | 01-12 | 12 時制で 2 桁の時間 | | `m` | 0-59 | 分 | | `mm` | 00-59 | 2 桁の分 | | `s` | 0-59 | 秒 | @@ -331,17 +304,15 @@ dayjs('2019-01-25').format('[YYYY] YYYY-MM-DDTHH:mm:ssZ[Z]') // 'YYYY 2019-01-25 | `SSS` | 000-999 | 3 桁のミリ秒 | | `Z` | +5:00 | UTC からのオフセット | | `ZZ` | +0500 | UTC からの 2 桁のオフセット | -| `A` | AM PM | 午前と午後 (大文字) | -| `a` | am pm | 午前と午後 (小文字) | +| `A` | AM PM | 午前と午後(大文字) | +| `a` | am pm | 午前と午後(小文字) | -- plugin [`AdvancedFormat`](./Plugin.md#advancedformat) にはより多くのフォーマット(例: `Q Do k kk X x ...` )が存在します。 -- Localized format options `L LT LTS ...` in plugin [`LocalizedFormat`](./Plugin.md#localizedFormat) +- 利用可能な他のフォーマット `Q Do k kk X x ...` in plugin [`AdvancedFormat`](./Plugin.md#advancedformat) +- ローカライズのフォーマットオプション `L LT LTS ...` in plugin [`LocalizedFormat`](./Plugin.md#localizedFormat) -#### Difference +### Difference `.diff(compared: Dayjs, unit: string (default: 'milliseconds'), float?: boolean)` -- Number を返します - -2 つの `Dayjs` オブジェクトの差をミリ秒単位で取得します。 +2 つの`Dayjs`オブジェクトの差分を指定した単位で数値で返します。 ```js const date1 = dayjs('2019-01-25') @@ -352,214 +323,194 @@ date1.diff(date2, 'month', true) // 7.645161290322581 date1.diff(date2, 'day') // 233 ``` -#### Unix Timestamp (milliseconds) - -- Number を返します +### Unix Timestamp (milliseconds) `.valueOf()` -Unix エポックからのミリ秒数を出力します。 +`Dayjs`オブジェクトの Unix エポックからのミリ秒を数値で返します。 ```js -dayjs().valueOf() +dayjs('2019-01-25').valueOf() // 1548381600000 ``` -#### Unix Timestamp (seconds) - -- Number を返します +### Unix Timestamp (seconds) `.unix()` -Unix タイムスタンプ (Unix エポックからの秒数) を出力します。 +`Dayjs`オブジェクトの Unix エポックからの秒を数値で返します。 ```js -dayjs().unix() +dayjs('2019-01-25').unix() // 1548381600 ``` -### UTC Offset (minutes) +### UTC Offset (minutes) `.utcOffset()` -Returns the UTC offset in minutes for the `Dayjs`. +`Dayjs`オブジェクトの UTC オフセットを分単位の数値で返します。 ```js dayjs().utcOffset() ``` -#### Days in Month +### Days in the Month `.daysInMonth()` -- Number を返します - -その月の日数を取得します。 +`Dayjs`オブジェクトの月の日数を数値で返します。 ```js -dayjs().daysInMonth() +dayjs('2019-01-25').daysInMonth() // 31 ``` -#### As Javascript Date - -- Javascript の `Date` オブジェクトを返します +### As Javascript Date `.toDate()` -`Dayjs` オブジェクトから組み込みの `Date` オブジェクトのコピーを取得します。 +`Dayjs`オブジェクトをパースして複製したネイティブの`Date`オブジェクトを返します。 ```js -dayjs().toDate() +dayjs('2019-01-25').toDate() ``` -#### As JSON +### As JSON `.toJSON()` -- JSON String を返します - -`Dayjs` オブジェクトを JSON シリアライズし、ISO8601 形式の日付文字列を返します。 +`Dayjs`オブジェクトの日付を ISO8601 形式にして文字列で返します。 ```js -dayjs().toJSON() //"2018-08-08T00:00:00.000Z" +dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z' ``` -#### As ISO 8601 String - -- String を返します +### As ISO 8601 String `.toISOString()` -ISO8601 形式の文字列にフォーマットします。 +`Dayjs`オブジェクトの日付を ISO8601 形式にして文字列で返します。 ```js -dayjs().toISOString() +dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z' ``` -#### As String +### As String `.toString()` -- String を返します +日付を文字列で返します。 ```js -dayjs().toString() +dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT' ``` ---- +## Query -### Query +### Is Before `.isBefore(compared: Dayjs, unit?: string)` -#### Is Before - -- Boolean を返します - -`Dayjs` オブジェクトが別の `Dayjs` オブジェクト以前の値かどうかを判定します。 +`Dayjs`オブジェクトの日付が、引数に与えた他の`Dayjs`オブジェクトの日付より前かどうかの真偽値を返します。 ```js -dayjs().isBefore(Dayjs, unit? : String); -dayjs().isBefore(dayjs()); // false -dayjs().isBefore(dayjs(), 'year'); // false +dayjs().isBefore(dayjs()) // false +dayjs().isBefore(dayjs(), 'year') // false ``` -#### Is Same +### Is Same `.isSame(compared: Dayjs, unit?: string)` -- Boolean を返します - -`Dayjs` オブジェクトが別の `Dayjs` オブジェクトの値と等しいかどうかを判定します。 +`Dayjs`オブジェクトの日付が、引数に与えた他の`Dayjs`オブジェクトの日付と同じかどうかの真偽値を返します。 ```js -dayjs().isSame(Dayjs, unit? : String); -dayjs().isSame(dayjs()); // true -dayjs().isSame(dayjs(), 'year'); // true +dayjs().isSame(dayjs()) // true +dayjs().isSame(dayjs(), 'year') // true ``` -#### Is After - -- Boolean を返します +### Is After `.isAfter(compared: Dayjs, unit?: string)` -`Dayjs` オブジェクトが別の `Dayjs` オブジェクト以降の値かどうかを判定します。 +`Dayjs`オブジェクトの日付が、引数に与えた他の`Dayjs`オブジェクトの日付より後かどうかの真偽値を返します。 ```js -dayjs().isAfter(Dayjs, unit? : String); -dayjs().isAfter(dayjs()); // false -dayjs().isAfter(dayjs(), 'year'); // false +dayjs().isAfter(dayjs()) // false +dayjs().isAfter(dayjs(), 'year') // false ``` -#### Is a Dayjs +### Is a Dayjs `.isDayjs(compared: any)` -- Boolean を返します - -与えられた値が `Dayjs` オブジェクトであるかどうかを判定します。 +引数に与えた変数が`Dayjs`オブジェクトかどうかの真偽値を返します。 ```js -dayjs.isDayjs(compared: any); -dayjs.isDayjs(dayjs()); // true -dayjs.isDayjs(new Date()); // false +dayjs.isDayjs(dayjs()) // true +dayjs.isDayjs(new Date()) // false ``` -The operator `instanceof` works equally well: +`instanceof`オペレータでも同じように動作します。 ```js dayjs() instanceof dayjs // true ``` -### UTC +## UTC + +UTC でパースや表示をしたい場合は、[`UTC`](./Plugin.md#utc)プラグインの`.utc` `.local` `.isUTC` で行えます。 + +## Plugin APIs + +### RelativeTime -If you want to parse or display in UTC, you can use `.utc` `.local` `.isUTC` with plugin [`UTC`](./Plugin.md#utc) +`.from` `.to` `.fromNow` `.toNow` で相対時間が得られます。 -### Plugin APIs +プラグイン [`RelativeTime`](./Plugin.md#relativetime) -#### RelativeTime +### IsLeapYear -`.from` `.to` `.fromNow` `.toNow` は相対的な時刻を返します。 +`.isLeapYear` で閏年かどうかが得られます。 -plugin [`RelativeTime`](./Plugin.md#relativetime) +プラグイン [`IsLeapYear`](./Plugin.md#isleapyear) -#### IsLeapYear +### WeekOfYear -`.isLeapYear` はうるう年かどうかを返します。 +`.week` でその年における週数が得られます。 -plugin [`IsLeapYear`](./Plugin.md#isleapyear) +プラグイン [`WeekOfYear`](./Plugin.md#weekofyear) -#### WeekOfYear +### WeekDay -`.week` はその年の何週目かを返します。 +`.weekday` でロケールに対応した曜日の取得、設定ができます。 -plugin [`WeekOfYear`](./Plugin.md#weekofyear) +プラグイン [`WeekDay`](./Plugin.md#weekday) ### IsoWeeksInYear -`.isoWeeksInYear` to get the number of weeks in year +`.isoWeeksInYear` でその年の週数が得られます。 -plugin [`IsoWeeksInYear`](./Plugin.md#isoweeksinyear) +プラグイン [`IsoWeeksInYear`](./Plugin.md#isoweeksinyear) -#### IsSameOrAfter +### IsSameOrAfter -`.isSameOrAfter` はある日付が別の日付と同じまたは以降かどうかを判定します。 +`.isSameOrAfter` で日付が別の日付と同じかそれより後であるかを得られます。 -plugin [`IsSameOrAfter`](./Plugin.md#issameorafter) +プラグイン [`IsSameOrAfter`](./Plugin.md#issameorafter) -#### IsSameOrBefore +### IsSameOrBefore -`.isSameOrBefore` はある日付が別の日付と同じまたは以前かどうか判定します。 +`.isSameOrBefore`で日付が別の日付と同じかそれより前であるかを得られます。 -plugin [`IsSameOrBefore`](./Plugin.md#issameorbefore) +プラグイン [`IsSameOrBefore`](./Plugin.md#issameorbefore) -#### IsBetween +### IsBetween -`.isBetween` はある日付が別の 2 つの日付の間にあるかどうかを判定します。 +`.isBetween`で他の 2 つの日付の間であるかどうかを得られます。 -plugin [`IsBetween`](./Plugin.md#isbetween) +プラグイン [`IsBetween`](./Plugin.md#isbetween) ### QuarterOfYear -`.quarter` to get quarter of the year +`.quarter`で年の四半期のいつかが得られます。 -plugin [`QuarterOfYear`](./Plugin.md#quarterofyear) +プラグイン [`QuarterOfYear`](./Plugin.md#quarterofyear) ### ToArray -`.toArray` to return an `array` that mirrors the parameters +`.toArray`でパラメータの配列が得られます。 -plugin [`ToArray`](./Plugin.md#toarray) +プラグイン [`ToArray`](./Plugin.md#toarray) ### ToObject -`.toObject` to return an `object` with the date's properties. +`.toObject`でパラメータをキーに持ったオブジェクトが得られます。 -plugin [`ToObject`](./Plugin.md#toobject) +プラグイン [`ToObject`](./Plugin.md#toobject) ### MinMax -`.min` `.max` to compare given dayjs instances. +`.min` `.max`で与えた複数の`Dayjs`インスタンスの中から最小もしくは最大のものが得られます。 -plugin [`MinMax`](./Plugin.md#minmax) +プラグイン [`MinMax`](./Plugin.md#minmax) ### Calendar -`.calendar` to display calendar time +`.calendar`で与えた日付のカレンダー上の情報が得られます。 -plugin [`Calendar`](./Plugin.md#calendar) +プラグイン [`Calendar`](./Plugin.md#calendar) diff --git a/docs/ja/I18n.md b/docs/ja/I18n.md index a53e646df..70f013500 100644 --- a/docs/ja/I18n.md +++ b/docs/ja/I18n.md @@ -108,6 +108,10 @@ const localeObject = { MM: '%d months', y: 'a year', yy: '%d years' + }, + meridiem: (hour, minute, isLowercase) => { + // OPTIONAL, AM/PM + return hour > 12 ? 'PM' : 'AM' } } ``` diff --git a/docs/ja/Plugin.md b/docs/ja/Plugin.md index 2daa02cb0..487674770 100644 --- a/docs/ja/Plugin.md +++ b/docs/ja/Plugin.md @@ -291,6 +291,19 @@ dayjs('06/27/2018').week() // 26 dayjs('2018-06-27').week(5) // set week ``` +### WeekDay + +- WeekDay adds `.weekday()` API to get or set locale aware day of the week. + +```javascript +import weekDay from 'dayjs/plugin/weekDay' + +dayjs.extend(weekDay) +// when Monday is the first day of the week +dayjs().weekday(-7) // last Monday +dayjs().weekday(7) // next Monday +``` + ### IsoWeeksInYear - IsoWeeksInYear adds `.isoWeeksInYear()` API to return a `number` to get the number of weeks in year, according to ISO weeks. diff --git a/docs/ko/API-reference.md b/docs/ko/API-reference.md index efe06d52b..c53303c41 100644 --- a/docs/ko/API-reference.md +++ b/docs/ko/API-reference.md @@ -454,6 +454,12 @@ plugin [`IsLeapYear`](./Plugin.md#isleapyear) plugin [`WeekOfYear`](./Plugin.md#weekofyear) +### WeekDay + +`.weekday` to get or set locale aware day of the week + +plugin [`WeekDay`](./Plugin.md#weekday) + ### IsoWeeksInYear `.isoWeeksInYear` to get the number of weeks in year diff --git a/docs/ko/I18n.md b/docs/ko/I18n.md index 9862f0d32..421b05295 100644 --- a/docs/ko/I18n.md +++ b/docs/ko/I18n.md @@ -107,6 +107,10 @@ const localeObject = { MM: '%d months', y: 'a year', yy: '%d years' + }, + meridiem: (hour, minute, isLowercase) => { + // OPTIONAL, AM/PM + return hour > 12 ? 'PM' : 'AM' } } ``` diff --git a/docs/ko/Plugin.md b/docs/ko/Plugin.md index 25c706221..24e6f521e 100644 --- a/docs/ko/Plugin.md +++ b/docs/ko/Plugin.md @@ -283,6 +283,19 @@ dayjs('06/27/2018').week() // 26 dayjs('2018-06-27').week(5) // set week ``` +### WeekDay + +- WeekDay adds `.weekday()` API to get or set locale aware day of the week. + +```javascript +import weekDay from 'dayjs/plugin/weekDay' + +dayjs.extend(weekDay) +// when Monday is the first day of the week +dayjs().weekday(-7) // last Monday +dayjs().weekday(7) // next Monday +``` + ### IsoWeeksInYear - IsoWeeksInYear adds `.isoWeeksInYear()` API to return a `number` to get the number of weeks in year, according to ISO weeks. diff --git a/docs/pt-br/API-reference.md b/docs/pt-br/API-reference.md index 3617750c0..9e3b8d9ab 100644 --- a/docs/pt-br/API-reference.md +++ b/docs/pt-br/API-reference.md @@ -268,7 +268,7 @@ Retorna uma `string` com um objeto `Dayjs` contendo a data formatada. Para escapar caracteres, envolva-os entre colchetes (por exemplo: `[A] [MM]`). ```js -dayjs().format() // current date in ISO6801, without fraction seconds e.g. '2020-04-02T08:02:17-05:00' +dayjs().format() // current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00' dayjs('2019-01-25').format('[YYYY] YYYY-MM-DDTHH:mm:ssZ[Z]') // 'YYYY 2019-01-25T00:00:00-02:00Z' @@ -453,6 +453,12 @@ plugin [`IsLeapYear`](./Plugin.md#isleapyear) plugin [`WeekOfYear`](./Plugin.md#weekofyear) +### WeekDay + +`.weekday` to get or set locale aware day of the week + +plugin [`WeekDay`](./Plugin.md#weekday) + ### IsoWeeksInYear `.isoWeeksInYear` to get the number of weeks in year diff --git a/docs/pt-br/I18n.md b/docs/pt-br/I18n.md index 901b44c4a..04aaa92fa 100644 --- a/docs/pt-br/I18n.md +++ b/docs/pt-br/I18n.md @@ -122,6 +122,10 @@ const objetoLocale = { MM: '%d months', y: 'a year', yy: '%d years' + }, + meridiem: (hour, minute, isLowercase) => { + // OPTIONAL, AM/PM + return hour > 12 ? 'PM' : 'AM' } } ``` diff --git a/docs/pt-br/Plugin.md b/docs/pt-br/Plugin.md index 676cff560..b264d51f5 100644 --- a/docs/pt-br/Plugin.md +++ b/docs/pt-br/Plugin.md @@ -282,6 +282,19 @@ dayjs('06/27/2018').week() // 26 dayjs('2018-06-27').week(5) // set week ``` +### WeekDay + +- WeekDay adds `.weekday()` API to get or set locale aware day of the week. + +```javascript +import weekDay from 'dayjs/plugin/weekDay' + +dayjs.extend(weekDay) +// when Monday is the first day of the week +dayjs().weekday(-7) // last Monday +dayjs().weekday(7) // next Monday +``` + ### IsoWeeksInYear - IsoWeeksInYear adds `.isoWeeksInYear()` API to return a `number` to get the number of weeks in year, according to ISO weeks. diff --git a/docs/zh-cn/API-reference.md b/docs/zh-cn/API-reference.md index 52d6a2ec5..acc01f6c7 100644 --- a/docs/zh-cn/API-reference.md +++ b/docs/zh-cn/API-reference.md @@ -259,7 +259,7 @@ dayjs().add(7, 'day'); #### 减少 -减少时间并返回一个新的 `Dayjs()` 对象,使用方法和 `dayjs#add` 相同。 +减少时间并返回一个新的 `Dayjs()` 对象。 ```js dayjs().subtract(value : Number, unit : String); @@ -505,6 +505,12 @@ dayjs() instanceof dayjs // true 插件 [`WeekOfYear`](./Plugin.md#weekofyear) +### 星期 + +`.weekday` 来获取或设置当前语言的星期 + +plugin [`WeekDay`](./Plugin.md#weekday) + ### 年中有几周 ISO `.isoWeeksInYear` 获得年中有几周 diff --git a/docs/zh-cn/I18n.md b/docs/zh-cn/I18n.md index 8208bf81c..ca9ebf702 100644 --- a/docs/zh-cn/I18n.md +++ b/docs/zh-cn/I18n.md @@ -108,6 +108,10 @@ const localeObject = { MM: '%d months', y: 'a year', yy: '%d years' + }, + meridiem: (hour, minute, isLowercase) => { + // 可选, AM/PM + return hour > 12 ? '下午' : '上午' } } ``` diff --git a/docs/zh-cn/Plugin.md b/docs/zh-cn/Plugin.md index 6b82e2c3c..171388d42 100644 --- a/docs/zh-cn/Plugin.md +++ b/docs/zh-cn/Plugin.md @@ -285,6 +285,19 @@ dayjs('06/27/2018').week() // 26 dayjs('2018-06-27').week(5) // 设置周 ``` +### WeekDay + +- WeekDay 增加了 `.weekday()` API 来获取或设置当前语言的星期。 + +```javascript +import weekDay from 'dayjs/plugin/weekDay' + +dayjs.extend(weekDay) +// when Monday is the first day of the week +dayjs().weekday(-7) // last Monday +dayjs().weekday(7) // next Monday +``` + ### IsoWeeksInYear - IsoWeeksInYear 增加了 `.isoWeeksInYear()` API 返回一个 `number` 来得到依据 ISO week 标准一年中有几周 diff --git a/src/index.js b/src/index.js index 8c8841a81..0afb1830c 100644 --- a/src/index.js +++ b/src/index.js @@ -243,7 +243,7 @@ class Dayjs { const unit = Utils.p(units) const instanceFactorySet = (n) => { const date = new Date(this.$d) - date.setDate(date.getDate() + (n * number)) + date.setDate(date.getDate() + Math.round(n * number)) return Utils.w(date, this) } if (unit === C.M) { @@ -279,7 +279,7 @@ class Dayjs { const zoneStr = Utils.z(this) const locale = this.$locale() const { - weekdays, months + weekdays, months, meridiem } = locale const getShort = (arr, index, full, length) => ( (arr && arr[index]) || full[index].substr(0, length) @@ -288,6 +288,11 @@ class Dayjs { Utils.s(this.$H % 12 || 12, num, '0') ) + const meridiemFunc = meridiem || ((hour, minute, isLowercase) => { + const m = (hour < 12 ? 'AM' : 'PM') + return isLowercase ? m.toLowerCase() : m + }) + const matches = { YY: String(this.$y).slice(-2), YYYY: String(this.$y), @@ -305,8 +310,8 @@ class Dayjs { HH: Utils.s(this.$H, 2, '0'), h: get$H(1), hh: get$H(2), - a: this.$H < 12 ? 'am' : 'pm', - A: this.$H < 12 ? 'AM' : 'PM', + a: meridiemFunc(this.$H, this.$m, true), + A: meridiemFunc(this.$H, this.$m, false), m: String(this.$m), mm: Utils.s(this.$m, 2, '0'), s: String(this.$s), diff --git a/src/locale/af.js b/src/locale/af.js index e1bce5ace..ff7bd77d0 100644 --- a/src/locale/af.js +++ b/src/locale/af.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'), monthsShort: 'Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'), weekdaysMin: 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'oor %s', + past: '%s gelede', + s: "'n paar sekondes", + m: "'n minuut", + mm: '%d minute', + h: "'n uur", + hh: '%d ure', + d: "'n dag", + dd: '%d dae', + M: "'n maand", + MM: '%d maande', + y: "'n jaar", + yy: '%d jaar' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ar-dz.js b/src/locale/ar-dz.js index 651454eb0..a97eb11c9 100644 --- a/src/locale/ar-dz.js +++ b/src/locale/ar-dz.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), weekdaysMin: 'أح_إث_ثلا_أر_خم_جم_سب'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ar-kw.js b/src/locale/ar-kw.js index 106703090..e431eda1a 100644 --- a/src/locale/ar-kw.js +++ b/src/locale/ar-kw.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), monthsShort: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ar-ly.js b/src/locale/ar-ly.js index 932362927..cfdf1327e 100644 --- a/src/locale/ar-ly.js +++ b/src/locale/ar-ly.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), monthsShort: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/‏M/‏YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ar-ma.js b/src/locale/ar-ma.js index 819b06be9..29007412f 100644 --- a/src/locale/ar-ma.js +++ b/src/locale/ar-ma.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), monthsShort: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ar-sa.js b/src/locale/ar-sa.js index 1801f27c1..a619272e4 100644 --- a/src/locale/ar-sa.js +++ b/src/locale/ar-sa.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), monthsShort: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ar-tn.js b/src/locale/ar-tn.js index b84b8130f..96b804c59 100644 --- a/src/locale/ar-tn.js +++ b/src/locale/ar-tn.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ar.js b/src/locale/ar.js index 785341280..136431ca6 100644 --- a/src/locale/ar.js +++ b/src/locale/ar.js @@ -20,9 +20,18 @@ const locale = { y: 'عام واحد', yy: 'أعوام %d' }, - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/‏M/‏YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/az.js b/src/locale/az.js index cddb2b85b..c24f1b49c 100644 --- a/src/locale/az.js +++ b/src/locale/az.js @@ -37,3 +37,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/be.js b/src/locale/be.js index 6bc5dec93..80b47dd2c 100644 --- a/src/locale/be.js +++ b/src/locale/be.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'нд_пн_ат_ср_чц_пт_сб'.split('_'), monthsShort: 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), weekdaysMin: 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY г.', + LLL: 'D MMMM YYYY г., HH:mm', + LLLL: 'dddd, D MMMM YYYY г., HH:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/bg.js b/src/locale/bg.js index 29f33bd12..510bfd644 100644 --- a/src/locale/bg.js +++ b/src/locale/bg.js @@ -13,9 +13,25 @@ const locale = { LL: 'D MMMM YYYY', LLL: 'D MMMM YYYY H:mm', LLLL: 'dddd, D MMMM YYYY H:mm' + }, + relativeTime: { + future: 'след %s', + past: 'преди %s', + s: 'няколко секунди', + m: 'минута', + mm: '%d минути', + h: 'час', + hh: '%d часа', + d: 'ден', + dd: '%d дни', + M: 'месец', + MM: '%d месеца', + y: 'година', + yy: '%d години' } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/bm.js b/src/locale/bm.js index 911775ee1..a8134cf03 100644 --- a/src/locale/bm.js +++ b/src/locale/bm.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib'.split('_'), monthsShort: 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'), weekdaysMin: 'Ka_Nt_Ta_Ar_Al_Ju_Si'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'MMMM [tile] D [san] YYYY', + LLL: 'MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm', + LLLL: 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm' + }, + relativeTime: { + future: '%s kɔnɔ', + past: 'a bɛ %s bɔ', + s: 'sanga dama dama', + m: 'miniti kelen', + mm: 'miniti %d', + h: 'lɛrɛ kelen', + hh: 'lɛrɛ %d', + d: 'tile kelen', + dd: 'tile %d', + M: 'kalo kelen', + MM: 'kalo %d', + y: 'san kelen', + yy: 'san %d' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/bn.js b/src/locale/bn.js index 1675bbf47..efed438a4 100644 --- a/src/locale/bn.js +++ b/src/locale/bn.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'), monthsShort: 'জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'), weekdaysMin: 'রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm সময়', + LTS: 'A h:mm:ss সময়', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm সময়', + LLLL: 'dddd, D MMMM YYYY, A h:mm সময়' + }, + relativeTime: { + future: '%s পরে', + past: '%s আগে', + s: 'কয়েক সেকেন্ড', + m: 'এক মিনিট', + mm: '%d মিনিট', + h: 'এক ঘন্টা', + hh: '%d ঘন্টা', + d: 'এক দিন', + dd: '%d দিন', + M: 'এক মাস', + MM: '%d মাস', + y: 'এক বছর', + yy: '%d বছর' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/bo.js b/src/locale/bo.js index 738222572..9f213cb78 100644 --- a/src/locale/bo.js +++ b/src/locale/bo.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), monthsShort: 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), weekdaysMin: 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm' + }, + relativeTime: { + future: '%s ལ་', + past: '%s སྔན་ལ', + s: 'ལམ་སང', + m: 'སྐར་མ་གཅིག', + mm: '%d སྐར་མ', + h: 'ཆུ་ཚོད་གཅིག', + hh: '%d ཆུ་ཚོད', + d: 'ཉིན་གཅིག', + dd: '%d ཉིན་', + M: 'ཟླ་བ་གཅིག', + MM: '%d ཟླ་བ', + y: 'ལོ་གཅིག', + yy: '%d ལོ' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/br.js b/src/locale/br.js index 7c935ac7c..77cca1515 100644 --- a/src/locale/br.js +++ b/src/locale/br.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'), monthsShort: "Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split('_'), weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'h[e]mm A', + LTS: 'h[e]mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D [a viz] MMMM YYYY', + LLL: 'D [a viz] MMMM YYYY h[e]mm A', + LLLL: 'dddd, D [a viz] MMMM YYYY h[e]mm A' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/bs.js b/src/locale/bs.js index 052a2a39d..18bf21923 100644 --- a/src/locale/bs.js +++ b/src/locale/bs.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), monthsShort: 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ca.js b/src/locale/ca.js index 8586d6d2f..e77867073 100644 --- a/src/locale/ca.js +++ b/src/locale/ca.js @@ -37,3 +37,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/cs.js b/src/locale/cs.js index 0260aa00e..192e73e66 100644 --- a/src/locale/cs.js +++ b/src/locale/cs.js @@ -35,3 +35,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/cv.js b/src/locale/cv.js index 1bddc8457..37f44c64d 100644 --- a/src/locale/cv.js +++ b/src/locale/cv.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), monthsShort: 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), weekdaysMin: 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', + LLL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', + LLLL: 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/cy.js b/src/locale/cy.js index 62e032fd8..482a44108 100644 --- a/src/locale/cy.js +++ b/src/locale/cy.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'mewn %s', + past: '%s yn ôl', + s: 'ychydig eiliadau', + m: 'munud', + mm: '%d munud', + h: 'awr', + hh: '%d awr', + d: 'diwrnod', + dd: '%d diwrnod', + M: 'mis', + MM: '%d mis', + y: 'blwyddyn', + yy: '%d flynedd' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/da.js b/src/locale/da.js index d1f781783..5d6e0c53a 100644 --- a/src/locale/da.js +++ b/src/locale/da.js @@ -34,3 +34,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/de-at.js b/src/locale/de-at.js index 11db724b9..c39c6ca93 100644 --- a/src/locale/de-at.js +++ b/src/locale/de-at.js @@ -35,3 +35,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/de-ch.js b/src/locale/de-ch.js index 49e5ac110..c4746cbc4 100644 --- a/src/locale/de-ch.js +++ b/src/locale/de-ch.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), monthsShort: 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/de.js b/src/locale/de.js index 43b67bb85..b4d44a659 100644 --- a/src/locale/de.js +++ b/src/locale/de.js @@ -35,3 +35,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/dv.js b/src/locale/dv.js index 590ff6cb4..2aa5b675b 100644 --- a/src/locale/dv.js +++ b/src/locale/dv.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'އާދިއްތަ_ހޯމަ_އަންގާރަ_ބުދަ_ބުރާސްފަތި_ހުކުރު_ހޮނިހިރު'.split('_'), monthsShort: 'ޖެނުއަރީ_ފެބްރުއަރީ_މާރިޗު_އޭޕްރީލު_މޭ_ޖޫން_ޖުލައި_އޯގަސްޓު_ސެޕްޓެމްބަރު_އޮކްޓޯބަރު_ނޮވެމްބަރު_ޑިސެމްބަރު'.split('_'), weekdaysMin: 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/M/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'ތެރޭގައި %s', + past: 'ކުރިން %s', + s: 'ސިކުންތުކޮޅެއް', + m: 'މިނިޓެއް', + mm: 'މިނިޓު %d', + h: 'ގަޑިއިރެއް', + hh: 'ގަޑިއިރު %d', + d: 'ދުވަހެއް', + dd: 'ދުވަސް %d', + M: 'މަހެއް', + MM: 'މަސް %d', + y: 'އަހަރެއް', + yy: 'އަހަރު %d' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/el.js b/src/locale/el.js index 283197275..0f25fd540 100644 --- a/src/locale/el.js +++ b/src/locale/el.js @@ -21,9 +21,18 @@ const locale = { MM: '%d μήνες', y: 'ένα χρόνο', yy: '%d χρόνια' + }, + formats: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A' } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/en-SG.js b/src/locale/en-SG.js index 11805d522..50aed63a5 100644 --- a/src/locale/en-SG.js +++ b/src/locale/en-SG.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/en-au.js b/src/locale/en-au.js index 4b35e771e..71cba308c 100644 --- a/src/locale/en-au.js +++ b/src/locale/en-au.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A' + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/en-ca.js b/src/locale/en-ca.js index a14117202..4c9b59eb7 100644 --- a/src/locale/en-ca.js +++ b/src/locale/en-ca.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'YYYY-MM-DD', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A' + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/en-gb.js b/src/locale/en-gb.js index 8d916abcf..dfa84d2cc 100644 --- a/src/locale/en-gb.js +++ b/src/locale/en-gb.js @@ -41,3 +41,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/en-ie.js b/src/locale/en-ie.js index ae1f9815f..94e592c20 100644 --- a/src/locale/en-ie.js +++ b/src/locale/en-ie.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/en-il.js b/src/locale/en-il.js index a1e1bfb6b..e8787cc4e 100644 --- a/src/locale/en-il.js +++ b/src/locale/en-il.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/en-nz.js b/src/locale/en-nz.js index 66f3d4c42..190d8974a 100644 --- a/src/locale/en-nz.js +++ b/src/locale/en-nz.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A' + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/eo.js b/src/locale/eo.js index bc6144654..9d3231e6b 100644 --- a/src/locale/eo.js +++ b/src/locale/eo.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'), monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), weekdaysMin: 'di_lu_ma_me_ĵa_ve_sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'D[-a de] MMMM, YYYY', + LLL: 'D[-a de] MMMM, YYYY HH:mm', + LLLL: 'dddd, [la] D[-a de] MMMM, YYYY HH:mm' + }, + relativeTime: { + future: 'post %s', + past: 'antaŭ %s', + s: 'sekundoj', + m: 'minuto', + mm: '%d minutoj', + h: 'horo', + hh: '%d horoj', + d: 'tago', + dd: '%d tagoj', + M: 'monato', + MM: '%d monatoj', + y: 'jaro', + yy: '%d jaroj' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/es-do.js b/src/locale/es-do.js index 4b4ccb42b..bb680ab3b 100644 --- a/src/locale/es-do.js +++ b/src/locale/es-do.js @@ -23,9 +23,18 @@ const locale = { y: 'un año', yy: '%d años' }, - ordinal: n => `${n}º` + ordinal: n => `${n}º`, + formats: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY h:mm A', + LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/es-us.js b/src/locale/es-us.js index ba5b74d9a..65959b70a 100644 --- a/src/locale/es-us.js +++ b/src/locale/es-us.js @@ -22,9 +22,18 @@ const locale = { y: 'un año', yy: '%d años' }, - ordinal: n => `${n}º` + ordinal: n => `${n}º`, + formats: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'MM/DD/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY h:mm A', + LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/es.js b/src/locale/es.js index fb76b51c0..4cb487f47 100644 --- a/src/locale/es.js +++ b/src/locale/es.js @@ -37,3 +37,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/et.js b/src/locale/et.js index c4e5a1457..b9d8e18e4 100644 --- a/src/locale/et.js +++ b/src/locale/et.js @@ -31,9 +31,18 @@ const locale = { MM: '%d kuud', // for past tense y: 'aasta', // for past tense yy: '%d aastat' // for past tense + }, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm' } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/eu.js b/src/locale/eu.js index 5106811c7..3433a75ca 100644 --- a/src/locale/eu.js +++ b/src/locale/eu.js @@ -8,7 +8,34 @@ const locale = { weekdaysShort: 'ig._al._ar._az._og._ol._lr.'.split('_'), monthsShort: 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), weekdaysMin: 'ig_al_ar_az_og_ol_lr'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY[ko] MMMM[ren] D[a]', + LLL: 'YYYY[ko] MMMM[ren] D[a] HH:mm', + LLLL: 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', + l: 'YYYY-M-D', + ll: 'YYYY[ko] MMM D[a]', + lll: 'YYYY[ko] MMM D[a] HH:mm', + llll: 'ddd, YYYY[ko] MMM D[a] HH:mm' + }, + relativeTime: { + future: '%s barru', + past: 'duela %s', + s: 'segundo batzuk', + m: 'minutu bat', + mm: '%d minutu', + h: 'ordu bat', + hh: '%d ordu', + d: 'egun bat', + dd: '%d egun', + M: 'hilabete bat', + MM: '%d hilabete', + y: 'urte bat', + yy: '%d urte' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/fa.js b/src/locale/fa.js index 09d1d0841..7a6a1ba33 100644 --- a/src/locale/fa.js +++ b/src/locale/fa.js @@ -33,3 +33,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/fi.js b/src/locale/fi.js index f1f410898..238636b22 100644 --- a/src/locale/fi.js +++ b/src/locale/fi.js @@ -50,3 +50,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/fo.js b/src/locale/fo.js index a8d3b6ff8..c51dcb36a 100644 --- a/src/locale/fo.js +++ b/src/locale/fo.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'sun_mán_týs_mik_hós_frí_ley'.split('_'), monthsShort: 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), weekdaysMin: 'su_má_tý_mi_hó_fr_le'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D. MMMM, YYYY HH:mm' + }, + relativeTime: { + future: 'um %s', + past: '%s síðani', + s: 'fá sekund', + m: 'ein minuttur', + mm: '%d minuttir', + h: 'ein tími', + hh: '%d tímar', + d: 'ein dagur', + dd: '%d dagar', + M: 'ein mánaður', + MM: '%d mánaðir', + y: 'eitt ár', + yy: '%d ár' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/fr-ca.js b/src/locale/fr-ca.js index 4bf3b01ff..b03ba84bf 100644 --- a/src/locale/fr-ca.js +++ b/src/locale/fr-ca.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/fr-ch.js b/src/locale/fr-ch.js index 4f8c42a1c..e917818f2 100644 --- a/src/locale/fr-ch.js +++ b/src/locale/fr-ch.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/fr.js b/src/locale/fr.js index f4f374bc5..e7c1a9b8b 100644 --- a/src/locale/fr.js +++ b/src/locale/fr.js @@ -38,3 +38,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/fy.js b/src/locale/fy.js index 309fd0c45..371612146 100644 --- a/src/locale/fy.js +++ b/src/locale/fy.js @@ -7,7 +7,30 @@ const locale = { weekStart: 1, weekdaysShort: 'si._mo._ti._wo._to._fr._so.'.split('_'), weekdaysMin: 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'oer %s', + past: '%s lyn', + s: 'in pear sekonden', + m: 'ien minút', + mm: '%d minuten', + h: 'ien oere', + hh: '%d oeren', + d: 'ien dei', + dd: '%d dagen', + M: 'ien moanne', + MM: '%d moannen', + y: 'ien jier', + yy: '%d jierren' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ga.js b/src/locale/ga.js index dd7271b5f..36a8bb670 100644 --- a/src/locale/ga.js +++ b/src/locale/ga.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Dom_Lua_Mái_Céa_Déa_hAo_Sat'.split('_'), monthsShort: 'Eaná_Feab_Márt_Aibr_Beal_Méit_Iúil_Lúna_Meán_Deai_Samh_Noll'.split('_'), weekdaysMin: 'Do_Lu_Má_Ce_Dé_hA_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'i %s', + past: '%s ó shin', + s: 'cúpla soicind', + m: 'nóiméad', + mm: '%d nóiméad', + h: 'uair an chloig', + hh: '%d uair an chloig', + d: 'lá', + dd: '%d lá', + M: 'mí', + MM: '%d mí', + y: 'bliain', + yy: '%d bliain' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/gd.js b/src/locale/gd.js index 89724db93..bca103290 100644 --- a/src/locale/gd.js +++ b/src/locale/gd.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Did_Dil_Dim_Dic_Dia_Dih_Dis'.split('_'), monthsShort: 'Faoi_Gear_Màrt_Gibl_Cèit_Ògmh_Iuch_Lùn_Sult_Dàmh_Samh_Dùbh'.split('_'), weekdaysMin: 'Dò_Lu_Mà_Ci_Ar_Ha_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'ann an %s', + past: 'bho chionn %s', + s: 'beagan diogan', + m: 'mionaid', + mm: '%d mionaidean', + h: 'uair', + hh: '%d uairean', + d: 'latha', + dd: '%d latha', + M: 'mìos', + MM: '%d mìosan', + y: 'bliadhna', + yy: '%d bliadhna' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/gl.js b/src/locale/gl.js index d1619d36b..e9f1bb478 100644 --- a/src/locale/gl.js +++ b/src/locale/gl.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'), monthsShort: 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split('_'), weekdaysMin: 'do_lu_ma_mé_xo_ve_sá'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY H:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/gom-latn.js b/src/locale/gom-latn.js index 772004093..44b049dae 100644 --- a/src/locale/gom-latn.js +++ b/src/locale/gom-latn.js @@ -8,7 +8,16 @@ const locale = { weekdaysShort: 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'), monthsShort: 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split('_'), weekdaysMin: 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm [vazta]', + LTS: 'A h:mm:ss [vazta]', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY A h:mm [vazta]', + LLLL: 'dddd, MMMM[achea] Do, YYYY, A h:mm [vazta]', + llll: 'ddd, D MMM YYYY, A h:mm [vazta]' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/gu.js b/src/locale/gu.js index 37cc58007..cef554545 100644 --- a/src/locale/gu.js +++ b/src/locale/gu.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'), monthsShort: 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split('_'), weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm વાગ્યે', + LTS: 'A h:mm:ss વાગ્યે', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm વાગ્યે', + LLLL: 'dddd, D MMMM YYYY, A h:mm વાગ્યે' + }, + relativeTime: { + future: '%s મા', + past: '%s પેહલા', + s: 'અમુક પળો', + m: 'એક મિનિટ', + mm: '%d મિનિટ', + h: 'એક કલાક', + hh: '%d કલાક', + d: 'એક દિવસ', + dd: '%d દિવસ', + M: 'એક મહિનો', + MM: '%d મહિનો', + y: 'એક વર્ષ', + yy: '%d વર્ષ' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/he.js b/src/locale/he.js index b9353760c..03eeb6ffa 100644 --- a/src/locale/he.js +++ b/src/locale/he.js @@ -33,9 +33,22 @@ const locale = { ll: 'D MMM YYYY', lll: 'D MMM YYYY HH:mm', llll: 'ddd, D MMM YYYY HH:mm' + }, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [ב]MMMM YYYY', + LLL: 'D [ב]MMMM YYYY HH:mm', + LLLL: 'dddd, D [ב]MMMM YYYY HH:mm', + l: 'D/M/YYYY', + ll: 'D MMM YYYY', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd, D MMM YYYY HH:mm' } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/hi.js b/src/locale/hi.js index f8e181a49..d303175fd 100644 --- a/src/locale/hi.js +++ b/src/locale/hi.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), monthsShort: 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm बजे', + LTS: 'A h:mm:ss बजे', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm बजे', + LLLL: 'dddd, D MMMM YYYY, A h:mm बजे' + }, + relativeTime: { + future: '%s में', + past: '%s पहले', + s: 'कुछ ही क्षण', + m: 'एक मिनट', + mm: '%d मिनट', + h: 'एक घंटा', + hh: '%d घंटे', + d: 'एक दिन', + dd: '%d दिन', + M: 'एक महीने', + MM: '%d महीने', + y: 'एक वर्ष', + yy: '%d वर्ष' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/hr.js b/src/locale/hr.js index 62114f744..10823e580 100644 --- a/src/locale/hr.js +++ b/src/locale/hr.js @@ -34,3 +34,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/hu.js b/src/locale/hu.js index ff527e057..98ca649e4 100644 --- a/src/locale/hu.js +++ b/src/locale/hu.js @@ -23,9 +23,18 @@ const locale = { MM: '%d hónap', y: 'egy éve', yy: '%d év' + }, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'YYYY.MM.DD.', + LL: 'YYYY. MMMM D.', + LLL: 'YYYY. MMMM D. H:mm', + LLLL: 'YYYY. MMMM D., dddd H:mm' } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/hy-am.js b/src/locale/hy-am.js index aeaf6770c..f8440bc8b 100644 --- a/src/locale/hy-am.js +++ b/src/locale/hy-am.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), monthsShort: 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), weekdaysMin: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY թ.', + LLL: 'D MMMM YYYY թ., HH:mm', + LLLL: 'dddd, D MMMM YYYY թ., HH:mm' + }, + relativeTime: { + future: '%s հետո', + past: '%s առաջ', + s: 'մի քանի վայրկյան', + m: 'րոպե', + mm: '%d րոպե', + h: 'ժամ', + hh: '%d ժամ', + d: 'օր', + dd: '%d օր', + M: 'ամիս', + MM: '%d ամիս', + y: 'տարի', + yy: '%d տարի' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/id.js b/src/locale/id.js index 6916abf1e..32175f4a3 100644 --- a/src/locale/id.js +++ b/src/locale/id.js @@ -4,6 +4,9 @@ const locale = { name: 'id', weekdays: 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), + weekdaysShort: 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), + monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'), + weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), weekStart: 1, formats: { LT: 'HH.mm', @@ -34,3 +37,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/is.js b/src/locale/is.js index 9ae4c5402..300e07c60 100644 --- a/src/locale/is.js +++ b/src/locale/is.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'sun_mán_þri_mið_fim_fös_lau'.split('_'), monthsShort: 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), weekdaysMin: 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] H:mm', + LLLL: 'dddd, D. MMMM YYYY [kl.] H:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/it-ch.js b/src/locale/it-ch.js index 8e164779c..b007df64d 100644 --- a/src/locale/it-ch.js +++ b/src/locale/it-ch.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'), monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/it.js b/src/locale/it.js index dfbf8ff24..06e802e03 100644 --- a/src/locale/it.js +++ b/src/locale/it.js @@ -37,3 +37,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/ja.js b/src/locale/ja.js index 72520a7cb..2d2d2dbe3 100644 --- a/src/locale/ja.js +++ b/src/locale/ja.js @@ -19,6 +19,7 @@ const locale = { lll: 'YYYY年M月D日 HH:mm', llll: 'YYYY年M月D日(ddd) HH:mm' }, + meridiem: hour => (hour < 12 ? '午前' : '午後'), relativeTime: { future: '%s後', past: '%s前', @@ -39,3 +40,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/jv.js b/src/locale/jv.js index 589df04d8..046c5899e 100644 --- a/src/locale/jv.js +++ b/src/locale/jv.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm' + }, + relativeTime: { + future: 'wonten ing %s', + past: '%s ingkang kepengker', + s: 'sawetawis detik', + m: 'setunggal menit', + mm: '%d menit', + h: 'setunggal jam', + hh: '%d jam', + d: 'sedinten', + dd: '%d dinten', + M: 'sewulan', + MM: '%d wulan', + y: 'setaun', + yy: '%d taun' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ka.js b/src/locale/ka.js index 002e1c652..73959f6dd 100644 --- a/src/locale/ka.js +++ b/src/locale/ka.js @@ -34,3 +34,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/kk.js b/src/locale/kk.js index 6e722f922..0cec380da 100644 --- a/src/locale/kk.js +++ b/src/locale/kk.js @@ -23,9 +23,18 @@ const locale = { y: 'бір жыл', yy: '%d жыл' }, - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/km.js b/src/locale/km.js index abee86d7a..424ff919b 100644 --- a/src/locale/km.js +++ b/src/locale/km.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: '%sទៀត', + past: '%sមុន', + s: 'ប៉ុន្មានវិនាទី', + m: 'មួយនាទី', + mm: '%d នាទី', + h: 'មួយម៉ោង', + hh: '%d ម៉ោង', + d: 'មួយថ្ងៃ', + dd: '%d ថ្ងៃ', + M: 'មួយខែ', + MM: '%d ខែ', + y: 'មួយឆ្នាំ', + yy: '%d ឆ្នាំ' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/kn.js b/src/locale/kn.js index d8da1f9a4..ba214ba0a 100644 --- a/src/locale/kn.js +++ b/src/locale/kn.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'), monthsShort: 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split('_'), weekdaysMin: 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm' + }, + relativeTime: { + future: '%s ನಂತರ', + past: '%s ಹಿಂದೆ', + s: 'ಕೆಲವು ಕ್ಷಣಗಳು', + m: 'ಒಂದು ನಿಮಿಷ', + mm: '%d ನಿಮಿಷ', + h: 'ಒಂದು ಗಂಟೆ', + hh: '%d ಗಂಟೆ', + d: 'ಒಂದು ದಿನ', + dd: '%d ದಿನ', + M: 'ಒಂದು ತಿಂಗಳು', + MM: '%d ತಿಂಗಳು', + y: 'ಒಂದು ವರ್ಷ', + yy: '%d ವರ್ಷ' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ko.js b/src/locale/ko.js index 04cbae8f1..6d5bd048f 100644 --- a/src/locale/ko.js +++ b/src/locale/ko.js @@ -38,3 +38,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/ku.js b/src/locale/ku.js index 26678a100..66fb60ac1 100644 --- a/src/locale/ku.js +++ b/src/locale/ku.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split('_'), monthsShort: 'کانونی دووەم_شوبات_ئازار_نیسان_ئایار_حوزەیران_تەمموز_ئاب_ئەیلوول_تشرینی یەكەم_تشرینی دووەم_كانونی یەکەم'.split('_'), weekdaysMin: 'ی_د_س_چ_پ_ه_ش'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'له‌ %s', + past: '%s', + s: 'چه‌ند چركه‌یه‌ك', + m: 'یه‌ك خوله‌ك', + mm: '%d خوله‌ك', + h: 'یه‌ك كاتژمێر', + hh: '%d كاتژمێر', + d: 'یه‌ك ڕۆژ', + dd: '%d ڕۆژ', + M: 'یه‌ك مانگ', + MM: '%d مانگ', + y: 'یه‌ك ساڵ', + yy: '%d ساڵ' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ky.js b/src/locale/ky.js index 2119777b4..417df4ccc 100644 --- a/src/locale/ky.js +++ b/src/locale/ky.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), monthsShort: 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), weekdaysMin: 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: '%s ичинде', + past: '%s мурун', + s: 'бирнече секунд', + m: 'бир мүнөт', + mm: '%d мүнөт', + h: 'бир саат', + hh: '%d саат', + d: 'бир күн', + dd: '%d күн', + M: 'бир ай', + MM: '%d ай', + y: 'бир жыл', + yy: '%d жыл' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/lb.js b/src/locale/lb.js index 173b45929..533ee733e 100644 --- a/src/locale/lb.js +++ b/src/locale/lb.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'H:mm [Auer]', + LTS: 'H:mm:ss [Auer]', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm [Auer]', + LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/lo.js b/src/locale/lo.js index 6b654aa20..7a4eafcbf 100644 --- a/src/locale/lo.js +++ b/src/locale/lo.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), monthsShort: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), weekdaysMin: 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'ວັນdddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'ອີກ %s', + past: '%sຜ່ານມາ', + s: 'ບໍ່ເທົ່າໃດວິນາທີ', + m: '1 ນາທີ', + mm: '%d ນາທີ', + h: '1 ຊົ່ວໂມງ', + hh: '%d ຊົ່ວໂມງ', + d: '1 ມື້', + dd: '%d ມື້', + M: '1 ເດືອນ', + MM: '%d ເດືອນ', + y: '1 ປີ', + yy: '%d ປີ' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/lt.js b/src/locale/lt.js index 9c2091852..add5d4b19 100644 --- a/src/locale/lt.js +++ b/src/locale/lt.js @@ -32,9 +32,22 @@ const locale = { ll: 'YYYY [m.] MMMM D [d.]', lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]', llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' + }, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY [m.] MMMM D [d.]', + LLL: 'YYYY [m.] MMMM D [d.], HH:mm [val.]', + LLLL: 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', + l: 'YYYY-MM-DD', + ll: 'YYYY [m.] MMMM D [d.]', + lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]', + llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/lv.js b/src/locale/lv.js index e9cbe952b..55abd9635 100644 --- a/src/locale/lv.js +++ b/src/locale/lv.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'), monthsShort: 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY.', + LL: 'YYYY. [gada] D. MMMM', + LLL: 'YYYY. [gada] D. MMMM, HH:mm', + LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/me.js b/src/locale/me.js index 936bf79d0..d0cad96ef 100644 --- a/src/locale/me.js +++ b/src/locale/me.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/mi.js b/src/locale/mi.js index 04e86c848..443d13aaa 100644 --- a/src/locale/mi.js +++ b/src/locale/mi.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), monthsShort: 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split('_'), weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [i] HH:mm', + LLLL: 'dddd, D MMMM YYYY [i] HH:mm' + }, + relativeTime: { + future: 'i roto i %s', + past: '%s i mua', + s: 'te hēkona ruarua', + m: 'he meneti', + mm: '%d meneti', + h: 'te haora', + hh: '%d haora', + d: 'he ra', + dd: '%d ra', + M: 'he marama', + MM: '%d marama', + y: 'he tau', + yy: '%d tau' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/mk.js b/src/locale/mk.js index 0fc8636c2..0029b9144 100644 --- a/src/locale/mk.js +++ b/src/locale/mk.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'нед_пон_вто_сре_чет_пет_саб'.split('_'), monthsShort: 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), weekdaysMin: 'нe_пo_вт_ср_че_пе_сa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'D.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY H:mm', + LLLL: 'dddd, D MMMM YYYY H:mm' + }, + relativeTime: { + future: 'после %s', + past: 'пред %s', + s: 'неколку секунди', + m: 'минута', + mm: '%d минути', + h: 'час', + hh: '%d часа', + d: 'ден', + dd: '%d дена', + M: 'месец', + MM: '%d месеци', + y: 'година', + yy: '%d години' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ml.js b/src/locale/ml.js index 813b49f0a..fc1ec2cf3 100644 --- a/src/locale/ml.js +++ b/src/locale/ml.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), monthsShort: 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), weekdaysMin: 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm -നു', + LTS: 'A h:mm:ss -നു', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm -നു', + LLLL: 'dddd, D MMMM YYYY, A h:mm -നു' + }, + relativeTime: { + future: '%s കഴിഞ്ഞ്', + past: '%s മുൻപ്', + s: 'അൽപ നിമിഷങ്ങൾ', + m: 'ഒരു മിനിറ്റ്', + mm: '%d മിനിറ്റ്', + h: 'ഒരു മണിക്കൂർ', + hh: '%d മണിക്കൂർ', + d: 'ഒരു ദിവസം', + dd: '%d ദിവസം', + M: 'ഒരു മാസം', + MM: '%d മാസം', + y: 'ഒരു വർഷം', + yy: '%d വർഷം' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/mn.js b/src/locale/mn.js index c38835906..a2c863a96 100644 --- a/src/locale/mn.js +++ b/src/locale/mn.js @@ -7,7 +7,15 @@ const locale = { weekdaysShort: 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'), monthsShort: '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split('_'), weekdaysMin: 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY оны MMMMын D', + LLL: 'YYYY оны MMMMын D HH:mm', + LLLL: 'dddd, YYYY оны MMMMын D HH:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/mr.js b/src/locale/mr.js index 350136f31..d58ed4ee0 100644 --- a/src/locale/mr.js +++ b/src/locale/mr.js @@ -7,7 +7,15 @@ const locale = { weekdaysShort: 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm वाजता', + LTS: 'A h:mm:ss वाजता', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm वाजता', + LLLL: 'dddd, D MMMM YYYY, A h:mm वाजता' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ms-my.js b/src/locale/ms-my.js index 5e448de89..225dc1485 100644 --- a/src/locale/ms-my.js +++ b/src/locale/ms-my.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm' + }, + relativeTime: { + future: 'dalam %s', + past: '%s yang lepas', + s: 'beberapa saat', + m: 'seminit', + mm: '%d minit', + h: 'sejam', + hh: '%d jam', + d: 'sehari', + dd: '%d hari', + M: 'sebulan', + MM: '%d bulan', + y: 'setahun', + yy: '%d tahun' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ms.js b/src/locale/ms.js index 740b95b32..89d4a5ac2 100644 --- a/src/locale/ms.js +++ b/src/locale/ms.js @@ -34,3 +34,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/mt.js b/src/locale/mt.js index 418de824d..b339413ed 100644 --- a/src/locale/mt.js +++ b/src/locale/mt.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'), monthsShort: 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'), weekdaysMin: 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'f’ %s', + past: '%s ilu', + s: 'ftit sekondi', + m: 'minuta', + mm: '%d minuti', + h: 'siegħa', + hh: '%d siegħat', + d: 'ġurnata', + dd: '%d ġranet', + M: 'xahar', + MM: '%d xhur', + y: 'sena', + yy: '%d sni' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/my.js b/src/locale/my.js index 5478cf489..3ba8999c8 100644 --- a/src/locale/my.js +++ b/src/locale/my.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'လာမည့် %s မှာ', + past: 'လွန်ခဲ့သော %s က', + s: 'စက္ကန်.အနည်းငယ်', + m: 'တစ်မိနစ်', + mm: '%d မိနစ်', + h: 'တစ်နာရီ', + hh: '%d နာရီ', + d: 'တစ်ရက်', + dd: '%d ရက်', + M: 'တစ်လ', + MM: '%d လ', + y: 'တစ်နှစ်', + yy: '%d နှစ်' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/nb.js b/src/locale/nb.js index 54fb2a2f8..a7dd0bcef 100644 --- a/src/locale/nb.js +++ b/src/locale/nb.js @@ -34,3 +34,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/ne.js b/src/locale/ne.js index 1fdd171b7..07a797126 100644 --- a/src/locale/ne.js +++ b/src/locale/ne.js @@ -19,9 +19,18 @@ const locale = { y: 'एक वर्ष', yy: '%d वर्ष' }, - ordinal: n => `${n}`.replace(/\d/g, i => '०१२३४५६७८९'[i]) + ordinal: n => `${n}`.replace(/\d/g, i => '०१२३४५६७८९'[i]), + formats: { + LT: 'Aको h:mm बजे', + LTS: 'Aको h:mm:ss बजे', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, Aको h:mm बजे', + LLLL: 'dddd, D MMMM YYYY, Aको h:mm बजे' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/nl-be.js b/src/locale/nl-be.js index 64d545ca7..c45816daa 100644 --- a/src/locale/nl-be.js +++ b/src/locale/nl-be.js @@ -7,7 +7,30 @@ const locale = { weekStart: 1, weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'), weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'over %s', + past: '%s geleden', + s: 'een paar seconden', + m: 'één minuut', + mm: '%d minuten', + h: 'één uur', + hh: '%d uur', + d: 'één dag', + dd: '%d dagen', + M: 'één maand', + MM: '%d maanden', + y: 'één jaar', + yy: '%d jaar' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/nl.js b/src/locale/nl.js index ad95d8168..8739297b0 100644 --- a/src/locale/nl.js +++ b/src/locale/nl.js @@ -34,3 +34,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/nn.js b/src/locale/nn.js index 40df77cc4..c48e22b49 100644 --- a/src/locale/nn.js +++ b/src/locale/nn.js @@ -23,9 +23,18 @@ const locale = { MM: '%d månadar', y: 'eitt år', yy: '%d år' + }, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] H:mm', + LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm' } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/pa-in.js b/src/locale/pa-in.js index d1774fa2e..a24563466 100644 --- a/src/locale/pa-in.js +++ b/src/locale/pa-in.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), monthsShort: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), weekdaysMin: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm ਵਜੇ', + LTS: 'A h:mm:ss ਵਜੇ', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm ਵਜੇ', + LLLL: 'dddd, D MMMM YYYY, A h:mm ਵਜੇ' + }, + relativeTime: { + future: '%s ਵਿੱਚ', + past: '%s ਪਿਛਲੇ', + s: 'ਕੁਝ ਸਕਿੰਟ', + m: 'ਇਕ ਮਿੰਟ', + mm: '%d ਮਿੰਟ', + h: 'ਇੱਕ ਘੰਟਾ', + hh: '%d ਘੰਟੇ', + d: 'ਇੱਕ ਦਿਨ', + dd: '%d ਦਿਨ', + M: 'ਇੱਕ ਮਹੀਨਾ', + MM: '%d ਮਹੀਨੇ', + y: 'ਇੱਕ ਸਾਲ', + yy: '%d ਸਾਲ' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/pl.js b/src/locale/pl.js index 939d5bd29..49b9fc1b9 100644 --- a/src/locale/pl.js +++ b/src/locale/pl.js @@ -22,9 +22,18 @@ const locale = { MM: '%d miesięcy', y: 'rok', yy: '%d lat' + }, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/pt-br.js b/src/locale/pt-br.js index 3ac0c250e..245a21a1f 100644 --- a/src/locale/pt-br.js +++ b/src/locale/pt-br.js @@ -33,3 +33,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/pt.js b/src/locale/pt.js index 328397462..f9e70f10b 100644 --- a/src/locale/pt.js +++ b/src/locale/pt.js @@ -36,3 +36,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/ro.js b/src/locale/ro.js index 45f2348ca..dc0033eff 100644 --- a/src/locale/ro.js +++ b/src/locale/ro.js @@ -34,3 +34,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/ru.js b/src/locale/ru.js index 12714d1d5..d629283a0 100644 --- a/src/locale/ru.js +++ b/src/locale/ru.js @@ -37,3 +37,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/sd.js b/src/locale/sd.js index 000e816fd..e781057e2 100644 --- a/src/locale/sd.js +++ b/src/locale/sd.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'آچر_سومر_اڱارو_اربع_خميس_جمع_ڇنڇر'.split('_'), monthsShort: 'جنوري_فيبروري_مارچ_اپريل_مئي_جون_جولاءِ_آگسٽ_سيپٽمبر_آڪٽوبر_نومبر_ڊسمبر'.split('_'), weekdaysMin: 'آچر_سومر_اڱارو_اربع_خميس_جمع_ڇنڇر'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd، D MMMM YYYY HH:mm' + }, + relativeTime: { + future: '%s پوء', + past: '%s اڳ', + s: 'چند سيڪنڊ', + m: 'هڪ منٽ', + mm: '%d منٽ', + h: 'هڪ ڪلاڪ', + hh: '%d ڪلاڪ', + d: 'هڪ ڏينهن', + dd: '%d ڏينهن', + M: 'هڪ مهينو', + MM: '%d مهينا', + y: 'هڪ سال', + yy: '%d سال' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/se.js b/src/locale/se.js index 99db63f6c..9c453f1df 100644 --- a/src/locale/se.js +++ b/src/locale/se.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), monthsShort: 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), weekdaysMin: 's_v_m_g_d_b_L'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'MMMM D. [b.] YYYY', + LLL: 'MMMM D. [b.] YYYY [ti.] HH:mm', + LLLL: 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' + }, + relativeTime: { + future: '%s geažes', + past: 'maŋit %s', + s: 'moadde sekunddat', + m: 'okta minuhta', + mm: '%d minuhtat', + h: 'okta diimmu', + hh: '%d diimmut', + d: 'okta beaivi', + dd: '%d beaivvit', + M: 'okta mánnu', + MM: '%d mánut', + y: 'okta jahki', + yy: '%d jagit' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/si.js b/src/locale/si.js index 192e9a107..1981031e2 100644 --- a/src/locale/si.js +++ b/src/locale/si.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), monthsShort: 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), weekdaysMin: 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'a h:mm', + LTS: 'a h:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY MMMM D', + LLL: 'YYYY MMMM D, a h:mm', + LLLL: 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' + }, + relativeTime: { + future: '%sකින්', + past: '%sකට පෙර', + s: 'තත්පර කිහිපය', + m: 'මිනිත්තුව', + mm: 'මිනිත්තු %d', + h: 'පැය', + hh: 'පැය %d', + d: 'දිනය', + dd: 'දින %d', + M: 'මාසය', + MM: 'මාස %d', + y: 'වසර', + yy: 'වසර %d' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/sk.js b/src/locale/sk.js index 7f45b1893..aa5b7bfa5 100644 --- a/src/locale/sk.js +++ b/src/locale/sk.js @@ -20,9 +20,18 @@ const locale = { y: 'rok', yy: '%d rokov' }, - ordinal: n => `${n}º` + ordinal: n => `${n}º`, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd D. MMMM YYYY H:mm' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/sl.js b/src/locale/sl.js index c68552ad6..d5cb073bd 100644 --- a/src/locale/sl.js +++ b/src/locale/sl.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), monthsShort: 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), weekdaysMin: 'ne_po_to_sr_če_pe_so'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/sq.js b/src/locale/sq.js index ac8811927..ef3f2a890 100644 --- a/src/locale/sq.js +++ b/src/locale/sq.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), monthsShort: 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), weekdaysMin: 'D_H_Ma_Më_E_P_Sh'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'në %s', + past: '%s më parë', + s: 'disa sekonda', + m: 'një minutë', + mm: '%d minuta', + h: 'një orë', + hh: '%d orë', + d: 'një ditë', + dd: '%d ditë', + M: 'një muaj', + MM: '%d muaj', + y: 'një vit', + yy: '%d vite' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/sr-cyrl.js b/src/locale/sr-cyrl.js index 82d3ecd80..40444f4cd 100644 --- a/src/locale/sr-cyrl.js +++ b/src/locale/sr-cyrl.js @@ -20,9 +20,18 @@ const locale = { y: 'година', yy: '%d године' }, - ordinal: n => `${n}.` + ordinal: n => `${n}.`, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/sr.js b/src/locale/sr.js index b0140fa8c..1ade8f03b 100644 --- a/src/locale/sr.js +++ b/src/locale/sr.js @@ -20,9 +20,18 @@ const locale = { y: 'godina', yy: '%d godine' }, - ordinal: n => `${n}.` + ordinal: n => `${n}.`, + formats: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/ss.js b/src/locale/ss.js index 22a4ddacd..2a564edee 100644 --- a/src/locale/ss.js +++ b/src/locale/ss.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), monthsShort: 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), weekdaysMin: 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A' + }, + relativeTime: { + future: 'nga %s', + past: 'wenteka nga %s', + s: 'emizuzwana lomcane', + m: 'umzuzu', + mm: '%d emizuzu', + h: 'lihora', + hh: '%d emahora', + d: 'lilanga', + dd: '%d emalanga', + M: 'inyanga', + MM: '%d tinyanga', + y: 'umnyaka', + yy: '%d iminyaka' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/sv.js b/src/locale/sv.js index aa61d8f13..288c953d3 100644 --- a/src/locale/sv.js +++ b/src/locale/sv.js @@ -43,3 +43,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/sw.js b/src/locale/sw.js index 7e68f4813..4b05ace96 100644 --- a/src/locale/sw.js +++ b/src/locale/sw.js @@ -37,3 +37,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/ta.js b/src/locale/ta.js index 1c15e5841..9498a73fe 100644 --- a/src/locale/ta.js +++ b/src/locale/ta.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), monthsShort: 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), weekdaysMin: 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, HH:mm', + LLLL: 'dddd, D MMMM YYYY, HH:mm' + }, + relativeTime: { + future: '%s இல்', + past: '%s முன்', + s: 'ஒரு சில விநாடிகள்', + m: 'ஒரு நிமிடம்', + mm: '%d நிமிடங்கள்', + h: 'ஒரு மணி நேரம்', + hh: '%d மணி நேரம்', + d: 'ஒரு நாள்', + dd: '%d நாட்கள்', + M: 'ஒரு மாதம்', + MM: '%d மாதங்கள்', + y: 'ஒரு வருடம்', + yy: '%d ஆண்டுகள்' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/te.js b/src/locale/te.js index fd0bd6d98..b2970b5f2 100644 --- a/src/locale/te.js +++ b/src/locale/te.js @@ -7,7 +7,30 @@ const locale = { weekdaysShort: 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), monthsShort: 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), weekdaysMin: 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm' + }, + relativeTime: { + future: '%s లో', + past: '%s క్రితం', + s: 'కొన్ని క్షణాలు', + m: 'ఒక నిమిషం', + mm: '%d నిమిషాలు', + h: 'ఒక గంట', + hh: '%d గంటలు', + d: 'ఒక రోజు', + dd: '%d రోజులు', + M: 'ఒక నెల', + MM: '%d నెలలు', + y: 'ఒక సంవత్సరం', + yy: '%d సంవత్సరాలు' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/tet.js b/src/locale/tet.js index aa152d6a3..1ecb53294 100644 --- a/src/locale/tet.js +++ b/src/locale/tet.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'), monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), weekdaysMin: 'Do_Seg_Te_Ku_Ki_Ses_Sa'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'iha %s', + past: '%s liuba', + s: 'minutu balun', + m: 'minutu ida', + mm: 'minutu %d', + h: 'oras ida', + hh: 'oras %d', + d: 'loron ida', + dd: 'loron %d', + M: 'fulan ida', + MM: 'fulan %d', + y: 'tinan ida', + yy: 'tinan %d' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/tg.js b/src/locale/tg.js index b2e0abbe5..a789c344b 100644 --- a/src/locale/tg.js +++ b/src/locale/tg.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'), monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), weekdaysMin: 'яш_дш_сш_чш_пш_ҷм_шб'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'баъди %s', + past: '%s пеш', + s: 'якчанд сония', + m: 'як дақиқа', + mm: '%d дақиқа', + h: 'як соат', + hh: '%d соат', + d: 'як рӯз', + dd: '%d рӯз', + M: 'як моҳ', + MM: '%d моҳ', + y: 'як сол', + yy: '%d сол' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/th.js b/src/locale/th.js index 6b2ca4485..e831e87d3 100644 --- a/src/locale/th.js +++ b/src/locale/th.js @@ -36,3 +36,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/tl-ph.js b/src/locale/tl-ph.js index 56611a7f1..e8023845f 100644 --- a/src/locale/tl-ph.js +++ b/src/locale/tl-ph.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'MM/D/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY HH:mm', + LLLL: 'dddd, MMMM DD, YYYY HH:mm' + }, + relativeTime: { + future: 'sa loob ng %s', + past: '%s ang nakalipas', + s: 'ilang segundo', + m: 'isang minuto', + mm: '%d minuto', + h: 'isang oras', + hh: '%d oras', + d: 'isang araw', + dd: '%d araw', + M: 'isang buwan', + MM: '%d buwan', + y: 'isang taon', + yy: '%d taon' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/tlh.js b/src/locale/tlh.js index 69ff95c79..c62eeccdd 100644 --- a/src/locale/tlh.js +++ b/src/locale/tlh.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), monthsShort: 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), weekdaysMin: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/tr.js b/src/locale/tr.js index 29c825f54..ac8f0f20e 100644 --- a/src/locale/tr.js +++ b/src/locale/tr.js @@ -34,3 +34,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/tzl.js b/src/locale/tzl.js index 2c70fd676..5c6dc8876 100644 --- a/src/locale/tzl.js +++ b/src/locale/tzl.js @@ -8,7 +8,15 @@ const locale = { weekdaysShort: 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), monthsShort: 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), weekdaysMin: 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM [dallas] YYYY', + LLL: 'D. MMMM [dallas] YYYY HH.mm', + LLLL: 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/tzm-latn.js b/src/locale/tzm-latn.js index df71adbad..529e55b2c 100644 --- a/src/locale/tzm-latn.js +++ b/src/locale/tzm-latn.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), monthsShort: 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), weekdaysMin: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'dadkh s yan %s', + past: 'yan %s', + s: 'imik', + m: 'minuḍ', + mm: '%d minuḍ', + h: 'saɛa', + hh: '%d tassaɛin', + d: 'ass', + dd: '%d ossan', + M: 'ayowr', + MM: '%d iyyirn', + y: 'asgas', + yy: '%d isgasn' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/tzm.js b/src/locale/tzm.js index 4097e40a2..5c75ea543 100644 --- a/src/locale/tzm.js +++ b/src/locale/tzm.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), monthsShort: 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), weekdaysMin: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', + past: 'ⵢⴰⵏ %s', + s: 'ⵉⵎⵉⴽ', + m: 'ⵎⵉⵏⵓⴺ', + mm: '%d ⵎⵉⵏⵓⴺ', + h: 'ⵙⴰⵄⴰ', + hh: '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', + d: 'ⴰⵙⵙ', + dd: '%d oⵙⵙⴰⵏ', + M: 'ⴰⵢoⵓⵔ', + MM: '%d ⵉⵢⵢⵉⵔⵏ', + y: 'ⴰⵙⴳⴰⵙ', + yy: '%d ⵉⵙⴳⴰⵙⵏ' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/ug-cn.js b/src/locale/ug-cn.js index fc864804a..405d41066 100644 --- a/src/locale/ug-cn.js +++ b/src/locale/ug-cn.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split('_'), weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى', + LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', + LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm' + }, + relativeTime: { + future: '%s كېيىن', + past: '%s بۇرۇن', + s: 'نەچچە سېكونت', + m: 'بىر مىنۇت', + mm: '%d مىنۇت', + h: 'بىر سائەت', + hh: '%d سائەت', + d: 'بىر كۈن', + dd: '%d كۈن', + M: 'بىر ئاي', + MM: '%d ئاي', + y: 'بىر يىل', + yy: '%d يىل' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/uk.js b/src/locale/uk.js index 81e51f837..3cd82af07 100644 --- a/src/locale/uk.js +++ b/src/locale/uk.js @@ -23,9 +23,18 @@ const locale = { y: 'рік', yy: '%d роки' }, - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY р.', + LLL: 'D MMMM YYYY р., HH:mm', + LLLL: 'dddd, D MMMM YYYY р., HH:mm' + } } dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/ur.js b/src/locale/ur.js index 09e909f11..c4a5e52f1 100644 --- a/src/locale/ur.js +++ b/src/locale/ur.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'اتوار_پیر_منگل_بدھ_جمعرات_جمعہ_ہفتہ'.split('_'), monthsShort: 'جنوری_فروری_مارچ_اپریل_مئی_جون_جولائی_اگست_ستمبر_اکتوبر_نومبر_دسمبر'.split('_'), weekdaysMin: 'اتوار_پیر_منگل_بدھ_جمعرات_جمعہ_ہفتہ'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd، D MMMM YYYY HH:mm' + }, + relativeTime: { + future: '%s بعد', + past: '%s قبل', + s: 'چند سیکنڈ', + m: 'ایک منٹ', + mm: '%d منٹ', + h: 'ایک گھنٹہ', + hh: '%d گھنٹے', + d: 'ایک دن', + dd: '%d دن', + M: 'ایک ماہ', + MM: '%d ماہ', + y: 'ایک سال', + yy: '%d سال' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/uz-latn.js b/src/locale/uz-latn.js index fbe2a9d43..6adaf96f3 100644 --- a/src/locale/uz-latn.js +++ b/src/locale/uz-latn.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'), monthsShort: 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'), weekdaysMin: 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'D MMMM YYYY, dddd HH:mm' + }, + relativeTime: { + future: 'Yaqin %s ichida', + past: 'Bir necha %s oldin', + s: 'soniya', + m: 'bir daqiqa', + mm: '%d daqiqa', + h: 'bir soat', + hh: '%d soat', + d: 'bir kun', + dd: '%d kun', + M: 'bir oy', + MM: '%d oy', + y: 'bir yil', + yy: '%d yil' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/uz.js b/src/locale/uz.js index 7591d7f2d..2f6327c40 100644 --- a/src/locale/uz.js +++ b/src/locale/uz.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), weekdaysMin: 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'D MMMM YYYY, dddd HH:mm' + }, + relativeTime: { + future: 'Якин %s ичида', + past: 'Бир неча %s олдин', + s: 'фурсат', + m: 'бир дакика', + mm: '%d дакика', + h: 'бир соат', + hh: '%d соат', + d: 'бир кун', + dd: '%d кун', + M: 'бир ой', + MM: '%d ой', + y: 'бир йил', + yy: '%d йил' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/vi.js b/src/locale/vi.js index 055e4593e..8b915aac8 100644 --- a/src/locale/vi.js +++ b/src/locale/vi.js @@ -8,7 +8,34 @@ const locale = { weekdaysShort: 'CN_T2_T3_T4_T5_T6_T7'.split('_'), monthsShort: 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), weekdaysMin: 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM [năm] YYYY', + LLL: 'D MMMM [năm] YYYY HH:mm', + LLLL: 'dddd, D MMMM [năm] YYYY HH:mm', + l: 'DD/M/YYYY', + ll: 'D MMM YYYY', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd, D MMM YYYY HH:mm' + }, + relativeTime: { + future: '%s tới', + past: '%s trước', + s: 'vài giây', + m: 'một phút', + mm: '%d phút', + h: 'một giờ', + hh: '%d giờ', + d: 'một ngày', + dd: '%d ngày', + M: 'một tháng', + MM: '%d tháng', + y: 'một năm', + yy: '%d năm' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/x-pseudo.js b/src/locale/x-pseudo.js index 692c02570..7cc06374f 100644 --- a/src/locale/x-pseudo.js +++ b/src/locale/x-pseudo.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), monthsShort: 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), weekdaysMin: 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + relativeTime: { + future: 'í~ñ %s', + past: '%s á~gó', + s: 'á ~féw ~sécó~ñds', + m: 'á ~míñ~úté', + mm: '%d m~íñú~tés', + h: 'á~ñ hó~úr', + hh: '%d h~óúrs', + d: 'á ~dáý', + dd: '%d d~áýs', + M: 'á ~móñ~th', + MM: '%d m~óñt~hs', + y: 'á ~ýéár', + yy: '%d ý~éárs' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/yo.js b/src/locale/yo.js index c9cf21ac4..c1884a28e 100644 --- a/src/locale/yo.js +++ b/src/locale/yo.js @@ -8,7 +8,30 @@ const locale = { weekdaysShort: 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), monthsShort: 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), weekdaysMin: 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), - ordinal: n => n + ordinal: n => n, + formats: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A' + }, + relativeTime: { + future: 'ní %s', + past: '%s kọjá', + s: 'ìsẹjú aayá die', + m: 'ìsẹjú kan', + mm: 'ìsẹjú %d', + h: 'wákati kan', + hh: 'wákati %d', + d: 'ọjọ́ kan', + dd: 'ọjọ́ %d', + M: 'osù kan', + MM: 'osù %d', + y: 'ọdún kan', + yy: 'ọdún %d' + } } dayjs.locale(locale, null, true) diff --git a/src/locale/zh-cn.js b/src/locale/zh-cn.js index 736944253..23f82e26a 100644 --- a/src/locale/zh-cn.js +++ b/src/locale/zh-cn.js @@ -48,3 +48,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/zh-hk.js b/src/locale/zh-hk.js index bd6151553..042d88867 100644 --- a/src/locale/zh-hk.js +++ b/src/locale/zh-hk.js @@ -36,3 +36,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/locale/zh-tw.js b/src/locale/zh-tw.js index 572b86c24..f931c0a51 100644 --- a/src/locale/zh-tw.js +++ b/src/locale/zh-tw.js @@ -40,3 +40,4 @@ const locale = { dayjs.locale(locale, null, true) export default locale + diff --git a/src/plugin/advancedFormat/index.js b/src/plugin/advancedFormat/index.js index 1b5288c08..117831b8d 100644 --- a/src/plugin/advancedFormat/index.js +++ b/src/plugin/advancedFormat/index.js @@ -13,7 +13,7 @@ export default (o, c, d) => { // locale needed later const locale = this.$locale() const utils = this.$utils() const str = formatStr || FORMAT_DEFAULT - const result = str.replace(/Q|wo|gggg|Do|X|x|k{1,2}|S/g, (match) => { + const result = str.replace(/\[([^\]]+)]|Q|wo|gggg|Do|X|x|k{1,2}|S/g, (match) => { switch (match) { case 'Q': return Math.ceil((this.$M + 1) / 3) @@ -28,8 +28,10 @@ export default (o, c, d) => { // locale needed later return utils.s(String(this.$H === 0 ? 24 : this.$H), match === 'k' ? 1 : 2, '0') case 'X': return Math.floor(this.$d.getTime() / 1000) - default: // 'x' + case 'x': return this.$d.getTime() + default: + return match } }) return oldFormat.bind(this)(result) diff --git a/src/plugin/buddhistEra/index.js b/src/plugin/buddhistEra/index.js index 3ee0dd520..ff0481433 100644 --- a/src/plugin/buddhistEra/index.js +++ b/src/plugin/buddhistEra/index.js @@ -7,10 +7,10 @@ export default (o, c) => { // locale needed later proto.format = function (formatStr) { const yearBias = 543 const str = formatStr || FORMAT_DEFAULT - const result = str.replace(/BBBB|BB/g, (match) => { + const result = str.replace(/(\[[^\]]+])|BBBB|BB/g, (match, a) => { const year = String(this.$y + yearBias) const args = match === 'BB' ? [year.slice(-2), 2] : [year, 4] - return this.$utils().s(...args, '0') + return a || this.$utils().s(...args, '0') }) return oldFormat.bind(this)(result) } diff --git a/src/plugin/customParseFormat/index.js b/src/plugin/customParseFormat/index.js index 6386650c7..08f67708e 100644 --- a/src/plugin/customParseFormat/index.js +++ b/src/plugin/customParseFormat/index.js @@ -137,7 +137,7 @@ function makeParser(format) { const match = regex.exec(part) const value = match[0] parser.call(time, value) - start += value.length + input = input.replace(value, '') } } correctHours(time) diff --git a/src/plugin/relativeTime/index.js b/src/plugin/relativeTime/index.js index 1ac51e431..6720d7590 100644 --- a/src/plugin/relativeTime/index.js +++ b/src/plugin/relativeTime/index.js @@ -37,14 +37,15 @@ export default (o, c, d) => { let out for (let i = 0; i < Tl; i += 1) { - const t = T[i] + let t = T[i] if (t.d) { result = isFrom ? d(input).diff(instance, t.d, true) : instance.diff(input, t.d, true) } - const abs = Math.ceil(Math.abs(result)) + const abs = Math.round(Math.abs(result)) if (abs <= t.r || !t.r) { + if (abs === 1) t = T[i - 1] // 1 minutes -> a minute out = loc[t.l].replace('%d', abs) break } diff --git a/src/plugin/weekday/index.js b/src/plugin/weekday/index.js new file mode 100644 index 000000000..c3c86ef9b --- /dev/null +++ b/src/plugin/weekday/index.js @@ -0,0 +1,13 @@ +export default (o, c) => { + const proto = c.prototype + proto.weekday = function (input) { + const weekStart = this.$locale().weekStart || 0 + const { $W } = this + const weekday = ($W < weekStart ? $W + 7 : $W) - weekStart + if (this.$utils().u(input)) { + return weekday + } + return this.subtract(weekday, 'day').add(input, 'day') + } +} + diff --git a/test/display.test.js b/test/display.test.js index 1f8977586..764a5d0ea 100644 --- a/test/display.test.js +++ b/test/display.test.js @@ -2,6 +2,7 @@ import moment from 'moment' import MockDate from 'mockdate' import dayjs from '../src' import th from '../src/locale/th' +import '../src/locale/ja' beforeEach(() => { MockDate.set(new Date()) @@ -77,12 +78,18 @@ it('Format meridiens a A am / pm', () => { expect(dayjs(time).format('a')).toBe(moment(time).format('a')) expect(dayjs(time).format('A')).toBe('AM') expect(dayjs(time).format('A')).toBe(moment(time).format('A')) + expect(dayjs(time).locale('ja').format('a')).toBe('午前') + expect(dayjs(time).locale('ja').format('a')) + .toBe(moment(time).locale('ja').format('a')) const time2 = '2018-05-02T23:00:00.000' expect(dayjs(time2).format('a')).toBe('pm') expect(dayjs(time2).format('a')).toBe(moment(time2).format('a')) expect(dayjs(time2).format('A')).toBe('PM') expect(dayjs(time2).format('A')).toBe(moment(time2).format('A')) + expect(dayjs(time2).locale('ja').format('a')).toBe('午後') + expect(dayjs(time2).locale('ja').format('a')) + .toBe(moment(time2).locale('ja').format('a')) }) it('Format Minute m mm', () => { diff --git a/test/locale/keys.test.js b/test/locale/keys.test.js index 71027d20d..327eb02ab 100644 --- a/test/locale/keys.test.js +++ b/test/locale/keys.test.js @@ -15,8 +15,8 @@ fs.readdirSync(path.join(__dirname, localeDir)) }) }) -it('Locale keys', () => { - Locale.forEach((locale) => { +Locale.forEach((locale) => { + it(`Locale keys for ${locale.content.name}`, () => { const { name, ordinal, @@ -27,7 +27,8 @@ it('Locale keys', () => { weekdaysShort, monthsShort, weekdaysMin, - weekStart + weekStart, + meridiem } = locale.content expect(name).toEqual(locale.name.replace('.js', '')) @@ -80,5 +81,11 @@ it('Locale keys', () => { 'past', 's', 'y', 'yy'] .sort()) } + + if (meridiem) { + for (let i = 1; i <= 23; i += 1) { + expect(meridiem(i)).toEqual(expect.anything()) + } + } }) }) diff --git a/test/manipulate.test.js b/test/manipulate.test.js index eb83f5d92..5fe28cb4f 100644 --- a/test/manipulate.test.js +++ b/test/manipulate.test.js @@ -64,6 +64,13 @@ it('Add Time days', () => { expect(dayjs().add('2', 'years').valueOf()).toBe(moment().add('2', 'years').valueOf()) }) +it('Add Time with decimal', () => { + expect(dayjs().add(0.4, 'day').valueOf()).toBe(moment().add(0.4, 'day').valueOf()) + expect(dayjs().add(0.5, 'day').valueOf()).toBe(moment().add(0.5, 'day').valueOf()) + expect(dayjs().add(0.4, 'week').valueOf()).toBe(moment().add(0.4, 'week').valueOf()) + expect(dayjs().add(0.5, 'week').valueOf()).toBe(moment().add(0.5, 'week').valueOf()) +}) + it('Subtract Time days', () => { expect(dayjs().subtract(1, 'days').valueOf()).toBe(moment().subtract(1, 'days').valueOf()) }) diff --git a/test/plugin/advancedFormat.test.js b/test/plugin/advancedFormat.test.js index 74de4eb9b..e3ccaddcf 100644 --- a/test/plugin/advancedFormat.test.js +++ b/test/plugin/advancedFormat.test.js @@ -82,3 +82,14 @@ it('Format Week Year gggg', () => { const d = '2018-12-31' expect(dayjs(d).format('gggg')).toBe(moment(d).format('gggg')) }) + +it('Skips format strings inside brackets', () => { + expect(dayjs().format('[Q]')).toBe('Q') + expect(dayjs().format('[Do]')).toBe('Do') + expect(dayjs().format('[gggg]')).toBe('gggg') + expect(dayjs().format('[wo]')).toBe('wo') + expect(dayjs().format('[k]')).toBe('k') + expect(dayjs().format('[kk]')).toBe('kk') + expect(dayjs().format('[X]')).toBe('X') + expect(dayjs().format('[x]')).toBe('x') +}) diff --git a/test/plugin/buddhistEra.test.js b/test/plugin/buddhistEra.test.js index 2482702f8..626df54ce 100644 --- a/test/plugin/buddhistEra.test.js +++ b/test/plugin/buddhistEra.test.js @@ -31,3 +31,8 @@ it('Format Buddhist Era 4 digit with other format', () => { const momentDate = today.format(format).replace('BBBB', today.year() + 543) expect(dayjs().format(format)).toBe(momentDate) }) + +it('Skips format strings inside brackets', () => { + expect(dayjs().format('[BBBB]')).toBe('BBBB') + expect(dayjs().format('[BB]')).toBe('BB') +}) diff --git a/test/plugin/customParseFormat.test.js b/test/plugin/customParseFormat.test.js index 49462f439..8f7dc3bab 100644 --- a/test/plugin/customParseFormat.test.js +++ b/test/plugin/customParseFormat.test.js @@ -161,6 +161,15 @@ it('return Invalid Date when parse corrupt short string', () => { expect(dayjs(input, format).format()).toBe('Invalid Date') }) +it('Invalid Dates', () => { + expect(dayjs('10/12/2014', 'YYYY-MM-DD').format('MM-DD-YYYY')).toBe('Invalid Date') + expect(dayjs('10-12-2014', 'YYYY-MM-DD').format('MM-DD-YYYY')).toBe('Invalid Date') +}) + +it('Valid Date', () => { + expect(dayjs('2014/10/12', 'YYYY-MM-DD').format('MM-DD-YYYY')).toBe('10-12-2014') +}) + it('correctly parse month from string after changing locale globally', () => { const input = '2018 лютий 03' const format = 'YYYY MMMM DD' diff --git a/test/plugin/localizedFormat.test.js b/test/plugin/localizedFormat.test.js index b3934b85c..1c7a89e14 100644 --- a/test/plugin/localizedFormat.test.js +++ b/test/plugin/localizedFormat.test.js @@ -2,7 +2,6 @@ import MockDate from 'mockdate' import moment from 'moment' import dayjs from '../../src' import es from '../../src/locale/es' -import ar from '../../src/locale/ar' import znCn from '../../src/locale/zh-cn' import localizedFormat from '../../src/plugin/localizedFormat' @@ -60,7 +59,7 @@ it('Uses correct English formats', () => { const date = new Date() const actualDate = dayjs(date) const expectedDate = moment(date); - ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL', 'l', 'll', 'lll', 'llll'].forEach(option => + ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL'].forEach(option => expect(actualDate.format(option)).toBe(expectedDate.format(option))) }) @@ -68,8 +67,12 @@ it('Uses English formats in other locales as default', () => { const date = new Date() const actualDate = dayjs(date) const expectedDate = moment(date) - // todo: ar here isn't a good fix here - expect(actualDate.locale(ar).format('L')).toBe(expectedDate.format('L')) + const mockLocale = { + name: 'mock', + weekdays: Array(7).fill(' '), + months: Array(12).fill(' ') + } + expect(actualDate.locale(mockLocale).format('L')).toBe(expectedDate.format('L')) }) it('Leaves the default format intact', () => { diff --git a/test/plugin/relativeTime.test.js b/test/plugin/relativeTime.test.js index 2bc4a896e..fcf65ce4e 100644 --- a/test/plugin/relativeTime.test.js +++ b/test/plugin/relativeTime.test.js @@ -17,16 +17,28 @@ it('Time from X', () => { const T = [ [0, 'second'], // a few seconds [44, 'second'], // a few seconds + [44.4, 'second'], // a few seconds + [44.5, 'second'], // a minute [45, 'second'], // a minute [89, 'second'], // a minute + [89.4, 'second'], // a minute + [89.5, 'second'], // a minute [90, 'second'], // 2 minutes [44, 'minute'], // 44 minutes + [44.4, 'minute'], + [44.5, 'minute'], [45, 'minute'], // an hour [89, 'minute'], // an hour + [89.4, 'minute'], + [89.5, 'minute'], [90, 'minute'], // 2 hours [21, 'hour'], // 21 hours + [21.4, 'hour'], + [21.5, 'hour'], [22, 'hour'], // a day [35, 'hour'], // a day + [35.4, 'hour'], + [35.5, 'hour'], [36, 'hour'], // 2 days [25, 'day'], // 25 days [26, 'day'], // a month diff --git a/test/plugin/weekday.test.js b/test/plugin/weekday.test.js new file mode 100644 index 000000000..703f3ec84 --- /dev/null +++ b/test/plugin/weekday.test.js @@ -0,0 +1,43 @@ +import MockDate from 'mockdate' +import moment from 'moment' +import dayjs from '../../src' +import weekday from '../../src/plugin/weekday' +import '../../src/locale/zh-cn' +import '../../src/locale/ar' + +dayjs.extend(weekday) + +beforeEach(() => { + MockDate.set(new Date()) +}) + +afterEach(() => { + MockDate.reset() + moment.locale('en') + dayjs.locale('en') +}) + +it('Sunday is the first day of the week', () => { + expect(dayjs().weekday()).toBe(moment().weekday()) + expect(dayjs().weekday(0).date()).toBe(moment().weekday(0).date()) + expect(dayjs().weekday(-7).format()).toBe(moment().weekday(-7).format()) + expect(dayjs().weekday(7).format()).toBe(moment().weekday(7).format()) +}) + +it('Monday is the first day of the week', () => { + moment.locale('zh-cn') + dayjs.locale('zh-cn') + expect(dayjs().weekday()).toBe(moment().weekday()) + expect(dayjs().weekday(0).date()).toBe(moment().weekday(0).date()) + expect(dayjs().weekday(-7).format()).toBe(moment().weekday(-7).format()) + expect(dayjs().weekday(7).format()).toBe(moment().weekday(7).format()) +}) + +it('Saturday is the first day of the week', () => { + moment.locale('ar') + dayjs.locale('ar') + expect(dayjs().weekday()).toBe(moment().weekday()) + expect(dayjs().weekday(0).date()).toBe(moment().weekday(0).date()) + expect(dayjs().weekday(-7).valueOf()).toBe(moment().weekday(-7).valueOf()) + expect(dayjs().weekday(7).valueOf()).toBe(moment().weekday(7).valueOf()) +}) diff --git a/types/index.d.ts b/types/index.d.ts index 6473865c6..b2864e017 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -65,7 +65,7 @@ declare namespace dayjs { format(template?: string): string - diff(date: ConfigType, unit: QUnitType, float?: boolean): number + diff(date: ConfigType, unit: QUnitType | OpUnitType, float?: boolean): number valueOf(): number diff --git a/types/plugin/weekday.d.ts b/types/plugin/weekday.d.ts new file mode 100644 index 000000000..87a8025a3 --- /dev/null +++ b/types/plugin/weekday.d.ts @@ -0,0 +1,12 @@ +import { PluginFunc } from 'dayjs' + +declare const plugin: PluginFunc +export = plugin + +declare module 'dayjs' { + interface Dayjs { + weekday(): number + + weekday(value: number): Dayjs + } +}