Events Page: Added option to override browser time format and style (#5538)

* use12hour optional config

* use12hour config arg

* added use12HourFormat arg to format function

* dateStyle & timeStyle option

* moved timezone & locales to format function

* added dateStyle & timeStyle

* re-formatted

* added strftime_fmt config entry

* strftime package

* added strftime option

* underscore instead of camelCase

* underscore props instead of camelCase
This commit is contained in:
Bernt Christian Egeland
2023-02-22 14:54:16 +01:00
committed by GitHub
parent fbf29667d4
commit 3611e874ca
5 changed files with 105 additions and 23 deletions

View File

@@ -287,9 +287,6 @@ export default function Events({ path, ...props }) {
return <ActivityIndicator />;
}
const timezone = config.ui?.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone;
const locale = window.navigator?.language || 'en-US';
return (
<div className="space-y-4 p-2 px-4 w-full">
<Heading>Events</Heading>
@@ -508,7 +505,7 @@ export default function Events({ path, ...props }) {
</div>
<div className="text-sm flex">
<Clock className="h-5 w-5 mr-2 inline" />
{formatUnixTimestampToDateTime(event.start_time, locale, timezone)}
{formatUnixTimestampToDateTime(event.start_time, { ...config.ui })}
<div className="hidden md:inline">
<span className="m-1">-</span>
<TimeAgo time={event.start_time * 1000} dense />