feat(facade): add support for Date
Also refactors the dart transpilar to expose the type mappings for future changes.
This commit is contained in:

committed by
Misko Hevery

parent
538b0879dc
commit
674848648a
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user