mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Refactor ISOToDateTime to handle case when timezone's server is UTC
A condition is added to check if the timezone is set as '0000' (UTC timezone), if yes then a new Date is returned with the Date.UTC method. This ensures that the time returned correctly reflects the current timezone
This commit is contained in:
parent
ab5f2ffb65
commit
84ce8a93f3
@ -59,6 +59,10 @@ export const ISOToDatetime = (str: string|null): Date|null => {
|
|||||||
[hours, minutes, seconds] = time.split(':').map(s => parseInt(s));
|
[hours, minutes, seconds] = time.split(':').map(s => parseInt(s));
|
||||||
;
|
;
|
||||||
|
|
||||||
|
if ('0000' === timezone) {
|
||||||
|
return new Date(Date.UTC(year, month-1, date, hours, minutes, seconds));
|
||||||
|
}
|
||||||
|
|
||||||
return new Date(year, month-1, date, hours, minutes, seconds);
|
return new Date(year, month-1, date, hours, minutes, seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user