mirror of
https://github.com/sct/overseerr.git
synced 2025-12-26 16:27:17 +01: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 WEEK = 1000 * 60 * 60 * 24 * 8;
|
||||
const intl = useIntl();
|
||||
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
const dAirDate = new Date(airDate);
|
||||
const nowDate = new Date();
|
||||
const alreadyAired = dAirDate.getTime() < nowDate.getTime();
|
||||
@@ -38,7 +39,7 @@ const AirDateBadge = ({ airDate }: AirDateBadgeProps) => {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
timeZone: 'UTC',
|
||||
timeZone,
|
||||
})}
|
||||
</Badge>
|
||||
{showRelative && (
|
||||
|
||||
Reference in New Issue
Block a user