From 33744ff4606fc973e3b87733f57e49469d5686e4 Mon Sep 17 00:00:00 2001 From: andrewhood125ruhuc Date: Fri, 17 Apr 2026 17:45:59 +0800 Subject: [PATCH 1/7] docs: Updated CONTRIBUTING.md (#479) Added missing comma on line 18. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0166c053..8cb790f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ Our open source community strives to be nice, welcoming and professional. Instan * Before submitting a bug report, search the issues for similar tickets. Your issue may have already been discussed and resolved. * Feel free to add a comment to an existing issue, even if it's closed. * Be thorough in your title and report, don't leave out important details. -* English please. +* English, please. ## Tests From 6bf577bfca60afc613abb4999acd0c4006f625c7 Mon Sep 17 00:00:00 2001 From: andrewhood125ruhuc Date: Sat, 18 Apr 2026 21:49:09 +0800 Subject: [PATCH 2/7] fix: Add en-gb locale (#478) --- src/locale/en-gb.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/locale/en-gb.js diff --git a/src/locale/en-gb.js b/src/locale/en-gb.js new file mode 100644 index 00000000..8d916abc --- /dev/null +++ b/src/locale/en-gb.js @@ -0,0 +1,43 @@ +import dayjs from 'dayjs' + +const locale = { + name: 'en-gb', + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekStart: 1, + 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' + }, + 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' + }, + ordinal: (n) => { + const s = ['th', 'st', 'nd', 'rd'] + const v = n % 100 + return `[${n}${(s[(v - 20) % 10] || s[v] || s[0])}]` + } +} + +dayjs.locale(locale, null, true) + +export default locale From 9f3a09e1f63c1f360a3c12b94438584330d25f91 Mon Sep 17 00:00:00 2001 From: andrewhood125ruhuc Date: Tue, 21 Apr 2026 09:32:09 +0800 Subject: [PATCH 3/7] fix(module): transpile everything except ES6 modules in the 'module' entrypoint (#477) (#480) (#482) --- .gitignore | 1 + .travis.yml | 2 +- package.json | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 9b3850a8..5dc72081 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ coverage /locale /plugin dayjs.min.js +/lib #dev demo.js diff --git a/.travis.yml b/.travis.yml index 51231394..e155eab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ script: - codecov after_success: - if [ "$TRAVIS_BRANCH" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then - npx travis-deploy-once && npm run build && npm install -g @semantic-release/changelog @semantic-release/git semantic-release && semantic-release && npm run test:sauce; + npx travis-deploy-once && npm run build && npm run babel && npm install -g @semantic-release/changelog @semantic-release/git semantic-release && semantic-release && npm run test:sauce; fi branches: except: diff --git a/package.json b/package.json index 0b6d7021..bfd8556a 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,12 @@ "description": "2KB immutable date time library alternative to Moment.js with the same modern API ", "main": "dayjs.min.js", "types": "index.d.ts", - "module": "./src/index.js", + "module": "./lib/index.js", "scripts": { "test": "TZ=Pacific/Auckland npm run test-tz && TZ=Europe/London npm run test-tz && npm run test-tz && jest", "test-tz": "jest test/timezone.test --coverage=false", "lint": "./node_modules/.bin/eslint src/* test/* build/*", + "babel": "BABEL_ENV=build babel src --out-dir lib --copy-files", "build": "cross-env BABEL_ENV=build node build && npm run size", "sauce": "npx karma start karma.sauce.conf.js", "test:sauce": "npm run sauce -- 0 && npm run sauce -- 1 && npm run sauce -- 2 && npm run sauce -- 3", @@ -40,9 +41,14 @@ { "path": "@semantic-release/changelog" }, - ["@semantic-release/git", { - "assets": ["CHANGELOG.md"] - }] + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md" + ] + } + ] ] }, "keywords": [ From 4ed04ff03d9c3a49115a381e544c5bb26284b3b8 Mon Sep 17 00:00:00 2001 From: andrewhood125ruhuc Date: Fri, 24 Apr 2026 09:53:59 +0800 Subject: [PATCH 4/7] build: update build setting --- .gitignore | 2 +- .npmignore | 1 + package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5dc72081..c90d1cc7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ coverage /locale /plugin dayjs.min.js -/lib +/esm #dev demo.js diff --git a/.npmignore b/.npmignore index 3e276781..4f08223c 100644 --- a/.npmignore +++ b/.npmignore @@ -13,6 +13,7 @@ package-lock.json coverage # dev +src test build .babelrc diff --git a/package.json b/package.json index bfd8556a..22ceb719 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test": "TZ=Pacific/Auckland npm run test-tz && TZ=Europe/London npm run test-tz && npm run test-tz && jest", "test-tz": "jest test/timezone.test --coverage=false", "lint": "./node_modules/.bin/eslint src/* test/* build/*", - "babel": "BABEL_ENV=build babel src --out-dir lib --copy-files", + "babel": "cross-env BABEL_ENV=build babel src --out-dir esm --copy-files", "build": "cross-env BABEL_ENV=build node build && npm run size", "sauce": "npx karma start karma.sauce.conf.js", "test:sauce": "npm run sauce -- 0 && npm run sauce -- 1 && npm run sauce -- 2 && npm run sauce -- 3", From c46030b5f12b96ad590e95e4c373d5f3986bd762 Mon Sep 17 00:00:00 2001 From: andrewhood125ruhuc Date: Fri, 24 Apr 2026 23:44:39 +0800 Subject: [PATCH 5/7] fix: Update module in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22ceb719..26574ea7 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "2KB immutable date time library alternative to Moment.js with the same modern API ", "main": "dayjs.min.js", "types": "index.d.ts", - "module": "./lib/index.js", + "module": "./esm/index.js", "scripts": { "test": "TZ=Pacific/Auckland npm run test-tz && TZ=Europe/London npm run test-tz && npm run test-tz && jest", "test-tz": "jest test/timezone.test --coverage=false", From 112529c35ef2122f5bc96c314daec5908c2f23bc Mon Sep 17 00:00:00 2001 From: andrewhood125ruhuc Date: Tue, 28 Apr 2026 18:14:29 +0800 Subject: [PATCH 6/7] fix: update customParseFormat plugin support hh:mm close #484 --- src/plugin/customParseFormat/index.js | 3 ++- test/plugin/customParseFormat.test.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugin/customParseFormat/index.js b/src/plugin/customParseFormat/index.js index 0fbd9825..0bc8ef34 100644 --- a/src/plugin/customParseFormat/index.js +++ b/src/plugin/customParseFormat/index.js @@ -127,8 +127,9 @@ const parseFormattedInput = (input, format) => { minutes || 0, seconds || 0, milliseconds || 0 ) + (zone.offset * 60 * 1000)) } + const now = new Date() return new Date( - year, month - 1, day, + year || now.getFullYear(), month - 1 || now.getMonth(), day || now.getDate(), hours || 0, minutes || 0, seconds || 0, milliseconds || 0 ) } catch (e) { diff --git a/test/plugin/customParseFormat.test.js b/test/plugin/customParseFormat.test.js index 155560be..835df967 100644 --- a/test/plugin/customParseFormat.test.js +++ b/test/plugin/customParseFormat.test.js @@ -66,6 +66,12 @@ it('timezone with no hour', () => { expect(dayjs(input, format).valueOf()).toBe(moment(input, format).valueOf()) }) +it('parse just hh:mm)', () => { + const input = '12:00' + const format = 'hh:mm' + expect(dayjs(input, format).valueOf()).toBe(moment(input, format).valueOf()) +}) + it('fails with an invalid format', () => { const input = '2018-05-02 12:00 PM' const format = 'C' From 8972979097dd92cb6751082b677ca8c90d582e2c Mon Sep 17 00:00:00 2001 From: andrewhood125ruhuc Date: Wed, 29 Apr 2026 15:51:59 +0800 Subject: [PATCH 7/7] test: update locale test --- test/locale/keys.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/locale/keys.test.js b/test/locale/keys.test.js index 1e65d1e2..f779cab4 100644 --- a/test/locale/keys.test.js +++ b/test/locale/keys.test.js @@ -36,8 +36,9 @@ it('Locale keys', () => { expect(months).toEqual(expect.any(Array)) // function pass date return string or number or null - expect(ordinal(1)).toEqual(expect.anything()) - expect(ordinal(3)).toEqual(expect.anything()) + for (let i = 1; i <= 31; i += 1) { + expect(ordinal(i)).toEqual(expect.anything()) + } expect(dayjs().locale(name).$locale().name).toBe(name) if (formats) { expect(Object.keys(formats).sort()).toEqual(['L', 'LL', 'LLL', 'LLLL', 'LT', 'LTS'].sort())