@@ -64,8 +64,7 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
6464 /**
6565 * Set the minimum possible value the editor will allow.
6666 *
67- * If a `string` value is passed in, it must be in the defined input format; if no input format is defined
68- * then the value's format must match the format based on the current locale.
67+ * If a `string` value is passed in, it must be in the defined input format.
6968 *
7069 * @example
7170 * ```html
@@ -85,8 +84,7 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
8584 /**
8685 * Set the maximum possible value the editor will allow.
8786 *
88- * If a `string` value is passed in, it must be in the defined input format; if no input format is defined
89- * then the value's format must match the format based on the current locale.
87+ * If a `string` value is passed in, it must be in the defined input format.
9088 * @example
9189 * ```html
9290 * <input igxDateTimeEditor [maxValue]="maxDate">
@@ -164,11 +162,11 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
164162 * Emitted when the editor's value has changed.
165163 * @example
166164 * ```html
167- * <input igxDateTimeEditor (valueChanged )="onValueChanged($event)"/>
165+ * <input igxDateTimeEditor (valueChange )="onValueChanged($event)"/>
168166 * ```
169167 */
170168 @Output ( )
171- public valueChange = new EventEmitter < IgxDateTimeEditorEventArgs > ( ) ;
169+ public valueChange = new EventEmitter < Date > ( ) ;
172170
173171 /**
174172 * Emitted when the editor is not within a specified range or when the editor's value is in an invalid state.
@@ -386,7 +384,12 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
386384 this . setSelectionRange ( cursor ) ;
387385 } else {
388386 const format = this . displayFormat || this . inputFormat ;
389- this . inputValue = formatDate ( this . value , format . replace ( 'tt' , 'aa' ) , this . locale ) ;
387+ if ( format ) {
388+ this . inputValue = formatDate ( this . value , format . replace ( 'tt' , 'aa' ) , this . locale ) ;
389+ } else {
390+ // TODO: formatter function?
391+ this . inputValue = this . value . toLocaleString ( ) ;
392+ }
390393 }
391394 }
392395
@@ -412,22 +415,29 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
412415 const newDate = new Date ( this . value . getTime ( ) ) ;
413416 switch ( datePart ) {
414417 case DatePart . Date :
415- return DatePickerUtil . spinDate ( delta , newDate , this . isSpinLoop ) ;
418+ DatePickerUtil . spinDate ( delta , newDate , this . isSpinLoop ) ;
419+ break ;
416420 case DatePart . Month :
417- return DatePickerUtil . spinMonth ( delta , newDate , this . isSpinLoop ) ;
421+ DatePickerUtil . spinMonth ( delta , newDate , this . isSpinLoop ) ;
422+ break ;
418423 case DatePart . Year :
419- return DatePickerUtil . spinYear ( delta , newDate ) ;
424+ DatePickerUtil . spinYear ( delta , newDate ) ;
425+ break ;
420426 case DatePart . Hours :
421- return DatePickerUtil . spinHours ( delta , newDate , this . isSpinLoop ) ;
427+ DatePickerUtil . spinHours ( delta , newDate , this . isSpinLoop ) ;
428+ break ;
422429 case DatePart . Minutes :
423- return DatePickerUtil . spinMinutes ( delta , newDate , this . isSpinLoop ) ;
430+ DatePickerUtil . spinMinutes ( delta , newDate , this . isSpinLoop ) ;
431+ break ;
424432 case DatePart . Seconds :
425- return DatePickerUtil . spinSeconds ( delta , newDate , this . isSpinLoop ) ;
433+ DatePickerUtil . spinSeconds ( delta , newDate , this . isSpinLoop ) ;
434+ break ;
426435 case DatePart . AmPm :
427436 const formatPart = this . _inputDateParts . find ( dp => dp . type === DatePart . AmPm ) ;
428437 const amPmFromMask = this . inputValue . substring ( formatPart . start , formatPart . end ) ;
429438 return DatePickerUtil . spinAmPm ( newDate , this . value , amPmFromMask ) ;
430439 }
440+ return newDate ;
431441 }
432442
433443 private updateValue ( newDate : Date ) : void {
@@ -438,7 +448,7 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
438448 this . validationFailed . emit ( { oldValue : this . _oldValue , newValue : this . value , userInput : this . inputValue } ) ;
439449 }
440450 if ( this . inputIsComplete ( ) || this . inputValue === this . emptyMask ) {
441- this . valueChange . emit ( { oldValue : this . _oldValue , newValue : this . value , userInput : this . inputValue } ) ;
451+ this . valueChange . emit ( this . value ) ;
442452 }
443453 }
444454
0 commit comments