Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Issue 1973183002: Override Date.prototype.to*String with Intl.DateTimeFormat.format

Created:
4 years, 7 months ago by jungshik at Google
Modified:
3 years, 10 months ago
Reviewers:
Dan Ehrenberg
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Override Date.prototype.to*String with Intl.DateTimeFormat.format This CL does two things. 1. By using Intl.DateTimeFormat, the timezone history is properly taken into account when formatting date-time in the past or future when the zone offset is different from the current zone offset. (e.g. Europe/Moscow) 2. Reset the timezone in cached DateTimeFormat object to the current one unconditionally. This is a bit inefficient. It has to check DateCacheVersion and reset TZ only when necessary. BUG=v8:3547, chromium:417640, v8:5022 TEST=See the bug

Patch Set 1 #

Patch Set 2 : update TZ in cached copies of DateFormat #

Patch Set 3 : rebased #

Patch Set 4 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -7 lines) Patch
M src/js/i18n.js View 1 2 3 8 chunks +49 lines, -7 lines 0 comments Download
M src/runtime/runtime-i18n.cc View 1 2 3 1 chunk +21 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (2 generated)
Dan Ehrenberg
Great, this patch is much simpler than I thought it would be. Is there any ...
3 years, 11 months ago (2017-01-06 03:40:33 UTC) #3
Dan Ehrenberg
3 years, 10 months ago (2017-02-08 19:34:16 UTC) #4
On 2017/01/06 03:40:33, Dan Ehrenberg wrote:
> Great, this patch is much simpler than I thought it would be.
> 
> Is there any sort of option that we might be able to pass into ICU to get all
> the time zones printed as GMT[+-]x00 (TLA) as previously?

Thanks for following up upstream with the ECMA 402 feature request for more
options to get the right toString behavior
(https://github.com/tc39/ecma402/issues/108), as well as what our behavior
should be for historical timezone data changes
(https://github.com/tc39/ecma262/issues/725). This is all really great work.

Actually, now that I look at it a little more closely, (you probably already
knew this, but) it seems like there are a bunch of places where historical
timezone data would come up, for example, all of the date component getters and
setters (e.g., Date.prototype.getHour()). Monkey-patching from i18n.js is
probably not the right approach if these are affected, since we'd really want to
fix all of them.

Powered by Google App Engine
This is Rietveld 408576698