Repository: iamkun/dayjs
Pull request #1916 (2022-05-28 18:05:51)

fix: correct past property in KU (kurdish) locale
hello dayjs, in this pr add value to past property in english say ago say in kurdish say something like لەمەوپێش 

thank you.


Patch:
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
new file mode 100644
index 0000000..0ff6907
--- /dev/null
+++ b/.github/workflows/check.yml
@@ -0,0 +1,26 @@
+name: Lint & Unit Test
+on:
+  push:
+    branches: [ master, dev ]
+  pull_request:
+    branches: [dev]
+jobs:
+  check:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        node: [ 12, 14, 16, 18 ]
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v3
+    - name: Setup node
+      uses: actions/setup-node@v3
+      with:
+        node-version: ${{ matrix.node-version }}
+        cache: 'npm'
+    - name: Install dependencies
+      run: npm install -g codecov && npm install
+    - name: Run Lint
+      run: npm run lint
+    - name: Run tests
+      run: npm test && codecov 
diff --git a/.travis.yml b/.travis.yml
index ec3ad83..b8aba28 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,10 +4,10 @@ cache:
     - ~/.npm
     - node_modules
 node_js:
+  - '18'
+  - '16'
   - '14'
   - '12'
-  - '10'
-  - '8'
 install:
   - npm install -g codecov
   - npm install
@@ -20,5 +20,5 @@ after_success:
       npx travis-deploy-once --pro && npm run build && npm run babel && npm install -g @semantic-release/changelog @semantic-release/git  semantic-release && semantic-release && echo release success && curl ${TriggerUrl} && npm run test:sauce;
     fi
 branches:
