-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(filter): format timezone correctly #9534
Conversation
This fixes timezone formatting in case UTC timezone is used Closes #9359
@@ -471,7 +476,7 @@ function dateFilter($locale) { | |||
} | |||
forEach(parts, function(value){ | |||
fn = DATE_FORMATS[value]; | |||
text += fn ? fn(date, $locale.DATETIME_FORMATS) | |||
text += fn ? fn(date, $locale.DATETIME_FORMATS, timezone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems really hackish to me, any suggestions?
I added another commit here for supporting conversion to timezone other than UTC because it bothered me... Is this something we want? |
var offset = date.getTimezoneOffset(); | ||
if (timezone) { | ||
var zone = Date.parse('1970-01-01 00:00:00 ' + timezone) / 60000; | ||
if (zone === zone) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zone === zone
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid Date -> NaN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you prefer we throw on invalid timezone?
4dd5a20
to
998c61c
Compare
This fixes timezone formatting in case UTC timezone is used
Closes #9359