# HG changeset patch # User Bill Gianopoulos # Date 1519746280 18000 # Node ID b8857d30de31c633f98e92d3401bc65172235720 # Parent 4083ae832849c880f319e83323a2d93e65de9ec9 Bug 1442886 - Replace Services.intl.createDateTimeFormat with Services.intl.DateTimeFormat in SeaMonkey. r=frg Port Bug 1428172 [Align mozIntl with Intl when working with constructors]. diff --git a/suite/browser/pageinfo/pageInfo.js b/suite/browser/pageinfo/pageInfo.js --- a/suite/browser/pageinfo/pageInfo.js +++ b/suite/browser/pageinfo/pageInfo.js @@ -1079,17 +1079,17 @@ function formatNumber(number) } function formatDate(datestr, unknown) { var date = new Date(datestr); if (!date.valueOf()) return unknown; - const dateTimeFormatter = Services.intl.createDateTimeFormat(undefined, { + const dateTimeFormatter = new Services.intl.DateTimeFormat(undefined, { dateStyle: "full", timeStyle: "long"}); return dateTimeFormatter.format(date); } function getSelectedItems(linksMode) { // linksMode is a boolean that is used to determine // whether the getSelectedItems() function needs to diff --git a/suite/components/console/content/consoleBindings.xml b/suite/components/console/content/consoleBindings.xml --- a/suite/components/console/content/consoleBindings.xml +++ b/suite/components/console/content/consoleBindings.xml @@ -272,17 +272,17 @@ Services.console.logStringMessage(null); Services.console.reset(); ]]> 1) restorePopup.firstChild.remove(); (async function() { let backupFiles = await PlacesBackups.getBackupFiles(); if (backupFiles.length == 0) diff --git a/suite/components/places/content/treeView.js b/suite/components/places/content/treeView.js --- a/suite/components/places/content/treeView.js +++ b/suite/components/places/content/treeView.js @@ -551,29 +551,29 @@ PlacesTreeView.prototype = { }, // We use a different formatter for times within the current day, // so we cache both a "today" formatter and a general date formatter. __todayFormatter: null, get _todayFormatter() { if (!this.__todayFormatter) { const dtOptions = { timeStyle: "short" }; - this.__todayFormatter = Services.intl.createDateTimeFormat(undefined, dtOptions); + this.__todayFormatter = new Services.intl.DateTimeFormat(undefined, dtOptions); } return this.__todayFormatter; }, __dateFormatter: null, get _dateFormatter() { if (!this.__dateFormatter) { const dtOptions = { dateStyle: "short", timeStyle: "short" }; - this.__dateFormatter = Services.intl.createDateTimeFormat(undefined, dtOptions); + this.__dateFormatter = new Services.intl.DateTimeFormat(undefined, dtOptions); } return this.__dateFormatter; }, COLUMN_TYPE_UNKNOWN: 0, COLUMN_TYPE_TITLE: 1, COLUMN_TYPE_URI: 2, COLUMN_TYPE_DATE: 3, diff --git a/suite/components/places/tests/chrome/test_treeview_date.xul b/suite/components/places/tests/chrome/test_treeview_date.xul --- a/suite/components/places/tests/chrome/test_treeview_date.xul +++ b/suite/components/places/tests/chrome/test_treeview_date.xul @@ -126,17 +126,17 @@ if (node.uri == "http://at.midnight.com/" || node.uri == "http://after.midnight.com/") { dtOptions.dateStyle = undefined; } else if (node.uri != "http://before.midnight.com/") { // Avoid to test spurious uris, due to how the test works // a redirecting uri could be put in the tree while we test. break; } - let timeStr = Services.intl.createDateTimeFormat(undefined, dtOptions).format(timeObj); + let timeStr = new Services.intl.DateTimeFormat(undefined, dtOptions).format(timeObj); is(text, timeStr, "Date format is correct"); break; case "visitCount": is(text, 1, "Visit count is correct"); break; } } } diff --git a/suite/mailnews/components/addrbook/content/abCardViewOverlay.js b/suite/mailnews/components/addrbook/content/abCardViewOverlay.js --- a/suite/mailnews/components/addrbook/content/abCardViewOverlay.js +++ b/suite/mailnews/components/addrbook/content/abCardViewOverlay.js @@ -246,23 +246,23 @@ function DisplayCardViewPane(realCard) if (day > 0 && day < 32 && month > 0 && month < 13) { var date; var formatter; if (year) { // use UTC-based calculations to avoid off-by-one day // due to time zone/dst discontinuity date = new Date(Date.UTC(year, month - 1, day)); date.setUTCFullYear(year); // to handle two-digit years properly - formatter = Services.intl.createDateTimeFormat(undefined, + formatter = new Services.intl.DateTimeFormat(undefined, { dateStyle: "long", timeZone: "UTC" }); } // if the year doesn't exist, display Month DD (ex. January 1) else { date = new Date(Date.UTC(saneBirthYear(year), month - 1, day)); - formatter = Services.intl.createDateTimeFormat(undefined, + formatter = new Services.intl.DateTimeFormat(undefined, { month: "long", day: "numeric", timeZone: "UTC" }); } dateStr = formatter.format(date); } else if (year) dateStr = year; visible = cvSetNodeWithLabel(data.cvBirthday, zBirthday, dateStr);