mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +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;
|
const start = item.start;
|
||||||
let startDateTime;
|
let startDateTime;
|
||||||
if (start !== undefined) {
|
if (start !== undefined) {
|
||||||
const timezone = start.timeZone;
|
|
||||||
if (start.dateTime) {
|
if (start.dateTime) {
|
||||||
const stringDate = start.dateTime;
|
const stringDate = start.dateTime;
|
||||||
startDateTime = new Date(stringDate).toLocaleString("en-us", {
|
startDateTime = new Date(stringDate);
|
||||||
...options,
|
|
||||||
timeZone: timezone,
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
const stringDate = start.date;
|
const stringDate = start.date;
|
||||||
startDateTime = new Date(stringDate).toLocaleString("en-us", {
|
startDateTime = new Date(stringDate);
|
||||||
...options,
|
|
||||||
timeZone: timezone,
|
|
||||||
});
|
|
||||||
isAllDay = true;
|
isAllDay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,19 +28,12 @@ export async function fetchGoogleCalendarEvents(token, startDate) {
|
|||||||
const end = item.end;
|
const end = item.end;
|
||||||
let endDateTime;
|
let endDateTime;
|
||||||
if (end !== undefined) {
|
if (end !== undefined) {
|
||||||
const timezone = end.timeZone;
|
|
||||||
if (end.dateTime) {
|
if (end.dateTime) {
|
||||||
const stringDate = end.dateTime;
|
const stringDate = end.dateTime;
|
||||||
endDateTime = new Date(stringDate).toLocaleString("en-us", {
|
endDateTime = new Date(stringDate);
|
||||||
...options,
|
|
||||||
timeZone: timezone,
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
const stringDate = end.date;
|
const stringDate = end.date;
|
||||||
endDateTime = new Date(stringDate).toLocaleString("en-us", {
|
endDateTime = new Date(stringDate);
|
||||||
...options,
|
|
||||||
timeZone: timezone,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,13 +49,3 @@ export async function fetchGoogleCalendarEvents(token, startDate) {
|
|||||||
|
|
||||||
return googleEvents;
|
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