Fixes user availability to be contextual to the user timezone (#1166)

* WIP, WIP, WIP, WIP

* Adds missing types

* Type fixes for useSlots

* Type fixes

* Fixes periodType 500 error when updating

* Adds missing dayjs plugin and type fixes

* An attempt was made to fix tests

* Save work in progress

* Added UTC overflow to days

* Update lib/availability.ts

Co-authored-by: Alex Johansson <[email protected]>

* No more magic numbers

* Fixed slots.test & added getWorkingHours.test

* Tests pass, simpler logic, profit?

* Timezone shifting!

* Forgot to unskip tests

* Updated the user page

* Added American seed user, some fixes

* tmp fix so to continue testing availability

* Removed timeZone parameter, fix defaultValue auto-scroll

Co-authored-by: Omar López <[email protected]>
Co-authored-by: Alex Johansson <[email protected]>
This commit is contained in:
authored and GitHub committed 2021-11-18 01:03:19 +00:00
1 parent f3c95fa3de
commit ffdf0b9217
23 files changed
+587 -333

No files matched your search

+19
View File
@@ -15,6 +15,7 @@ async function createUserAndEventType(opts: {
plan: UserPlan;
name: string;
completedOnboarding?: boolean;
timeZone?: string;
};
eventTypes: Array<
Prisma.EventTypeCreateInput & {
@@ -268,6 +269,24 @@ async function main() {
],
});
await createUserAndEventType({
user: {
email: "[email protected]",
password: "usa",
username: "usa",
name: "USA Timezone Example",
plan: "FREE",
timeZone: "America/Phoenix",
},
eventTypes: [
{
title: "30min",
slug: "30min",
length: 30,
},
],
});
const freeUserTeam = await createUserAndEventType({
user: {
email: "[email protected]",