-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make dates work more consistently across timezones
- Loading branch information
Showing
8 changed files
with
70 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { fmtDate } from "@/utils/dates.ts"; | ||
|
||
// bit of a hack, bassiclly just takes the date, chops off the timezone, and gets the date wherever the user is | ||
export const ClientDate = ({ date }: { date: string }) => ( | ||
<>{fmtDate(new Date(date.split("GMT")[0]))}</> | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ShowTime } from "@/utils/db/kv.ts"; | ||
|
||
export const fixDate = (showTimes: ShowTime[]) => showTimes.map((showTime) => { | ||
if (!showTime.startTime) return showTime; | ||
const date = new Date(showTime.startDate); | ||
const time = new Date(showTime.startTime); | ||
|
||
if (time) { | ||
date.setHours(time.getHours()); | ||
date.setMinutes(time.getMinutes()); | ||
} else { | ||
// remove the hours and just display as normal if user doesn't add a start date | ||
date.setHours(0); | ||
date.setMinutes(0); | ||
} | ||
|
||
return { | ||
...showTime, | ||
startDate: date.toString(), | ||
}; | ||
}) |