Merge pull request 'fix/pedimentos-date' (#120) from fix/pedimentos-fix-date into development

Reviewed-on: ADUANASOFT/anexo76#120
This commit is contained in:
2026-02-09 19:00:37 +00:00

View File

@@ -1,7 +1,7 @@
import {
getLocalTimeZone,
parseDate,
parseTime,
import {
getLocalTimeZone,
parseDate,
parseTime,
toCalendarDateTime,
fromDate,
now,
@@ -39,7 +39,8 @@ export function loadServerDate(isoStr: string | null | undefined): string {
// Si incluye T es ISO completo, convertir a zona local
if (isoStr.includes('T')) {
const dateObj = new Date(isoStr);
return fromDate(dateObj, localTimeZone).toString();
const zonedDate = fromDate(dateObj, localTimeZone);
return `${zonedDate.year}-${String(zonedDate.month).padStart(2, '0')}-${String(zonedDate.day).padStart(2, '0')}`;
}
// Si no, asumir fecha plana YYYY-MM-DD
return isoStr.substring(0, 10);
@@ -61,8 +62,8 @@ export function addDaysLocal(dateStr: string, days: number): string {
}
export function getCurrentLocalYear(): string {
const nowZoned = now(localTimeZone);
return String(nowZoned.year).slice(-2);
const nowZoned = now(localTimeZone);
return String(nowZoned.year).slice(-2);
}
export function getCurrentLocalDate(): string {
@@ -70,6 +71,6 @@ export function getCurrentLocalDate(): string {
}
export function getCurrentLocalTime(): string {
const nowZoned = now(localTimeZone);
return `${String(nowZoned.hour).padStart(2, '0')}:${String(nowZoned.minute).padStart(2, '0')}`;
const nowZoned = now(localTimeZone);
return `${String(nowZoned.hour).padStart(2, '0')}:${String(nowZoned.minute).padStart(2, '0')}`;
}