Skip to content

Commit

Permalink
Correct date bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbithell committed Jul 17, 2024
1 parent 2bf52af commit 21ebc2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/components/templates/TideGraphPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const Page: React.FC<PageProps> = ({ pageContext }) => {
previousDay: string | false;
nextDay: string | false;
};
console.log(day);
return (
<Layout
title={
Expand Down Expand Up @@ -67,7 +66,7 @@ const Page: React.FC<PageProps> = ({ pageContext }) => {
</>
}
>
<TidalGraph date={new Date(day.date).getTime()} />
<TidalGraph date={DateTime.fromSQL(day.date).toJSDate()} />
<Box p="sm">
<DataInformation />
</Box>
Expand Down
4 changes: 2 additions & 2 deletions src/components/tideGraph/TidalGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { TidesJson_ScheduleObject } from "../../types";
import TidalData from "../../../data/tides.json";
import { TidalGraphComponent } from "./TidalGraphComponent";

export function TidalGraph({ date }: { date: number }) {
const startTimestamp = new Date();
export function TidalGraph({ date }: { date: Date }) {
const startTimestamp = date;
startTimestamp.setHours(0, 0, 0, 0);
const endTimestamp = new Date(startTimestamp);
endTimestamp.setDate(endTimestamp.getDate() + 1); // The charts don't work so well beyond a day
Expand Down

0 comments on commit 21ebc2e

Please sign in to comment.