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

Unified Diff: src/extensions/experimental/i18n.js

Issue 7244008: Change timeType and dateType in i18n date format API into timeStyle and dateStyle to match the pr... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 6 months 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 | « src/extensions/experimental/datetime-format.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/extensions/experimental/i18n.js
===================================================================
--- src/extensions/experimental/i18n.js (revision 8401)
+++ src/extensions/experimental/i18n.js (working copy)
@@ -145,9 +145,8 @@
* @param {Object} locale - locale object to pass to formatter.
* @param {Object} settings - formatting flags:
* - skeleton
- * - dateType
- * - timeType
- * - calendar
+ * - dateStyle
+ * - timeStyle
* @private
* @constructor
*/
@@ -161,25 +160,37 @@
cleanSettings['skeleton'] = settings['skeleton'];
} else {
cleanSettings = {};
- if (settings.hasOwnProperty('dateType')) {
+ if (settings.hasOwnProperty('dateStyle')) {
+ var ds = settings['dateStyle'];
+ if (!/^short|medium|long|full$/.test(dt)) ds = 'short';
rginda 2011/06/23 18:24:16 You'll need to parenthesize that regexp... /^(sh
Nebojša Ćirić 2011/06/23 18:48:46 Done.
+ cleanSettings['dateStyle'] = ds;
+ } else if (settings.hasOwnProperty('dateType')) {
+ // Obsolete. New spec requires dateStyle, but we'll keep this around
+ // for current users.
+ // TODO(cira): Remove when all internal users switch to dateStyle.
var dt = settings['dateType'];
if (!/^short|medium|long|full$/.test(dt)) dt = 'short';
- cleanSettings['dateType'] = dt;
+ cleanSettings['dateStyle'] = dt;
}
- if (settings.hasOwnProperty('timeType')) {
+ if (settings.hasOwnProperty('timeStyle')) {
+ var ts = settings['timeStyle'];
+ if (!/^short|medium|long|full$/.test(tt)) ts = 'short';
rginda 2011/06/23 18:24:16 Here too.
Nebojša Ćirić 2011/06/23 18:48:46 Done.
+ cleanSettings['timeStyle'] = ts;
+ } else if (settings.hasOwnProperty('timeType')) {
+ // TODO(cira): Remove when all internal users switch to timeStyle.
var tt = settings['timeType'];
if (!/^short|medium|long|full$/.test(tt)) tt = 'short';
- cleanSettings['timeType'] = tt;
+ cleanSettings['timeStyle'] = tt;
}
}
// Default is to show short date and time.
if (!cleanSettings.hasOwnProperty('skeleton') &&
- !cleanSettings.hasOwnProperty('dateType') &&
- !cleanSettings.hasOwnProperty('timeType')) {
- cleanSettings = {'dateType': 'short',
- 'timeType': 'short'};
+ !cleanSettings.hasOwnProperty('dateStyle') &&
+ !cleanSettings.hasOwnProperty('timeStyle')) {
+ cleanSettings = {'dateStyle': 'short',
+ 'timeStyle': 'short'};
}
locale = v8Locale.__createLocaleOrDefault(locale);
« no previous file with comments | « src/extensions/experimental/datetime-format.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698