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

[Major]: Remove Moment and Node 10 #100

Merged
merged 18 commits into from
Jul 3, 2021
Merged

[Major]: Remove Moment and Node 10 #100

merged 18 commits into from
Jul 3, 2021

Conversation

snewcomer
Copy link
Collaborator

@snewcomer snewcomer commented Jun 24, 2021

close #69

Considerations

Dates can be compared either with getTime or if in string format, we can compare "11/2/2014 < "11/3/2014".

  • remove String 'now' argument.
  • remove momentjs
  • Remove precision argument. If you need to compare based on precision, you can use the Intl.DateTimeFormat APIs to hone in on the comparison - { year: 'numeric' }. Even { dateStyle: 'full' } works!
  • Added locale option. Defaults to en-us when creating date times. This is probably less useful for the actual on/before/after but it can help in formatting your error message.

Some other options

  • Just install date-fns
  • Configurable date-fns
  • Raw Intl APIs

In any case this will require a change in the format argument.

e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format

  • Note, I did my best with the short amount of time I looked at this + without an actual use case to test. Please let me know if there is something I missed!

@snewcomer snewcomer added the WIP label Jun 24, 2021
@snewcomer snewcomer self-assigned this Jun 24, 2021
@snewcomer snewcomer changed the title [Major]: Rm Moment and Node 10 removal [Major]: Remove Moment and Node 10 Jun 30, 2021
@snewcomer snewcomer added enhancement and removed WIP labels Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable date utility or native for date validators
1 participant