Skip to content
New issue

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

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

Already on GitHub? # to your account

Can't parse date string with a day of the week #1616

Closed
dudintv opened this issue Sep 1, 2021 · 1 comment
Closed

Can't parse date string with a day of the week #1616

dudintv opened this issue Sep 1, 2021 · 1 comment

Comments

@dudintv
Copy link

dudintv commented Sep 1, 2021

Describe the bug
Dayjs can't parse a string with extra words like days of the week.

scheduledTime = "14:05 - Friday 3 Sep 2021"
dayjs(scheduledTime, "hh:mm D MMM YYYY")   // => Invalid date
dayjs(scheduledTime, "hh:mm - D MMM YYYY")   // => Invalid date

I've found that dayjs(scheduledTime, "hh:mm - ...... D MMM YYYY") works for "Friday", but days of the week have a different count of characters :)

It worked two weeks ago. But now, after I've updated Dayjs, it's not working anymore.

Expected behavior
Two variants:

  1. ignore all extra words (better)
  2. add days of the week as a parameter of the string parsing (which should leads to ignoring this info)

Information

  • Day.js Version 1.10.6
  • OS: MacOS
  • Browser Version 92.0.4515.159 (Official Build) (x86_64)
  • Time zone: GMT+0200 (Central European Summer Time)
@dudintv dudintv changed the title Can't parse date string with day of the week Can't parse date string with a day of the week Sep 1, 2021
@BePo65
Copy link
Contributor

BePo65 commented May 28, 2022

There is a problem with parsing of some formats. I pushed a pr for this already.

@dudintv dudintv closed this as completed Nov 20, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants