Skip to content

Commit

Permalink
24hr->12hr on dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
jho44 committed Aug 13, 2023
1 parent f5cdc22 commit f41f535
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/routes/dashboard/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
type BusyDetails,
EMOTICONS_REVERSE
} from '$lib/constants';
import { dateTo12Hour } from '$lib/date';
import type { Household } from './constants';

const prisma = new PrismaClient();
Expand Down Expand Up @@ -43,17 +44,7 @@ const getFormattedAvailability = (
if (x.status === AvailabilityStatus.UNSPECIFIED) return;
if (x.status !== AvailabilityStatus.BUSY) {
if (x.startTime && x.endTime) {
const startMins = x.startTime.getMinutes();
let startRange = `${startMins}`;
if (startMins < 10) startRange = `0${startRange}`;
startRange = `${x.startTime.getHours()}:${startRange}`;

const endMins = x.endTime.getMinutes();
let endRange = `${endMins}`;
if (endMins < 10) endRange = `0${endRange}`;
endRange = `${x.endTime.getHours()}:${endRange}`;

availRange = `${startRange} - ${endRange}`;
availRange = `${dateTo12Hour(x.startTime)} - ${dateTo12Hour(x.endTime)}`;
}
}

Expand Down

0 comments on commit f41f535

Please sign in to comment.