File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -386,6 +386,18 @@ import { useLocale } from 'solid-compose';
386386const [locale, { setDateFormat }] = useLocale();
387387` ` `
388388
389+ ` formatDate ` allows to format a date according to the current locale ' s date formatting setting.
390+
391+ ` ` ` typescript
392+ import { formatDate, useLocale } from 'solid-compose';
393+
394+ const [locale, { setDateFormat }] = useLocale();
395+
396+ setDateFormat({ endianness: DateEndianness.MiddleEndian });
397+
398+ formatDate(Temporal.PlainDate.from('2000-12-31')) // 12/31/2000
399+ ` ` `
400+
389401### Time format
390402
391403` setTimeFormat ` allows to change the time format :
@@ -396,6 +408,18 @@ import { useLocale } from 'solid-compose';
396408const [locale, { setTimeFormat }] = useLocale();
397409` ` `
398410
411+ ` formatTime ` allows to format a time according to the current locale ' s time formatting setting.
412+
413+ ` ` ` typescript
414+ import { formatTime, useLocale } from 'solid-compose';
415+
416+ const [locale, { setTimeFormat }] = useLocale();
417+
418+ setTimeFormat({ is24HourClock: false });
419+
420+ formatTime(Temporal.PlainTime.from('00:30:05'), { precision: 'minute', omitZeroUnits: true }) // 12:30 AM
421+ ` ` `
422+
399423### Time zone
400424
401425` setTimeZone ` allows to change the time zone :
You can’t perform that action at this time.
0 commit comments