mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-04 05:38:37 -05:00
feat(airdatebadge): convert airDate from UTC to local timezone (#1390)
This PR will ensure that the airdate is in the user's local timezone so that its more user friendly and the relative time calculation would be consistent fix #1373
This commit is contained in:
@@ -14,6 +14,7 @@ type AirDateBadgeProps = {
|
|||||||
const AirDateBadge = ({ airDate }: AirDateBadgeProps) => {
|
const AirDateBadge = ({ airDate }: AirDateBadgeProps) => {
|
||||||
const WEEK = 1000 * 60 * 60 * 24 * 8;
|
const WEEK = 1000 * 60 * 60 * 24 * 8;
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
const dAirDate = new Date(airDate);
|
const dAirDate = new Date(airDate);
|
||||||
const nowDate = new Date();
|
const nowDate = new Date();
|
||||||
const alreadyAired = dAirDate.getTime() < nowDate.getTime();
|
const alreadyAired = dAirDate.getTime() < nowDate.getTime();
|
||||||
@@ -38,7 +39,7 @@ const AirDateBadge = ({ airDate }: AirDateBadgeProps) => {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
timeZone: 'UTC',
|
timeZone,
|
||||||
})}
|
})}
|
||||||
</Badge>
|
</Badge>
|
||||||
{showRelative && (
|
{showRelative && (
|
||||||
|
|||||||
Reference in New Issue
Block a user