- Added missing tz overloads for constructing a moment at now in a specific

timezone and constructing a moment from a string using strict parsing and
specific timezone.

- Added missing getter tz for getting the current timezone of a
moment instance.
This commit is contained in:
Michael Nahkies
2015-04-11 14:47:47 +12:00
parent d5f92f93bd
commit c17bd6dfc5
2 changed files with 8 additions and 0 deletions

View File

@@ -8,11 +8,16 @@ june.tz('America/Los_Angeles').format('ha z');
var a = moment.tz("2013-11-18 11:55", "America/Toronto");
var b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto");
var c = moment.tz(1403454068850, "America/Toronto");
var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto");
a.tz();
var arr = [2013, 5, 1],
str = "2013-12-01",
obj = { year : 2013, month : 5, day : 1 };
moment.tz("America/Los_Angeles");
moment.tz(arr, "America/Los_Angeles");
moment.tz(str, "America/Los_Angeles");
moment.tz(obj, "America/Los_Angeles");

View File

@@ -7,6 +7,7 @@
declare module moment {
interface Moment {
tz(): string;
tz(timezone: string): Moment;
}
@@ -27,9 +28,11 @@ interface MomentZone {
}
interface MomentTimezone {
(timezone: string): moment.Moment;
(date: number, timezone: string): moment.Moment;
(date: number[], timezone: string): moment.Moment;
(date: string, format: string, timezone: string): moment.Moment;
(date: string, format: string, useStrict: boolean, timezone: string): moment.Moment;
(date: Date, timezone: string): moment.Moment;
(date: moment.Moment, timezone: string): moment.Moment;
(date: Object, timezone: string): moment.Moment;