I uses Angular Saturn-datepicker. "saturn-datepicker": "7.2.1",
I need to show just last two digits in a year, from 2020
to 20
.
Here is my template
<div
class="create-request__select"
(click)="setMinMaxInterval(); picker.open()"
>
<input
class="my-input"
[satDatepicker]="picker"
[min]="minDate"
[max]="maxDate"
(dateChange)="dateChange($event.value)"
[value]="dateRange"
readonly
/>
<sat-datepicker #picker [rangeMode]="true"></sat-datepicker>
</div>
Here is my imports in app.module.js
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
SatDatepickerModule,
SatNativeDateModule
} from "saturn-datepicker";
{ provide: DateAdapter, useClass: MyDateAdapter },
{ provide: MAT_DATE_LOCALE, useValue: "ru-RU" },
{ provide: MAT_DATE_FORMATS, useValue: MyDateFormat },
Here is my change adapter and format
@Injectable()
export class MyDateAdapter extends NativeDateAdapter {
getFirstDayOfWeek(): number {
return 1;
}
}
export const MyDateFormat = {
display: {
dateInput: "DD.MMMM.YY",
monthYearLabel: "MMMM YYYY",
dateA11yLabel: "MM/DD/YYYY",
monthYearA11yLabel: "MMMM YYYY"
}
};