Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customParseFormat plugin make some mistakes #1194

Closed
lyz810 opened this issue Nov 9, 2020 · 4 comments · Fixed by #1198
Closed

customParseFormat plugin make some mistakes #1194

lyz810 opened this issue Nov 9, 2020 · 4 comments · Fixed by #1198
Labels

Comments

@lyz810
Copy link

lyz810 commented Nov 9, 2020

Describe the bug

import dayjs from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat';
// this is right
console.log(dayjs('2020-01-01', 'YYYY-MM-DD', true).isValid());// true

// using customParseFormat plugin
dayjs.extend(customParseFormat);

// this is wrong, after customParseFormat plugin loaded
console.log(dayjs('2020-01-01', 'YYYY-MM-DD', true).isValid());// false

Expected behavior
The second console.log should print true as the first one.

Information

  • Day.js Version 1.9.5
  • OS: Mac OS X 10.15.7
  • Browser : Chrome/86.0.4240.80
  • Time zone: GMT +08:00
@alex-w0
Copy link

alex-w0 commented Nov 9, 2020

I've the same problem when I'm trying to use strict format:

This example should return true:

dayjs.extend(customParseFormat);
dayjs(
    '2020-11-08 19:34:39',
    'YYYY-MM-DD HH:mm:ss',
    true
  ).isValid() // false

https://repl.it/@alexw0/dayjs-test#index.js

Is this a bug or are we doing anything wrong?

@SomethingSexy
Copy link

SomethingSexy commented Nov 9, 2020

I am actually noticing this is an issue between 1.9.4 and 1.9.5. I was seeing tests failing when we upgraded to 1.9.5 but they are not in 1.9.4.

@iamkun
Copy link
Owner

iamkun commented Nov 10, 2020

Will fix soon in the next release.

iamkun pushed a commit that referenced this issue Nov 10, 2020
## [1.9.6](v1.9.5...v1.9.6) (2020-11-10)

### Bug Fixes

* fix customParseFormat plugin parsing date bug ([#1198](#1198)) ([50f05ad](50f05ad)), closes [#1194](#1194)
* Update lv (Latvian) locale relative time ([#1192](#1192)) ([6d6c684](6d6c684))
@iamkun
Copy link
Owner

iamkun commented Nov 10, 2020

🎉 This issue has been resolved in version 1.9.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.9.6](iamkun/dayjs@v1.9.5...v1.9.6) (2020-11-10)

### Bug Fixes

* fix customParseFormat plugin parsing date bug ([#1198](iamkun/dayjs#1198)) ([50f05ad](iamkun/dayjs@50f05ad)), closes [#1194](iamkun/dayjs#1194)
* Update lv (Latvian) locale relative time ([#1192](iamkun/dayjs#1192)) ([6d6c684](iamkun/dayjs@6d6c684))
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.9.6](iamkun/dayjs@v1.9.5...v1.9.6) (2020-11-10)

### Bug Fixes

* fix customParseFormat plugin parsing date bug ([#1198](iamkun/dayjs#1198)) ([50f05ad](iamkun/dayjs@50f05ad)), closes [#1194](iamkun/dayjs#1194)
* Update lv (Latvian) locale relative time ([#1192](iamkun/dayjs#1192)) ([6d6c684](iamkun/dayjs@6d6c684))
splashwizard pushed a commit to splashwizard/tracking-time that referenced this issue Oct 21, 2024
## [1.9.6](iamkun/dayjs@v1.9.5...v1.9.6) (2020-11-10)

### Bug Fixes

* fix customParseFormat plugin parsing date bug ([#1198](iamkun/dayjs#1198)) ([50f05ad](iamkun/dayjs@50f05ad)), closes [#1194](iamkun/dayjs#1194)
* Update lv (Latvian) locale relative time ([#1192](iamkun/dayjs#1192)) ([6d6c684](iamkun/dayjs@6d6c684))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants