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 ordinal suffixes format #418

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

Conversation

kl23
Copy link

@kl23 kl23 commented Mar 15, 2018

update /Do/ format for ordinal suffix "rd"

see #415

@holtkamp
Copy link
Collaborator

Thanks, but what "problem" does it fix? You have an actual usecase where the "rd" is used in a date? Never seen it...

@kl23
Copy link
Author

kl23 commented Mar 16, 2018

till an hour ago, I supposed that moment claims a format with ordinal suffix an invalid date.

the part below ___format calls getValidDate() which depends on moment
but moment accepts the following in its isValid() function and returns true for some weird cases:

  • 3st Mar 2018 (this one is still kinda acceptable)
  • 1xx Mar 2018
  • 222 Mar 2018
  • 5xxworhnou42ntub20485c234c23nrewst Mar 2018 (What?!)

e.g.
moment('5xxworhnou42ntub20485c234c23nrewst Mar 2018', 'Do MMM YYYY').toDate()
returns a JS date object of 5 Mar 2018

I am not sure how it defines "a valid date" and "a valid date format".
according to its doc,

  • Do: Day of month with ordinal

moment already "support" Do format, so removal is theoretically not necessary any more.

___format is either useless (from now), or, if we need a more specific validation, the validating mechanism in getValidDate() may need some changes.

@holtkamp
Copy link
Collaborator

ok, so the best approach seems to be to put this on hold for now. We might even decide to remove the intermediate ___format approach since it is not even needed (anymore)...

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.

2 participants