Skip to content

Commit

Permalink
hopefully fix times now
Browse files Browse the repository at this point in the history
  • Loading branch information
lillijo committed Jul 5, 2024
1 parent 66c04f0 commit 17d0a47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/api/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,11 @@ export const DAYS = {
saturday: 2000,
sunday: 4200,
} as const;

export const START_TIME = 1721383200000;
export const END_TIME = 1721599200000;
export const TIME_INTERVAL = [
new Date(2024, 6, 19, 12),
new Date(2024, 6, 22, 0),
new Date(START_TIME),
new Date(END_TIME),
] as const;

export const TIME_PADDING = 0;
Expand Down
4 changes: 3 additions & 1 deletion src/api/rest/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
TIME_PADDING,
TIME_WIDTH,
TIME_INTERVAL,
START_TIME,
END_TIME,
} from '../constants';
import { Context } from '@/types/graphql';
import { scaleTime } from 'd3-scale';
Expand All @@ -13,7 +15,7 @@ import { Item } from '@/types/item';
import { getTreeById } from '@/api/rest/tree';
import { defaultFetchCacheOptions } from '@/api/rest/caching';
const toPixel = (stamp: number, s: (d: Date) => number) =>
s(new Date(Math.max(1721376000000, Math.min(stamp * 1000, 1721598631000))));
s(new Date(Math.max(START_TIME, Math.min(stamp * 1000, END_TIME))));
export const toDate = (stamp: number) => new Date(stamp * 1000);

const toEnd = (end?: string) => parseInt(end ?? '0');
Expand Down

0 comments on commit 17d0a47

Please sign in to comment.