mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-09-15 15:22:25 +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
34
src/app/hooks/useDateFormat.ts
Normal file
34
src/app/hooks/useDateFormat.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { useMemo } from 'react';
|
||||
import { DateFormat } from '../state/settings';
|
||||
|
||||
export type DateFormatItem = {
|
||||
name: string;
|
||||
format: DateFormat;
|
||||
};
|
||||
|
||||
export const useDateFormatItems = (): DateFormatItem[] =>
|
||||
useMemo(
|
||||
() => [
|
||||
{
|
||||
format: 'D MMM YYYY',
|
||||
name: 'D MMM YYYY',
|
||||
},
|
||||
{
|
||||
format: 'DD/MM/YYYY',
|
||||
name: 'DD/MM/YYYY',
|
||||
},
|
||||
{
|
||||
format: 'MM/DD/YYYY',
|
||||
name: 'MM/DD/YYYY',
|
||||
},
|
||||
{
|
||||
format: 'YYYY/MM/DD',
|
||||
name: 'YYYY/MM/DD',
|
||||
},
|
||||
{
|
||||
format: '',
|
||||
name: 'Custom',
|
||||
},
|
||||
],
|
||||
[]
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue