From c209747c6ae1b8fc4d095e5f65bb3cab5d4bfeb4 Mon Sep 17 00:00:00 2001 From: Graeme Wicksted Date: Mon, 31 Aug 2015 10:29:58 -0400 Subject: [PATCH 1/2] Add parameters to toLocaleDateString Also added missing option in Intl.DateTimeFormatOptions (timeZone). Original ticket #4294 --- src/lib/intl.d.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lib/intl.d.ts b/src/lib/intl.d.ts index 57df70672d4d6..1265dc51486da 100644 --- a/src/lib/intl.d.ts +++ b/src/lib/intl.d.ts @@ -88,6 +88,7 @@ declare module Intl { timeZoneName?: string; formatMatcher?: string; hour12?: boolean; + timeZone?: string; } interface ResolvedDateTimeFormatOptions { @@ -157,17 +158,29 @@ interface Number { interface Date { /** - * Converts a date to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } From 03da2ce42b3c77375043ff7c96fe14357e9a099f Mon Sep 17 00:00:00 2001 From: Graeme Wicksted Date: Wed, 2 Sep 2015 10:19:49 -0400 Subject: [PATCH 2/2] Added toLocaleTimeString variations See [Mozilla Reference ](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString) --- src/lib/intl.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib/intl.d.ts b/src/lib/intl.d.ts index 1265dc51486da..b5291306b87ca 100644 --- a/src/lib/intl.d.ts +++ b/src/lib/intl.d.ts @@ -170,17 +170,32 @@ interface Date { */ toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + /** * Converts a date and time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + /** * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; }