Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/angular.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'dart:html' as dom;
import 'dart:js' as js;
import 'package:di/di.dart';
import 'package:di/dynamic_injector.dart';
import 'package:intl/date_symbol_data_local.dart';

/**
* If you are writing code accessed from Angular expressions, you must include
Expand Down
6 changes: 4 additions & 2 deletions lib/bootstrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ Injector ngBootstrap({
return zone.run(() {
var rootElements = [element];
Injector injector = injectorFactory(ngModules);
injector.get(Compiler)(rootElements, injector.get(DirectiveMap))
(injector, rootElements);
initializeDateFormatting(null, null).then((_) {
injector.get(Compiler)(rootElements, injector.get(DirectiveMap))
(injector, rootElements);
});
return injector;
});
}
Expand Down
16 changes: 16 additions & 0 deletions test/filter/date_spec.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
library date_spec;

import '../_specs.dart';
import 'package:intl/intl.dart';

main() => describe('date', () {
var morning = DateTime.parse('2010-09-03T07:05:08.008Z'); //7am
Expand Down Expand Up @@ -63,4 +64,19 @@ main() => describe('date', () {
date(noon, "shortTime");
date(noon, "shortTime");
});

it('should accept various locales', () {

try {
Intl.defaultLocale = 'de';
expect(date(noon, "medium")).
toEqual('Sep 3, 2010 12:05:08 nachm.');

Intl.defaultLocale = 'fr';
expect(date(noon, "medium")).
toEqual('sept. 3, 2010 12:05:08 PM');
} finally {
Intl.defaultLocale = 'en';
}
});
});