Skip to content

Commit 2324744

Browse files
committed
fix date change value for internationalization
1 parent 1b6b270 commit 2324744

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib/datepicker/datepicker-input.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ export class MdDatepickerInput<D> implements AfterContentInit, ControlValueAcces
112112
/** The value of the input. */
113113
@Input()
114114
get value(): D | null {
115-
return this._getValidDateOrNull(this._dateAdapter.parse(
116-
this._elementRef.nativeElement.value, this._dateFormats.parse.dateInput));
115+
return this._value;
117116
}
118117
set value(value: D | null) {
119118
if (value != null && !this._dateAdapter.isDateInstance(value)) {
@@ -123,12 +122,14 @@ export class MdDatepickerInput<D> implements AfterContentInit, ControlValueAcces
123122
value = this._getValidDateOrNull(value);
124123

125124
let oldDate = this.value;
125+
this._value = value;
126126
this._renderer.setProperty(this._elementRef.nativeElement, 'value',
127127
value ? this._dateAdapter.format(value, this._dateFormats.display.dateInput) : '');
128128
if (!this._dateAdapter.sameDate(oldDate, value)) {
129129
this._valueChange.emit(value);
130130
}
131131
}
132+
private _value: D | null;
132133

133134
/** The minimum valid date. */
134135
@Input()
@@ -226,6 +227,7 @@ export class MdDatepickerInput<D> implements AfterContentInit, ControlValueAcces
226227
this._datepickerSubscription =
227228
this._datepicker.selectedChanged.subscribe((selected: D) => {
228229
this.value = selected;
230+
// console.log('here ' + this.value);
229231
this._cvaOnChange(selected);
230232
this._onTouched();
231233
this.dateInput.emit(new MdDatepickerInputEvent(this, this._elementRef.nativeElement));

0 commit comments

Comments
 (0)