Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upchore(datepicker): native date adapter defaults to midnight #3378
Conversation
This changes the default time hour computed by native date adapter to be a midnight, which is default for default Date object when no hours are set and aligns the behaviour with the UTC date adapter one.
Codecov Report
@@ Coverage Diff @@
## master #3378 +/- ##
=======================================
Coverage 90.88% 90.88%
=======================================
Files 95 95
Lines 2743 2743
Branches 510 510
=======================================
Hits 2493 2493
Misses 190 190
Partials 60 60
Continue to review full report at Codecov.
|
@maxokorokov can you please merge this change. |
Might be related to this → #1676, need to check in more details. |
@maxokorokov |
@peterblazejewicz nope, not exactly, sorry. But it was something like resetting current timezone to Brazil. |
Guys if there is no underlying reason for this change why not revert back to the standard followed by most UI libraries? Current flow seems like a hack. Moreover, which developer would want to have 12 pm as default, seems really odd. |
@maxokorokov Can you please include this in the upcoming datepicker updates. |
Can we have some clarity on whether this feature would be included or not? |
Kindly share an update on this pull request |
Dear Team, kindly merge this pull request to the master repo, or give an attribute through which this can be activated. |
@shyamal890 I can't tell you the details because I need to dig up into my memory... But for sure I can tell you (with more than 10 years of JS datepickers implementation expertise) that we must keep noon instead of midnight. While I am performing the check in my memory, could you please explain me why you absolutely need it ? |
|
@shyamal890 Thanks for your highlights! I now remember one use case for example, leap second adjustment. If date model is set to midnight, it happens that you are changing day as compared to noon where you don't And, yes, this is not made up example, I had this issue each single time, and as I told you I have some experience dealing with Javascript Framework ~10 years of various datepicker development) Did you notice that the NgbDateNativeUTCAdapter is not messing around with the time part of the Date ? Maybe you could simply use that one ? |
This changes the default time hour computed by native date adapter to be
a midnight, which is default for default Date object when no hours are
set and aligns the behaviour with the UTC date adapter one.
The current behaviour (being changed by this PR), has been introduced without a comment here, changing the default
Date
object constructor defaulting to midnight, instead defaulting to noon:83930cd#diff-9f982ce59e7ca1c194d2a43bd90a2e4fR13
Fixes: #3340