Limit minimum endsOn datetime selector to current beginsOn, set correct

date of first week and translate labels on datepicker

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-10-11 18:41:29 +02:00
parent 77830ec4a8
commit dc4504e091
5 changed files with 53 additions and 2 deletions

21
js/src/utils/datetime.ts Normal file
View File

@@ -0,0 +1,21 @@
function localeMonthNames(): string[] {
const monthNames: string[] = [];
for (let i = 0; i < 12; i += 1) {
const d = new Date(2019, i, 1);
const month = d.toLocaleString('default', { month: 'long' });
monthNames.push(month);
}
return monthNames;
}
function localeShortWeekDayNames(): string[] {
const weekDayNames: string[] = [];
for (let i = 13; i < 20; i += 1) {
const d = new Date(2019, 9, i);
const weekDay = d.toLocaleString('default', { weekday: 'short' });
weekDayNames.push(weekDay);
}
return weekDayNames;
}
export { localeMonthNames, localeShortWeekDayNames };