mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
fix(feed): keep the TZID when a clock already carries seconds
fmtDateTime's time-only branch appended '00' for seconds no matter what it was given. The booking import stores what KItinerary hands it, which is '10:00:00', so the value came out 17 characters long. dtLine only attaches the TZID to a well-formed 15-character value, so those events lost their zone and went out as floating times, which is the #1453 regression by another route. It pads the way the ISO branch above it already does, so every caller is covered rather than only the rental markers.
This commit is contained in:
@@ -182,10 +182,15 @@ export class CalendarService {
|
||||
// Pad to 15 chars (YYYYMMDDTHHMMSS) — add missing seconds
|
||||
return raw.length === 13 ? raw + '00' : raw;
|
||||
}
|
||||
// Time-only: combine with reference date
|
||||
// Time-only: combine with reference date. Pad the same way the branch above
|
||||
// does rather than unconditionally, because the value can already carry
|
||||
// seconds ("10:00:00" is what the booking import stores). Appending
|
||||
// regardless made it 17 characters, which fails dtLine's shape check, drops
|
||||
// the TZID and leaves a floating time in the feed (#1453 again).
|
||||
if (refDate && d.match(/^\d{2}:\d{2}/)) {
|
||||
const datePart = refDate.split('T')[0];
|
||||
return `${datePart}T${d.replace(/:/g, '')}00`.replace(/-/g, '');
|
||||
const raw = `${datePart}T${d.replace(/:/g, '')}`.replace(/-/g, '');
|
||||
return raw.length === 13 ? raw + '00' : raw;
|
||||
}
|
||||
return d.replace(/[-:]/g, '');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user