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
Add 'todayInstantiator' property to allow custom today's Date creation #1083
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1083 +/- ##
=========================================
+ Coverage 42.9% 42.95% +0.05%
=========================================
Files 41 41
Lines 1296 1299 +3
Branches 403 404 +1
=========================================
+ Hits 556 558 +2
- Misses 721 722 +1
Partials 19 19
Continue to review full report at Codecov.
|
@jonagoldman PR is ok, but i'm not sure about the prop name to be honest |
@jtommy I'm not sure either :) First I called it |
|
@jtommy done |
@jonagoldman Thanks |
If I understand correctly, this would allow displaying the Datepicker in an arbitrary timezone instead of the user local by default?
Sorry, please ignore previous paragraph: I hadn't realise the name had been changed to |
Fixes #1080 by adding a new
todayInstantiator
property.This allows to pass a function like this:
This fixes some issues when the browser default new Date() instantiation used inside the component does not match the way each application works with dates.
For example, in an app that uses Moment or Luxon to set a timezone, the today's date set by the app can be different from the today's date used inside the component.
With this property I have the freedom to do something like this:
The
todayInstantiator
property is a function that must always return a regular JS Date object representing today's date.Please note this function only applies when the component wants to get the today's date using
new Date()
and does not change anything else, ensuring that nothing breaks.