feat(facade): add fromISODate method

This commit is contained in:
Brian Ford 2015-10-13 12:04:38 -07:00
parent f529236bfc
commit 440fd11c72
2 changed files with 5 additions and 0 deletions

View File

@ -266,6 +266,10 @@ class DateWrapper {
return new DateTime(year, month, day, hour, minutes, seconds, milliseconds); return new DateTime(year, month, day, hour, minutes, seconds, milliseconds);
} }
static DateTime fromISOString(String str) {
return DateTime.parse(str);
}
static DateTime fromMillis(int ms) { static DateTime fromMillis(int ms) {
return new DateTime.fromMillisecondsSinceEpoch(ms, isUtc: true); return new DateTime.fromMillisecondsSinceEpoch(ms, isUtc: true);
} }

View File

@ -325,6 +325,7 @@ export class DateWrapper {
minutes: number = 0, seconds: number = 0, milliseconds: number = 0): Date { minutes: number = 0, seconds: number = 0, milliseconds: number = 0): Date {
return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds); return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds);
} }
static fromISOString(str: string): Date { return new Date(str); }
static fromMillis(ms: number): Date { return new Date(ms); } static fromMillis(ms: number): Date { return new Date(ms); }
static toMillis(date: Date): number { return date.getTime(); } static toMillis(date: Date): number { return date.getTime(); }
static now(): Date { return new Date(); } static now(): Date { return new Date(); }