feat(facade): add support for Date

Also refactors the dart transpilar to expose
the type mappings for future changes.
This commit is contained in:
Tobias Bosch
2015-02-17 14:29:40 -08:00
committed by Misko Hevery
parent 538b0879dc
commit 674848648a
4 changed files with 30 additions and 9 deletions

View File

@ -1,6 +1,6 @@
library angular.core.facade.lang;
export 'dart:core' show Type, RegExp, print;
export 'dart:core' show Type, RegExp, print, DateTime;
import 'dart:math' as math;
import 'dart:convert' as convert;
@ -183,3 +183,12 @@ class Json {
static parse(String s) => convert.JSON.decode(s);
static stringify(data) => convert.JSON.encode(data);
}
class DateWrapper {
static fromMillis(int ms) {
return new DateTime.fromMillisecondsSinceEpoch(ms);
}
static now() {
return new DateTime.now();
}
}

View File

@ -3,6 +3,7 @@ export {_global as global};
export var Type = Function;
export var Math = _global.Math;
export var Date = _global.Date;
var assertionsEnabled_ = typeof assert !== 'undefined';
@ -250,3 +251,12 @@ export function print(obj) {
// Can't be all uppercase as our transpiler would think it is a special directive...
export var Json = _global.JSON;
export class DateWrapper {
static fromMillis(ms) {
return new Date(ms);
}
static now() {
return new Date();
}
}