Skip to content

Commit a7ff703

Browse files
committed
fix: TT-230 use constants to format
1 parent 8099e63 commit a7ff703

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/app/modules/shared/components/input-date/input-date.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<input
22
[value]="value"
33
[disabled]="isDisabled"
4-
(dateInput)="onInput($event.target.value.format('YYYY-MM-DD'))"
4+
(dateInput)="onInput($event.target.value)"
55
class="form-control"
66
aria-label="Small"
77
aria-describedby="inputGroup-sizing-sm"

src/app/modules/shared/components/input-date/input-date.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import {Component, forwardRef} from '@angular/core';
22
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
33
import { MatDatepicker } from '@angular/material/datepicker';
4+
import { DATE_FORMAT_YEAR } from 'src/environments/environment';
5+
import * as moment from 'moment';
46

57
@Component({
68
selector: 'app-input-date',
@@ -23,8 +25,8 @@ export class InputDateComponent implements ControlValueAccessor {
2325
constructor() {
2426
}
2527

26-
onInput(value: string) {
27-
this.value = value;
28+
onInput(value: moment.Moment) {
29+
this.value = value.format(DATE_FORMAT_YEAR);
2830
this.onTouch();
2931
this.onChange(this.value);
3032
}

0 commit comments

Comments
 (0)