-  except:
-    - /^v\d+\.\d+\.\d+$/
+  only: 
+    - master
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3190aa..b0857bc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,20 @@
+## [1.11.3](https://github.com/iamkun/dayjs/compare/v1.11.2...v1.11.3) (2022-06-06)
+
+
+### Bug Fixes
+
+*  customParseFormat plugin to parse comma as a separator character ([#1913](https://github.com/iamkun/dayjs/issues/1913)) ([41b1405](https://github.com/iamkun/dayjs/commit/41b1405971e099431211ae6c2a100cd797da4427))
+* update Dutch [nl] locale ordinal ([#1908](https://github.com/iamkun/dayjs/issues/1908)) ([5da98f8](https://github.com/iamkun/dayjs/commit/5da98f8085d2d2847d79e38c795082703a14f24b))
+
+## [1.11.2](https://github.com/iamkun/dayjs/compare/v1.11.1...v1.11.2) (2022-05-06)
+
+
+### Bug Fixes
+
+* add OpUnitType (week) to quarterOfYear startOf/endOf types ([#1865](https://github.com/iamkun/dayjs/issues/1865)) ([400bc3e](https://github.com/iamkun/dayjs/commit/400bc3e8915e0c58e7abbfd3a1235364b1abaf3e))
+* Fix type issue with ManipulateType ([#1864](https://github.com/iamkun/dayjs/issues/1864)) ([d033dfc](https://github.com/iamkun/dayjs/commit/d033dfcfc1d2ced39b2733898e8d85ad5984c9e9))
+* fix UTC plugin .valueOf not taking DST into account  ([#1448](https://github.com/iamkun/dayjs/issues/1448)) ([27d1c50](https://github.com/iamkun/dayjs/commit/27d1c506100ae6624f258c21cc06b24768ced733))
+
 ## [1.11.1](https://github.com/iamkun/dayjs/compare/v1.11.0...v1.11.1) (2022-04-15)
 
 
diff --git a/src/locale/fr.js b/src/locale/fr.js
index be06169..e913b4a 100644
--- a/src/locale/fr.js
+++ b/src/locale/fr.js
@@ -34,7 +34,7 @@ const locale = {
     yy: '%d ans'
   },
   ordinal: (n) => {
-    const o = n === 1 ? 'er' : ''
+    const o = n === 1 ? 'er' : 'e'
     return `${n}${o}`
   }
 }
diff --git a/src/locale/ku.js b/src/locale/ku.js
index 1d7a449..c87c5d8 100644
--- a/src/locale/ku.js
+++ b/src/locale/ku.js
@@ -72,7 +72,7 @@ const locale = {
   meridiem: hour => (hour < 12 ? 'پ.ن' : 'د.ن'),
   relativeTime: {
     future: 'لە %s',
-    past: '%s',
+    past: 'لەمەوپێش %s',
     s: 'چەند چرکەیەک',
     m: 'یەک خولەک',
     mm: '%d خولەک',
diff --git a/src/locale/nl.js b/src/locale/nl.js
index b0f15a7..6d9ff7b 100644
--- a/src/locale/nl.js
+++ b/src/locale/nl.js
@@ -8,7 +8,7 @@ const locale = {
   weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'),
   months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'),
   monthsShort: 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'),
-  ordinal: n => `${n}.`,
+  ordinal: n => `${n}${n === 1 || n === 8 || n >= 20 ? 'ste' : 'de'}`,
   weekStart: 1,
   yearStart: 4,
   formats: {
diff --git a/src/plugin/customParseFormat/index.js b/src/plugin/customParseFormat/index.js
index f662a4a..771d131 100644
--- a/src/plugin/customParseFormat/index.js
+++ b/src/plugin/customParseFormat/index.js
@@ -1,6 +1,6 @@
 import { u } from '../localizedFormat/utils'
 
-const formattingTokens = /(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g
+const formattingTokens = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g
 
 const match1 = /\d/ // 0 - 9
 const match2 = /\d\d/ // 00 - 99
@@ -9,7 +9,7 @@ const match4 = /\d{4}/ // 0000 - 9999
 const match1to2 = /\d\d?/ // 0 - 99
 const matchSigned = /[+-]?\d+/ // -inf - inf
 const matchOffset = /[+-]\d\d:?(\d\d)?|Z/ // +00:00 -00:00 +0000 or -0000 +00 or Z
-const matchWord = /\d*[^\s\d-_:/()]+/ // Word
+const matchWord = /\d*[^-_:/,()\s\d]+/ // Word
 
 let locale = {}
 
diff --git a/types/plugin/localeData.d.ts b/types/plugin/localeData.d.ts
index bc0aa14..ae9e557 100644
--- a/types/plugin/localeData.d.ts
+++ b/types/plugin/localeData.d.ts
@@ -16,6 +16,7 @@ declare module 'dayjs' {
     monthsShort(instance?: Dayjs): MonthNames;
     longDateFormat(format: string): string;
     meridiem(hour?: number, minute?: number, isLower?: boolean): string;
+    ordinal(n: number): string
   }
 
   interface GlobalLocaleDataReturn {
@@ -27,6 +28,7 @@ declare module 'dayjs' {
     monthsShort(): MonthNames;
     longDateFormat(format: string): string;
     meridiem(hour?: number, minute?: number, isLower?: boolean): string;
+    ordinal(n: number): string
   }
 
   interface Dayjs {


Test patch:
diff --git a/test/plugin/customParseFormat.test.js b/test/plugin/customParseFormat.test.js
index 3b4e5f9..a4588e9 100644
--- a/test/plugin/customParseFormat.test.js
+++ b/test/plugin/customParseFormat.test.js
@@ -370,6 +370,61 @@ it('custom two-digit year parse function', () => {
   expect(dayjs(input3, format).year()).toBe(1899)
 })
 
+// issue 1852
+describe('parse with special separator characters', () => {
+  it('Output is NaN for a specific date format', () => {
+    const input = '20 Nov, 2022'
+    const format = 'DD MMM, YYYY'
+    const locale = 'en'
+    const resultDayjs = dayjs(input, format, locale)
+    const resultMoment = moment(input, format, locale)
+    expect(resultMoment.isValid()).toBe(true)
+    expect(resultDayjs.isValid()).toBe(true)
+    expect(resultDayjs.format('DD-MM-YYYY')).toBe('20-11-2022')
+    expect(resultMoment.format('DD-MM-YYYY')).toBe('20-11-2022')
+  })
+  it('parse comma separated date', () => {
+    const input = '20,11,2022'
+    const format = 'DD,MM,YYYY'
+    const resultDayjs = dayjs(input, format)
+    const resultMoment = moment(input, format)
+    expect(resultMoment.isValid()).toBe(true)
+    expect(resultDayjs.isValid()).toBe(true)
+    expect(resultDayjs.format('DD-MM-YYYY')).toBe('20-11-2022')
+    expect(resultMoment.format('DD-MM-YYYY')).toBe('20-11-2022')
+  })
+  it('parse comma separated date in strict mode', () => {
+    const input = '20,11,2022'
+    const format = 'DD,MM,YYYY'
+    const resultDayjs = dayjs(input, format, true)
+    const resultMoment = moment(input, format, true)
+    expect(resultMoment.isValid()).toBe(true)
+    expect(resultDayjs.isValid()).toBe(true)
+    expect(resultDayjs.format('DD-MM-YYYY')).toBe('20-11-2022')
+    expect(resultMoment.format('DD-MM-YYYY')).toBe('20-11-2022')
+  })
+  it('parse date with multi character separator', () => {
+    const input = '20---11---2022'
+    const format = 'DD-/-MM-#-YYYY'
+    const resultDayjs = dayjs(input, format)
+    const resultMoment = moment(input, format)
+    expect(resultMoment.isValid()).toBe(true)
+    expect(resultDayjs.isValid()).toBe(true)
+    expect(resultDayjs.format('DD-MM-YYYY')).toBe('20-11-2022')
+    expect(resultMoment.format('DD-MM-YYYY')).toBe('20-11-2022')
+  })
+  it('parse date with multi character separator in strict mode', () => {
+    const input = '20-/-11-#-2022'
+    const format = 'DD-/-MM-#-YYYY'
+    const resultDayjs = dayjs(input, format, true)
+    const resultMoment = moment(input, format, true)
+    expect(resultMoment.isValid()).toBe(true)
+    expect(resultDayjs.isValid()).toBe(true)
+    expect(resultDayjs.format('DD-MM-YYYY')).toBe('20-11-2022')
+    expect(resultMoment.format('DD-MM-YYYY')).toBe('20-11-2022')
+  })
+})
+
 it('parse X x', () => {
   const input = '1410715640.579'
   const format = 'X'