[#48] added drag and drop and resize changes to events

This commit is contained in:
Camille Moussu
2025-07-31 17:51:55 +02:00
parent 85b580cd2a
commit cf59bcebe4
5 changed files with 98 additions and 12 deletions
+18
View File
@@ -27,3 +27,21 @@ export function getCalendarRange(date = new Date()) {
end: endDate,
};
}
export function getDeltaInMilliseconds(delta: {
years: number;
months: number;
days: number;
milliseconds: number;
}) {
const MS_PER_DAY = 24 * 60 * 60 * 1000;
const AVG_MS_PER_MONTH = 30.44 * MS_PER_DAY; // approx
const AVG_MS_PER_YEAR = 365.25 * MS_PER_DAY; // approx
return (
(delta.years || 0) * AVG_MS_PER_YEAR +
(delta.months || 0) * AVG_MS_PER_MONTH +
(delta.days || 0) * MS_PER_DAY +
(delta.milliseconds || 0)
);
}