@@ -9,7 +9,7 @@ import { Form } from '../../util/form';
9
9
import { BaseInput } from '../../util/base-input' ;
10
10
import { Item } from '../item/item' ;
11
11
import { deepCopy , isBlank , isPresent , isArray , isString , assert , clamp } from '../../util/util' ;
12
- import { dateValueRange , renderDateTime , renderTextFormat , convertFormatToKey , getValueFromFormat , parseTemplate , parseDate , updateDate , DateTimeData , daysInMonth , dateSortValue , dateDataSortValue , LocaleData } from '../../util/datetime-util' ;
12
+ import { dateValueRange , renderDateTime , renderTextFormat , convertDataToISO , convertFormatToKey , getValueFromFormat , parseTemplate , parseDate , updateDate , DateTimeData , daysInMonth , dateSortValue , dateDataSortValue , LocaleData } from '../../util/datetime-util' ;
13
13
14
14
/**
15
15
* @name DateTime
@@ -267,14 +267,13 @@ import { dateValueRange, renderDateTime, renderTextFormat, convertFormatToKey, g
267
267
providers : [ { provide : NG_VALUE_ACCESSOR , useExisting : DateTime , multi : true } ] ,
268
268
encapsulation : ViewEncapsulation . None ,
269
269
} )
270
- export class DateTime extends BaseInput < DateTimeData | string > implements AfterViewInit , ControlValueAccessor , OnDestroy {
270
+ export class DateTime extends BaseInput < DateTimeData > implements AfterViewInit , ControlValueAccessor , OnDestroy {
271
271
272
272
_text : string = '' ;
273
273
_min : DateTimeData ;
274
274
_max : DateTimeData ;
275
275
_locale : LocaleData = { } ;
276
276
_picker : Picker ;
277
- _internalValue : DateTimeData = { } ;
278
277
279
278
/**
280
279
* @input {string} The minimum datetime allowed. Value must be a date string
@@ -440,16 +439,9 @@ export class DateTime extends BaseInput<DateTimeData|string> implements AfterVie
440
439
/**
441
440
* @hidden
442
441
*/
443
- _inputReset ( ) {
444
- this . _internalValue = { } ;
445
- }
446
-
447
- /**
448
- * @hidden
449
- */
450
- _inputCheckHasValue ( val : any ) {
451
- updateDate ( this . _internalValue , val ) ;
452
- super . _inputCheckHasValue ( val ) ;
442
+ _inputNormalize ( val : any ) : DateTimeData {
443
+ updateDate ( this . _value , val ) ;
444
+ return this . _value ;
453
445
}
454
446
455
447
/**
@@ -474,6 +466,13 @@ export class DateTime extends BaseInput<DateTimeData|string> implements AfterVie
474
466
return this . value ;
475
467
}
476
468
469
+ /**
470
+ * @hidden
471
+ */
472
+ _inputNgModelEvent ( ) : any {
473
+ return convertDataToISO ( this . value ) ;
474
+ }
475
+
477
476
@HostListener ( 'click' , [ '$event' ] )
478
477
_click ( ev : UIEvent ) {
479
478
// do not continue if the click event came from a form submit
@@ -758,7 +757,7 @@ export class DateTime extends BaseInput<DateTimeData|string> implements AfterVie
758
757
* @hidden
759
758
*/
760
759
getValue ( ) : DateTimeData {
761
- return this . _internalValue ;
760
+ return this . _value ;
762
761
}
763
762
764
763
/**
0 commit comments