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(NativeDateAdapter): work around wrong javascript native Date-to-string conversions #10068

Merged
merged 2 commits into from
Feb 26, 2018
Merged

fix(NativeDateAdapter): work around wrong javascript native Date-to-string conversions #10068

merged 2 commits into from
Feb 26, 2018

Conversation

julianobrasil
Copy link
Contributor

@julianobrasil julianobrasil commented Feb 21, 2018

It looks like javascript messes things up when trying to apply DST rules to format some past dates during the Date-to-string conversions. The issue pops up when the past dates don't follow today's DST rules for a given locale (usually as a result of each local government decisions).

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 21, 2018
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I just want to do some manual testing before approving

* very frequently, and the current valid rule is not always valid in previous years though.
* We work around this problem building a new Date object which has its internal UTC
* representation with the local date and time.
* @param dtf Intl.DateTimeFormat object, containg the desired string format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a note that dtf must have its timeZone set to 'utc' for this method to work properly

@mmalerba
Copy link
Contributor

Ok I tested Linux, Mac, and IE attempted to reproduce the issue described in #7167 (comment) and it seemed to work fine on all browser & OS's that I tested. So looks good

@mmalerba mmalerba added pr: lgtm action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Feb 21, 2018
@jelbourn jelbourn merged commit 2fad732 into angular:master Feb 26, 2018
@julianobrasil julianobrasil deleted the fixNativeDateAdapter branch February 26, 2018 15:26
mmalerba pushed a commit to mmalerba/components that referenced this pull request Feb 26, 2018
jelbourn pushed a commit to jelbourn/components that referenced this pull request Feb 27, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
4 participants