1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-11-23 11:46:08 -05:00

refactor constants

This commit is contained in:
2025-04-11 14:50:15 -04:00
parent 0ade75716e
commit 37fa6101f6
11 changed files with 54 additions and 37 deletions

View File

@@ -2,7 +2,7 @@ import { format, formatISO } from "date-fns";
import { enUS } from "date-fns/locale";
import { tz } from "@date-fns/tz";
import { utc } from "@date-fns/utc";
import * as config from "../../lib/config";
import { SITE_TZ } from "../../lib/config/constants";
import type { ComponentPropsWithoutRef } from "react";
export type TimeProps = ComponentPropsWithoutRef<"time"> & {
@@ -14,10 +14,10 @@ const Time = ({ date, format: formatStr = "PPpp", ...rest }: TimeProps) => {
return (
<time
dateTime={formatISO(date, { in: utc })}
title={format(date, "MMM d, y, h:mm a O", { in: tz(config.timeZone), locale: enUS })}
title={format(date, "MMM d, y, h:mm a O", { in: tz(SITE_TZ), locale: enUS })}
{...rest}
>
{format(date, formatStr, { in: tz(config.timeZone), locale: enUS })}
{format(date, formatStr, { in: tz(SITE_TZ), locale: enUS })}
</time>
);
};