Skip to content

Commit

Permalink
Fix news feed item timestamp (#69)
Browse files Browse the repository at this point in the history
* Fix news feed item timestamp

* Fix news feed timestamp
  • Loading branch information
catileptic authored Sep 26, 2020
1 parent 8d89e64 commit c31155f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@code4ro/reusable-components",
"version": "0.1.25",
"version": "0.1.26",
"description": "Component library for code4ro",
"keywords": [
"code4ro",
Expand Down
6 changes: 4 additions & 2 deletions src/components/ElectionNewsCard/ElectionNewsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ComponentProps, ReactNode, useCallback } from "react";
import { ClassNames, themable } from "../../hooks/theme";
import { ElectionNews } from "../../types/Election";
import { format, parseISO } from "date-fns";
import { format, parseISO, addHours } from "date-fns";
import { DivBody, DivLabel, Heading3, makeTypographyComponent } from "../Typography/Typography";
import SVGCode4Romania from "../../assets/code4romania.svg";
import LinkCircle from "../../assets/link-circle.svg";
Expand Down Expand Up @@ -59,7 +59,9 @@ export const ElectionNewsCard = themable<Props>(
"ElectionNewsCard",
cssClasses,
)(({ classes, news, onImageClick, footerLeft, footerRight, feedLink }) => {
const date = parseISO(news.timestamp);
const utcOffset = new Date().getTimezoneOffset() / 60;
const parsedDate = parseISO(news.timestamp);
const date = addHours(parsedDate, -utcOffset);

const embedRef = useCallback(
(el: HTMLDivElement | null) => {
Expand Down

1 comment on commit c31155f

@vercel
Copy link

@vercel vercel bot commented on c31155f Sep 26, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.