second version
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user