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

feat: add customParseFormat support for isoweek, the usage is consistent with moment #2827

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

Conversation

lizhihangdev
Copy link

Background
After using dayjs to replace moment, I found that dayjs does not support moment's ability to parse ISO 8601 strings.

For example
dayjs('2024-W01', 'GGGG-[W]WW')

Solution
dayjs(newDate).add(7, 'day').isoWeek(isoWeek).isoWeekday(1)

  • Get the correct ISO year,dayjs(newDate).add(7, 'day')
  • Generate dayjs according to ISO week,dayjs(newDate).add(7, 'day').isoWeek(isoWeek)
  • Take the value of Monday as the final result,dayjs(newDate).add(7, 'day').isoWeek(isoWeek).isoWeekday(1)

@lizhihangdev
Copy link
Author

dependent IsoWeek plugin

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.

1 participant