Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/components/support.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

$: upgradeURL = `${base}/organization-${freeOrganization?.$id}/change-plan`;

$: supportTimings = `${utcHourToLocaleHour('16:00')} - ${utcHourToLocaleHour('00:00')} ${localeShortTimezoneName()}`;
$: supportTimings = `${utcHourToLocaleHour('04:00')} - ${utcHourToLocaleHour('17:00')} ${localeShortTimezoneName()}`;

type SupportOption = {
cta?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/routes/(console)/supportWizard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@
}

const workTimings = {
start: '16:00',
end: '00:00',
start: '04:00',
end: '17:00',
startDay: 'Monday' as WeekDay,
endDay: 'Friday' as WeekDay
};
Expand Down
55 changes: 30 additions & 25 deletions src/routes/(console)/wizard/support/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,35 @@ describe('isSupportOnline', () => {
};

describe('weekday support hours (Monday-Friday)', () => {
it('should be online at 16:00 UTC (Monday)', () => {
mockDate(16, 1); // Monday, 16:00 UTC
it('should be online at 04:00 UTC (Monday)', () => {
mockDate(4, 1); // Monday, 04:00 UTC
expect(isSupportOnline()).toBe(true);
});

it('should be online at 20:00 UTC (Tuesday)', () => {
mockDate(20, 2); // Tuesday, 20:00 UTC
it('should be online at 10:00 UTC (Tuesday)', () => {
mockDate(10, 2); // Tuesday, 10:00 UTC
expect(isSupportOnline()).toBe(true);
});

it('should be online at 23:59 UTC (Wednesday)', () => {
mockDate(23, 3); // Wednesday, 23:59 UTC
it('should be online at 16:59 UTC (Wednesday)', () => {
mockDate(16, 3); // Wednesday, 16:59 UTC
expect(isSupportOnline()).toBe(true);
});

it('should be online at 23:00 UTC (Thursday)', () => {
mockDate(23, 4); // Thursday, 23:00 UTC
it('should be online at 12:00 UTC (Thursday)', () => {
mockDate(12, 4); // Thursday, 12:00 UTC
expect(isSupportOnline()).toBe(true);
});

it('should be online at 22:00 UTC (Friday)', () => {
mockDate(22, 5); // Friday, 22:00 UTC
it('should be online at 08:00 UTC (Friday)', () => {
mockDate(8, 5); // Friday, 08:00 UTC
expect(isSupportOnline()).toBe(true);
});
});

describe('outside support hours on weekdays', () => {
it('should be offline at 15:59 UTC (Monday)', () => {
mockDate(15, 1); // Monday, 15:59 UTC
it('should be offline at 03:59 UTC (Monday)', () => {
mockDate(3, 1); // Monday, 03:59 UTC
expect(isSupportOnline()).toBe(false);
});

Expand All @@ -53,20 +53,20 @@ describe('isSupportOnline', () => {
expect(isSupportOnline()).toBe(false);
});

it('should be offline at 10:00 UTC (Wednesday)', () => {
mockDate(10, 3); // Wednesday, 10:00 UTC
it('should be offline at 17:00 UTC (Wednesday)', () => {
mockDate(17, 3); // Wednesday, 17:00 UTC
expect(isSupportOnline()).toBe(false);
});

it('should be offline at 14:00 UTC (Friday)', () => {
mockDate(14, 5); // Friday, 14:00 UTC
it('should be offline at 23:00 UTC (Friday)', () => {
mockDate(23, 5); // Friday, 23:00 UTC
expect(isSupportOnline()).toBe(false);
});
});

describe('weekends', () => {
it('should be offline on Saturday regardless of hour', () => {
mockDate(18, 6); // Saturday, 18:00 UTC (in support hours for weekdays)
mockDate(10, 6); // Saturday, 10:00 UTC (in support hours for weekdays)
expect(isSupportOnline()).toBe(false);
});

Expand All @@ -80,25 +80,30 @@ describe('isSupportOnline', () => {
expect(isSupportOnline()).toBe(false);
});

it('should be offline on Sunday at 16:00', () => {
mockDate(16, 0); // Sunday, 16:00 UTC
it('should be offline on Sunday at 10:00', () => {
mockDate(10, 0); // Sunday, 10:00 UTC
expect(isSupportOnline()).toBe(false);
});
});

describe('edge cases', () => {
it('should handle boundary at 15:59 (just before support hours)', () => {
mockDate(15, 1); // Monday, 15:59 UTC
it('should handle boundary at 03:59 (just before support hours)', () => {
mockDate(3, 1); // Monday, 03:59 UTC
expect(isSupportOnline()).toBe(false);
});

it('should handle boundary at 16:00 (start of support hours)', () => {
mockDate(16, 1); // Monday, 16:00 UTC
it('should handle boundary at 04:00 (start of support hours)', () => {
mockDate(4, 1); // Monday, 04:00 UTC
expect(isSupportOnline()).toBe(true);
});

it('should handle late night hours on Friday', () => {
mockDate(23, 5); // Friday, 23:00 UTC
it('should handle boundary at 17:00 (end of support hours)', () => {
mockDate(17, 1); // Monday, 17:00 UTC
expect(isSupportOnline()).toBe(false);
});

it('should handle boundary at 16:59 (just before end of support hours)', () => {
mockDate(16, 5); // Friday, 16:59 UTC
expect(isSupportOnline()).toBe(true);
});
});
Expand Down
5 changes: 2 additions & 3 deletions src/routes/(console)/wizard/support/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ export function isSupportOnline() {
return false;
}

// Support hours are 16:00 UTC to 23:59 UTC on weekdays
// This roughly covers 09:00 PT to 17:00 PT (depending on PST/PDT)
if (hour >= 16) {
// Support hours are 04:00 UTC to 17:00 UTC on weekdays
if (hour >= 4 && hour < 17) {
return true;
}

Expand Down
Loading