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

Fix: Error in parsing array format date #2639

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

klm-turing
Copy link
Contributor

  • Add a getStringDate function which parse an array of date and return a string to dayjs
  • Add related test units

This fix 2604 issue

- Add a getStringDate function which parse an array of date to a string
- return that string to dayjs
testArrs.forEach((testArr) => {
it(testArr, () => {
expect(dayjs(testArr).format())
.toBe(moment(testArr).format())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should keep the same return with moment.js. otherwise, it will be a huge breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact is the same bug is present in « moment ». JavaScript Date parses month number from zero to eleven. But most of the time if not all time, we use month from 1 to 12. Excepting the same result as moment will be impossible unless moment fix it. Another alternative is to update the docs and let users know that they need to maybe change their habits and consider zero as first month and 11 as the last month in order to properly use arraySupport plugin. What would you suggest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error in parsing array format date
2 participants