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

Unified Diff: src/i18n.cc

Issue 1501113002: Set the Gregorian changeover date to the beginning of time in Intl (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Replace a CHECK with DCHECK Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/intl/date-format/format-test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/i18n.cc
diff --git a/src/i18n.cc b/src/i18n.cc
index 7899f2937d5430760cae3ef60cd81e24d94452a8..4f5431fa95fd9904dc4f858cdc9e66f62a74638c 100644
--- a/src/i18n.cc
+++ b/src/i18n.cc
@@ -16,6 +16,7 @@
#include "unicode/decimfmt.h"
#include "unicode/dtfmtsym.h"
#include "unicode/dtptngen.h"
+#include "unicode/gregocal.h"
#include "unicode/locid.h"
#include "unicode/numfmt.h"
#include "unicode/numsys.h"
@@ -96,6 +97,16 @@ icu::SimpleDateFormat* CreateICUDateFormat(
icu::Calendar* calendar =
icu::Calendar::createInstance(tz, icu_locale, status);
+ if (calendar->getDynamicClassID() ==
+ icu::GregorianCalendar::getStaticClassID()) {
+ icu::GregorianCalendar* gc = (icu::GregorianCalendar*)calendar;
+ UErrorCode status = U_ZERO_ERROR;
+ // The beginning of ECMAScript time, namely -(2**53)
+ const double start_of_time = -9007199254740992;
+ gc->setGregorianChange(start_of_time, status);
+ DCHECK(U_SUCCESS(status));
+ }
+
// Make formatter from skeleton. Calendar and numbering system are added
// to the locale as Unicode extension (if they were specified at all).
icu::SimpleDateFormat* date_format = NULL;
« no previous file with comments | « no previous file | test/intl/date-format/format-test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698