-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Date Pipe formatting incorrectly (showing wrong date) #8319
Comments
Probably some local-time / UTC issue somewhere. It works fine from North America. Strangely, the two dates show as having different timezones when I run it. |
Im on US EST.
2000 and 2004 were leap years. Although 2016 is as well. Hence why I included these two dates. |
Adding 1 hour to the time returns the following:
Hope it helps. |
I see this in Chrome:
I guess my PC isn't sure where it is so it's hedging it's bets. |
In Europe/Chrome I see this in the Plunkr:
|
version 2.0.0.rc.1
always the same ... |
Works with RC2... this should be closed |
thanks |
I don't believe this is fixed. When tested in plunker Sample using the latest @angular npmcdn I still get the same issue.
Note, this is with EST. And seems to happen with some leap years.
|
Here is a jsFiddle Sample using the same April 1, 2004 with Moment.js. It formats correctly with that one (on EST) |
Here is a plunker with the latest ng version: https://plnkr.co/edit/uPUgWaDUuu2ccKkYz8yl?p=preview Could anyone within the EST time zone confirm that this is still an issue? |
Yes, still a problem with EST.
|
I have a problem with CEST too: |
@astrobob thnx for this reproduce, I was able to confirm in one version of Chrome (54.0.2840.14) in CEST (France):
So just changing a year gives you 2 different days in the output. I've tested also with FFox and gives correct answers for both cases I need to test with more browsers and their versions but for now it looks like a bug in at least one version of Chrome (to be confirmed). |
So, just re-tested with some more browsers and for
Given the above I would expect it to be a bug in Chrome and as such I've reported it here: https://bugs.chromium.org/p/v8/issues/detail?id=5747 |
@pkozlowski-opensource just stumbled upon this issue and fiddled around with it... while I can confirm your observations for
|
Maybe I am ignorant here but, if I am asking for a date to be formatted, why is it trying to adjust for time zone? It seems to me that formatting and adjusting for time zone are really two different things and should be handled separately, why does the time zone even matter to this pipe? All I expect is to get the same date out that I put in, every time. |
The date pipe uses intl to format date and is part of the i18n package that Angular offers, that's why it uses locale dates. |
This is an issue for me as well...anyone have a work around for now? |
Seems to be related to Daylight Saving Changes before 2007. This example shows all the dates that format inconsistently (based on US format) for a 10 year period starting Oct 1, 1999. |
@theHellyar Here is a Sample |
OK. This is driving me nuts. I am using Angular 4 (^4.0.0 in package.json) and am not getting correct times... I set a date as follows:
and am using the date pipe to format the outout as follows:
I get the following for output: The last time I checked 14:00 should be 02:00 PM I am using Chrome as my browser. And, by the way, the same output in Edge shows as: Is this a bug or a warp in time?? Some further observations... I have used several different date strings in my calls to This is what is driving me nuts... |
We are completely rewriting the date pipe for angular v5, hopefully this should fix those kind of issues |
I'd also like to add that I'm seeing a similar issue. I'm using the date pipe like so: This works fine in the timezone of the server (my timezone - CST), but anyone with a timezone to the west of my timezone will see the previous day. For example, if I give the date pipe |
With the new date pipe coming in angular 5.0 you'll be able to fix the
timezone to avoid this kind of issues
…On lun. 21 août 2017 à 19:45 Jake McClanahan ***@***.***> wrote:
I'd also like to add that I'm seeing a similar issue. I'm using the date
pipe like so:
{{effectiveDate | date:"MM/dd/yyyy"}}
and I'm giving the pipe a unix timestamp, for example of 1456725600000.
This works fine in the timezone of the server (my timezone - CST), but
anyone with a timezone to the west of my timezone will see the previous
day. For example, if I give the date pipe 08/21/2017 I will see 08/21/2017,
but anyone viewing my app on the west coast will see the previous day of
08/20/2017 which is not correct. This is causing me lots of calls from
customers as this app is used by thousands of people a day.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#8319 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQMokxaNxSVgvKwr7lDi2fqmgWs1J73ks5sacIfgaJpZM4ISVaU>
.
|
thanks @ocombe . Is the new date pipe in the 5.0 beta? |
It will be in the next one
…On lun. 21 août 2017 à 20:53 Jake McClanahan ***@***.***> wrote:
thanks @ocombe <https://github.com/ocombe> . Is the new date pipe in the
5.0 beta?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8319 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQMojdWW7o0hBw5QROVWeF52oAtX6bcks5sadIbgaJpZM4ISVaU>
.
|
Why not fix it in 4 as well? |
Because in 4.x we defer those type of formatting to the intl api, and we don't have any control over it. To fix that we had to do a breaking change, that's why it is only available in 5.x unfortunately |
@ocombe Where can we find the solution to timezone? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The Date Pipe is formatting certain dates incorrectly. It is showing the wrong date when formatted.
Steps to reproduce and a minimal demo of the problem
Create a Date for April, 1, 2004 (happens with 2000 too, but not with 2016).
Display this date using {{myDate | date}} pipe.
You can use plunker sample below
http://plnkr.co/edit/H32nNiSqxJJwQ0DvYcEm
Current behavior
For April 1, 2004. It shows the formatted date as Mar 31, 2004.
Expected/desired behavior
Formatted date as Apr 1, 2004
The text was updated successfully, but these errors were encountered: