shaduler
Recipes

Locales

formatTime takes a BCP 47 locale and delegates to Intl.DateTimeFormat.

The same data, three different locales. ShadulerTimeColumn accepts locale (BCP 47) and timeFormat ('12h' | '24h'); both forward to formatTime which is a thin wrapper over Intl.DateTimeFormat.

en-US (12h)
A
B
8 AM
9 AM
10 AM
11 AM
12 PM
1 PM
2 PM
3 PM
4 PM
Meeting
Focus
Lunch
de-DE (24h)
A
B
08 Uhr
09 Uhr
10 Uhr
11 Uhr
12 Uhr
13 Uhr
14 Uhr
15 Uhr
16 Uhr
Meeting
Focus
Lunch
ja-JP (24h)
A
B
8時
9時
10時
11時
12時
13時
14時
15時
16時
Meeting
Focus
Lunch
const START_HOUR = 8
const END_HOUR = 17

<ShadulerTimeColumn
  startTime={START_HOUR}
  endTime={END_HOUR}
  timeFormat="12h"
  locale="en-US"
/>

formatTime is also exported — call it directly when you render time strings outside the time column (e.g. inside custom task content).

import { formatTime } from '@/components/ui/shaduler'

formatTime(540, { format: '24h', locale: 'de-DE' })  // → "09:00"
formatTime(540, { format: '12h', locale: 'en-US' })  // → "9:00 AM"
formatTime(540, { format: '24h', locale: 'ja-JP' })  // → "9:00"

If you skip locale, the user's environment default is used.