mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 08:24:55 +00:00
- Fixed wrong date format when saving the google events
This commit is contained in:
@ -15,19 +15,12 @@ export async function fetchGoogleCalendarEvents(token, startDate) {
|
||||
const start = item.start;
|
||||
let startDateTime;
|
||||
if (start !== undefined) {
|
||||
const timezone = start.timeZone;
|
||||
if (start.dateTime) {
|
||||
const stringDate = start.dateTime;
|
||||
startDateTime = new Date(stringDate).toLocaleString("en-us", {
|
||||
...options,
|
||||
timeZone: timezone,
|
||||
});
|
||||
startDateTime = new Date(stringDate);
|
||||
} else {
|
||||
const stringDate = start.date;
|
||||
startDateTime = new Date(stringDate).toLocaleString("en-us", {
|
||||
...options,
|
||||
timeZone: timezone,
|
||||
});
|
||||
startDateTime = new Date(stringDate);
|
||||
isAllDay = true;
|
||||
}
|
||||
}
|
||||
@ -35,19 +28,12 @@ export async function fetchGoogleCalendarEvents(token, startDate) {
|
||||
const end = item.end;
|
||||
let endDateTime;
|
||||
if (end !== undefined) {
|
||||
const timezone = end.timeZone;
|
||||
if (end.dateTime) {
|
||||
const stringDate = end.dateTime;
|
||||
endDateTime = new Date(stringDate).toLocaleString("en-us", {
|
||||
...options,
|
||||
timeZone: timezone,
|
||||
});
|
||||
endDateTime = new Date(stringDate);
|
||||
} else {
|
||||
const stringDate = end.date;
|
||||
endDateTime = new Date(stringDate).toLocaleString("en-us", {
|
||||
...options,
|
||||
timeZone: timezone,
|
||||
});
|
||||
endDateTime = new Date(stringDate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,13 +49,3 @@ export async function fetchGoogleCalendarEvents(token, startDate) {
|
||||
|
||||
return googleEvents;
|
||||
}
|
||||
|
||||
const options = {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
second: "numeric",
|
||||
timeZoneName: "short",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user