@@ -4,7 +4,7 @@ import { DateTime } from '../datetime';
4
4
import { Form } from '../../../util/form' ;
5
5
import { Picker } from '../../picker/picker' ;
6
6
import { PickerController } from '../../picker/picker-controller' ;
7
- import * as datetime from '../../../util/datetime-util' ;
7
+ import * as datetimeUtil from '../../../util/datetime-util' ;
8
8
import { mockApp , mockConfig , mockElementRef , mockRenderer } from '../../../util/mock-providers' ;
9
9
10
10
@@ -14,6 +14,26 @@ describe('DateTime', () => {
14
14
15
15
describe ( 'validate' , ( ) => {
16
16
17
+ fit ( 'should default to now if no initial value or bounds supplied' , ( ) => {
18
+ const now = datetimeUtil . parseDate ( new Date ( ) . toISOString ( ) ) ;
19
+ datetime . generate ( ) ;
20
+ const val = datetime . getValue ( ) ;
21
+ expect ( val . year ) . toEqual ( now . year ) ;
22
+ expect ( val . month ) . toEqual ( now . month ) ;
23
+ expect ( val . day ) . toEqual ( now . day ) ;
24
+ expect ( val . hour ) . toEqual ( now . hour ) ;
25
+ expect ( val . minute ) . toEqual ( now . minute ) ;
26
+ } ) ;
27
+
28
+ fit ( 'should default to max if no initial value supplied but max specified' , ( ) => {
29
+ datetime . max = '1987-10-19' ;
30
+ datetime . generate ( ) ;
31
+ const val = datetime . getValue ( ) ;
32
+ expect ( val . year ) . toEqual ( 1987 ) ;
33
+ expect ( val . month ) . toEqual ( 10 ) ;
34
+ expect ( val . day ) . toEqual ( 19 ) ;
35
+ } ) ;
36
+
17
37
it ( 'should restrict January 1-14, 2000 from selection, then allow it, and restrict December 15-31, 2001' , ( ) => {
18
38
datetime . max = '2001-12-15' ;
19
39
datetime . min = '2000-01-15' ;
@@ -683,7 +703,7 @@ describe('DateTime', () => {
683
703
console . warn = function ( ) { } ;
684
704
685
705
// pt-br
686
- var customLocale : datetime . LocaleData = {
706
+ var customLocale : datetimeUtil . LocaleData = {
687
707
dayNames : [
688
708
'domingo' ,
689
709
'segunda-feira' ,
0 commit comments