Skip to content

Instantly share code, notes, and snippets.

View Frosty21's full-sized avatar

Nathan Froese Frosty21

View GitHub Profile
@Frosty21
Frosty21 / Timeslot-Grouping.ts
Created June 8, 2022 22:27
TimeSlot-Grouping.ts
import { fromUnixTime, format, getHours } from "date-fns";
import { fromUnixTime, format, getHours } from "date-fns";
const timeSlots = [
{ startTime: 1653998400, endTime: 1654002000 }, //6-31-2022 8am to 6-31-2022 9am
{ startTime: 1654002000, endTime: 1654005600 }, //6-31-2022 9am to 6-31-2022 10am
{ startTime: 1654012800, endTime: 1654016400 }, //6-31-2022 12pm to 6-31-2022 1pm
{ startTime: 1654084864, endTime: 1654088464 }, //2022-06-01 8am to 2022-06-01 9am
{ startTime: 1654092064, endTime: 1654095664 }, // 2022-06-01 10am to 2022-06-01 11am
{ startTime: 1654106464, endTime: 1654110064 }, // 2022-06-01 2pm to 2022-06-01 3pm
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>