mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-13 18:50:29 +03:00
Add settings to enable 24-hour time format and customizable date format (#2347)
* Add setting to enable 24-hour time format * added hour24Clock to TimeProps * Add incomplete dateFormatString setting * Move 24-hour toggle to Appearance * Add "Date & Time" subheading, cleanup after merge * Add setting for date formatting * Fix minor formatting and naming issues * Document functions * adress most comments * add hint for date formatting * add support for 24hr time to TimePicker * prevent overflow on small displays
This commit is contained in:
parent
67b05eeb09
commit
9183fd66b2
17 changed files with 691 additions and 82 deletions
|
|
@ -9,7 +9,8 @@ export const today = (ts: number): boolean => dayjs(ts).isToday();
|
|||
|
||||
export const yesterday = (ts: number): boolean => dayjs(ts).isYesterday();
|
||||
|
||||
export const timeHour = (ts: number): string => dayjs(ts).format('hh');
|
||||
export const timeHour = (ts: number, hour24Clock: boolean): string =>
|
||||
dayjs(ts).format(hour24Clock ? 'HH' : 'hh');
|
||||
export const timeMinute = (ts: number): string => dayjs(ts).format('mm');
|
||||
export const timeAmPm = (ts: number): string => dayjs(ts).format('A');
|
||||
export const timeDay = (ts: number): string => dayjs(ts).format('D');
|
||||
|
|
@ -17,9 +18,11 @@ export const timeMon = (ts: number): string => dayjs(ts).format('MMM');
|
|||
export const timeMonth = (ts: number): string => dayjs(ts).format('MMMM');
|
||||
export const timeYear = (ts: number): string => dayjs(ts).format('YYYY');
|
||||
|
||||
export const timeHourMinute = (ts: number): string => dayjs(ts).format('hh:mm A');
|
||||
export const timeHourMinute = (ts: number, hour24Clock: boolean): string =>
|
||||
dayjs(ts).format(hour24Clock ? 'HH:mm' : 'hh:mm A');
|
||||
|
||||
export const timeDayMonYear = (ts: number): string => dayjs(ts).format('D MMM YYYY');
|
||||
export const timeDayMonYear = (ts: number, dateFormatString: string): string =>
|
||||
dayjs(ts).format(dateFormatString);
|
||||
|
||||
export const timeDayMonthYear = (ts: number): string => dayjs(ts).format('D MMMM YYYY');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue