second version

This commit is contained in:
Dusan Vojacek
2026-04-03 14:23:16 +02:00
parent 897b95f728
commit 9f4126946d
105 changed files with 9738 additions and 1470 deletions

View File

@@ -16,3 +16,16 @@ export function instantPragueDay(iso: string): string {
day: '2-digit',
}).format(new Date(iso))
}
/** Kalendářní den v Praze posunutý o N dní (od ref YYYY-MM-DD v Praze). */
export function pragueAddCalendarDays(ymd: string, deltaDays: number): string {
const [y, m, d] = ymd.split('-').map(Number)
const utc = new Date(Date.UTC(y, m - 1, d, 12, 0, 0))
utc.setUTCDate(utc.getUTCDate() + deltaDays)
return new Intl.DateTimeFormat('en-CA', {
timeZone: 'Europe/Prague',
year: 'numeric',
month: '2-digit',
day: '2-digit',
}).format(utc)
}