Skip to content

Commit

Permalink
fix timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabor Juhasz committed Jul 28, 2022
1 parent b5bf65c commit 0e5a7a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions components/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { Favorites } from "pages";
import { FC } from "react";
import { Item } from "types";

import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
dayjs.extend(utc);
dayjs.extend(timezone);

export const SCALE_MINUTES_TO_PIXELS = 3.8;

interface BoxProps {
Expand Down Expand Up @@ -98,11 +103,11 @@ export const Box: FC<BoxProps> = ({ item, startOfDay, favorites, setDetailId })
}}
>
<p>
<span>{dayjs(item.date).locale("hu").format("HH:mm")}</span>
<span>{dayjs(item.date).tz("Europe/Budapest").format("HH:mm")}</span>
<span style={{ paddingLeft: 4, paddingRight: 4 }}>-</span>
<span>
{dayjs(item.date + item.duration * 60 * 1000)
.locale("hu")
.tz("Europe/Budapest")
.format("HH:mm")}
</span>
</p>
Expand Down
9 changes: 7 additions & 2 deletions components/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { Favorites, FavoriteState } from "pages";
import { FC } from "react";
import { Item } from "types";

import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
dayjs.extend(utc);
dayjs.extend(timezone);

interface DetailProps {
item: Item;
favorites: Favorites;
Expand All @@ -28,11 +33,11 @@ export const Detail: FC<DetailProps> = ({ item, favorites, setFavoriteState }) =
}}
>
<p>
<span>{dayjs(item.date).locale("hu").format("HH:mm")}</span>
<span>{dayjs(item.date).tz("Europe/Budapest").format("HH:mm")}</span>
<span style={{ paddingLeft: 4, paddingRight: 4 }}>-</span>
<span>
{dayjs(item.date + item.duration * 60 * 1000)
.locale("hu")
.tz("Europe/Budapest")
.format("HH:mm")}
</span>
</p>
Expand Down

1 comment on commit 0e5a7a5

@vercel
Copy link

@vercel vercel bot commented on 0e5a7a5 Jul 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

katlan – ./

katlan.vercel.app
katlan-juhg24.vercel.app
katlan-git-main-juhg24.vercel.app

Please sign in to comment.