UNPKG

391 BPlain TextView Raw
1/**
2 * Format the week number.
3 *
4 * @defaultValue `weekNumber.toLocaleString()` with a leading zero for single-digit numbers
5 * @group Formatters
6 * @see https://daypicker.dev/docs/translation#custom-formatters
7 */
8export function formatWeekNumber(weekNumber: number) {
9 if (weekNumber < 10) {
10 return `0${weekNumber.toLocaleString()}`;
11 }
12 return `${weekNumber.toLocaleString()}`;
13}