NobGit
public imalexnord read

Slot

Calendar-first scheduling powered by Cloudflare Workers and Google Calendar.

Languages

Repository composition by tracked source files.

TypeScript
TypeScript 79% CSS 19% SQL 2% HTML 0%
Create file Wiki Documentation
Clone
https://nobgit.com/user/imalexnord/slot.git
ssh://[email protected]:2222/user/imalexnord/slot.git

Trace

worker/time.ts

Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.

time.ts on main
Author Date Commit Line Code
Alex Nord 3 days ago 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
1
import type { BusyRange } from './types';
Open commit View diff
1 import type { BusyRange } from './types';
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
2
Open commit View diff
2
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
3
const formatterCache = new Map<string, Intl.DateTimeFormat>();
Open commit View diff
3 const formatterCache = new Map<string, Intl.DateTimeFormat>();
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
4
Open commit View diff
4
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
5
function formatter(timeZone: string): Intl.DateTimeFormat {
Open commit View diff
5 function formatter(timeZone: string): Intl.DateTimeFormat {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
6
  const cached = formatterCache.get(timeZone);
Open commit View diff
6 const cached = formatterCache.get(timeZone);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
7
  if (cached) return cached;
Open commit View diff
7 if (cached) return cached;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
8
  const next = new Intl.DateTimeFormat('en-CA', {
Open commit View diff
8 const next = new Intl.DateTimeFormat('en-CA', {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
9
    timeZone,
Open commit View diff
9 timeZone,
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
10
    year: 'numeric',
Open commit View diff
10 year: 'numeric',
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
11
    month: '2-digit',
Open commit View diff
11 month: '2-digit',
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
12
    day: '2-digit',
Open commit View diff
12 day: '2-digit',
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
13
    hour: '2-digit',
Open commit View diff
13 hour: '2-digit',
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
14
    minute: '2-digit',
Open commit View diff
14 minute: '2-digit',
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
15
    second: '2-digit',
Open commit View diff
15 second: '2-digit',
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
16
    hourCycle: 'h23',
Open commit View diff
16 hourCycle: 'h23',
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
17
    weekday: 'short',
Open commit View diff
17 weekday: 'short',
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
18
  });
Open commit View diff
18 });
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
19
  formatterCache.set(timeZone, next);
Open commit View diff
19 formatterCache.set(timeZone, next);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
20
  return next;
Open commit View diff
20 return next;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
21
}
Open commit View diff
21 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
22
Open commit View diff
22
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
23
export function partsInZone(date: Date, timeZone: string): Record<string, string> {
Open commit View diff
23 export function partsInZone(date: Date, timeZone: string): Record<string, string> {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
24
  return Object.fromEntries(
Open commit View diff
24 return Object.fromEntries(
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
25
    formatter(timeZone)
Open commit View diff
25 formatter(timeZone)
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
26
      .formatToParts(date)
Open commit View diff
26 .formatToParts(date)
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
27
      .filter((part) => part.type !== 'literal')
Open commit View diff
27 .filter((part) => part.type !== 'literal')
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
28
      .map((part) => [part.type, part.value]),
Open commit View diff
28 .map((part) => [part.type, part.value]),
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
29
  );
Open commit View diff
29 );
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
30
}
Open commit View diff
30 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
31
Open commit View diff
31
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
32
export function dateKeyInZone(date: Date, timeZone: string): string {
Open commit View diff
32 export function dateKeyInZone(date: Date, timeZone: string): string {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
33
  const parts = partsInZone(date, timeZone);
Open commit View diff
33 const parts = partsInZone(date, timeZone);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
34
  return `${parts.year}-${parts.month}-${parts.day}`;
Open commit View diff
34 return `${parts.year}-${parts.month}-${parts.day}`;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
35
}
Open commit View diff
35 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
36
Open commit View diff
36
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
37
Open commit View diff
37
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
38
export function addDaysToDateKey(dateKey: string, days: number): string {
Open commit View diff
38 export function addDaysToDateKey(dateKey: string, days: number): string {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
39
  const [year, month, day] = dateKey.split('-').map(Number);
Open commit View diff
39 const [year, month, day] = dateKey.split('-').map(Number);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
40
  return new Date(Date.UTC(year, month - 1, day + days, 12, 0, 0)).toISOString().slice(0, 10);
Open commit View diff
40 return new Date(Date.UTC(year, month - 1, day + days, 12, 0, 0)).toISOString().slice(0, 10);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
41
}
Open commit View diff
41 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
42
Open commit View diff
42
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
43
export function weekdayForDate(dateKey: string, timeZone: string): number {
Open commit View diff
43 export function weekdayForDate(dateKey: string, timeZone: string): number {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
44
  const noon = zonedDateTimeToUtc(dateKey, '12:00', timeZone);
Open commit View diff
44 const noon = zonedDateTimeToUtc(dateKey, '12:00', timeZone);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
45
  const label = partsInZone(noon, timeZone).weekday;
Open commit View diff
45 const label = partsInZone(noon, timeZone).weekday;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
46
  return ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].indexOf(label);
Open commit View diff
46 return ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].indexOf(label);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
47
}
Open commit View diff
47 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
48
Open commit View diff
48
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
49
export function zonedDateTimeToUtc(dateKey: string, time: string, timeZone: string): Date {
Open commit View diff
49 export function zonedDateTimeToUtc(dateKey: string, time: string, timeZone: string): Date {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
50
  const [year, month, day] = dateKey.split('-').map(Number);
Open commit View diff
50 const [year, month, day] = dateKey.split('-').map(Number);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
51
  const [hour, minute] = time.split(':').map(Number);
Open commit View diff
51 const [hour, minute] = time.split(':').map(Number);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
52
  let guess = Date.UTC(year, month - 1, day, hour, minute, 0);
Open commit View diff
52 let guess = Date.UTC(year, month - 1, day, hour, minute, 0);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
53
Open commit View diff
53
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
54
  // Iterate to account for the zone offset, including DST transitions.
Open commit View diff
54 // Iterate to account for the zone offset, including DST transitions.
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
55
  for (let i = 0; i < 3; i += 1) {
Open commit View diff
55 for (let i = 0; i < 3; i += 1) {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
56
    const parts = partsInZone(new Date(guess), timeZone);
Open commit View diff
56 const parts = partsInZone(new Date(guess), timeZone);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
57
    const representedAsUtc = Date.UTC(
Open commit View diff
57 const representedAsUtc = Date.UTC(
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
58
      Number(parts.year),
Open commit View diff
58 Number(parts.year),
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
59
      Number(parts.month) - 1,
Open commit View diff
59 Number(parts.month) - 1,
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
60
      Number(parts.day),
Open commit View diff
60 Number(parts.day),
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
61
      Number(parts.hour),
Open commit View diff
61 Number(parts.hour),
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
62
      Number(parts.minute),
Open commit View diff
62 Number(parts.minute),
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
63
      Number(parts.second),
Open commit View diff
63 Number(parts.second),
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
64
    );
Open commit View diff
64 );
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
65
    const targetAsUtc = Date.UTC(year, month - 1, day, hour, minute, 0);
Open commit View diff
65 const targetAsUtc = Date.UTC(year, month - 1, day, hour, minute, 0);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
66
    const delta = targetAsUtc - representedAsUtc;
Open commit View diff
66 const delta = targetAsUtc - representedAsUtc;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
67
    if (delta === 0) break;
Open commit View diff
67 if (delta === 0) break;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
68
    guess += delta;
Open commit View diff
68 guess += delta;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
69
  }
Open commit View diff
69 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
70
Open commit View diff
70
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
71
  return new Date(guess);
Open commit View diff
71 return new Date(guess);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
72
}
Open commit View diff
72 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
73
Open commit View diff
73
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
74
export function minutesToTime(total: number): string {
Open commit View diff
74 export function minutesToTime(total: number): string {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
75
  const hour = Math.floor(total / 60) % 24;
Open commit View diff
75 const hour = Math.floor(total / 60) % 24;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
76
  const minute = total % 60;
Open commit View diff
76 const minute = total % 60;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
77
  return `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}`;
Open commit View diff
77 return `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}`;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
78
}
Open commit View diff
78 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
79
Open commit View diff
79
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
80
export function timeToMinutes(value: string): number {
Open commit View diff
80 export function timeToMinutes(value: string): number {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
81
  const [hour, minute] = value.split(':').map(Number);
Open commit View diff
81 const [hour, minute] = value.split(':').map(Number);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
82
  return hour * 60 + minute;
Open commit View diff
82 return hour * 60 + minute;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
83
}
Open commit View diff
83 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
84
Open commit View diff
84
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
85
export function overlaps(start: number, end: number, busy: BusyRange[]): boolean {
Open commit View diff
85 export function overlaps(start: number, end: number, busy: BusyRange[]): boolean {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
86
  return busy.some((range) => start < range.end && end > range.start);
Open commit View diff
86 return busy.some((range) => start < range.end && end > range.start);
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
87
}
Open commit View diff
87 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
88
Open commit View diff
88
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
89
export function addMinutes(timestamp: number, minutes: number): number {
Open commit View diff
89 export function addMinutes(timestamp: number, minutes: number): number {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
90
  return timestamp + minutes * 60_000;
Open commit View diff
90 return timestamp + minutes * 60_000;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
91
}
Open commit View diff
91 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
92
Open commit View diff
92
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
93
export function slotKeys(start: number, end: number, incrementMinutes = 15): string[] {
Open commit View diff
93 export function slotKeys(start: number, end: number, incrementMinutes = 15): string[] {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
94
  const increment = incrementMinutes * 60_000;
Open commit View diff
94 const increment = incrementMinutes * 60_000;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
95
  const first = Math.floor(start / increment) * increment;
Open commit View diff
95 const first = Math.floor(start / increment) * increment;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
96
  const last = Math.ceil(end / increment) * increment;
Open commit View diff
96 const last = Math.ceil(end / increment) * increment;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
97
  const keys: string[] = [];
Open commit View diff
97 const keys: string[] = [];
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
98
  for (let cursor = first; cursor < last; cursor += increment) {
Open commit View diff
98 for (let cursor = first; cursor < last; cursor += increment) {
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
99
    keys.push(new Date(cursor).toISOString());
Open commit View diff
99 keys.push(new Date(cursor).toISOString());
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
100
  }
Open commit View diff
100 }
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
101
  return keys;
Open commit View diff
101 return keys;
same change 45c38c3

Prepare Slot booking worker

Full commit hash
45c38c3ae5284118e8d65aa9d49e90850b1209f5
Author
Alex Nord <[email protected]>
Date
3 days ago
Selected line
102
}
Open commit View diff
102 }