* feat: allows forcing/skipping calendar cache serving Signed-off-by: Omar López <zomars@me.com> * Update features.repository.ts * Added to HNB * type fixes * Update packages/prisma/migrations/20241216000000_add_calendar_cache_serve/migration.sql Co-authored-by: Keith Williams <keithwillcode@gmail.com> * Update packages/prisma/zod-utils.ts Co-authored-by: Keith Williams <keithwillcode@gmail.com> * Update selectedCalendar.ts --------- Signed-off-by: Omar López <zomars@me.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com>
17 lines
532 B
TypeScript
17 lines
532 B
TypeScript
/** Expand the start date to the beginning of the current month */
|
|
export const getTimeMin = (timeMin?: string) => {
|
|
const date = timeMin ? new Date(timeMin) : new Date();
|
|
date.setDate(1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date.toISOString();
|
|
};
|
|
|
|
/** Expand the end date to the end of the next month */
|
|
export function getTimeMax(timeMax?: string) {
|
|
const date = timeMax ? new Date(timeMax) : new Date();
|
|
date.setMonth(date.getMonth() + 2);
|
|
date.setDate(0);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date.toISOString();
|
|
}
|