-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Events Page: Added option to override browser time format and style #5538
Conversation
✅ Deploy Preview for frigate-docs canceled.
|
Are the date separators still inherited from the language? |
damn, your are fast. 👍 |
I think this only captures a few of the date/time formats people want. For example, if you're outside of the US you probably don't want M/d/yyyy even if you want your UI in English. This won't let you set your date/time formats independent of the language. How about letting the user specify an explicit strftime() format string? Alternatively, specifying another POSIX locale for LC_TIME? |
Take 2 I was indecisive about whether to keep the previous configuration or switch entierly to strftime. After evaluating the added complexity that comes with using strftime, I decided to keep both solutions for the time being. Some users may only want to utilize use12hour. config: ui:
use12hour: false # true | false
dateStyle: 'short' # 'full' | 'long' | 'medium' | 'short
timeStyle: 'medium' # 'full' | 'long' | 'medium' | 'short
# NOTE! If strftime_fmt are provided it will takes precedence over the others
strftime_fmt: '%A, %B %e, %Y %I:%M:%S %p %Z' couple of thoughts
frontend // use strftime_fmt if defined in config file
if (strftime_fmt) {
const strftime_locale = strftime.localizeByIdentifier(locale);
return strftime_locale(strftime_fmt, date);
}
// else use Intl.DateTimeFormat
const formatter = new Intl.DateTimeFormat(locale, {
dateStyle,
timeStyle,
timeZone: timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
hour12: use12hour !== null ? use12hour : undefined,
});
return formatter.format(date); |
We don't use camelCase for any other properties in the config. Lets switch these to underscores for consistency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option needs to be added to the docs. I would also suggest linking to https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html so users are aware how it works
Have to say though, I wasn't super interested in this until I started playing with it but it is really nice being able to fully customize how the dates / times are presented |
i will be away for the next week, but will update the docs when im back. |
There seems to be a bug here. If you set Please let me know if it's better to open a new issue than discuss it here. |
Me too, without strftime_fmt the time is set to timezone! |
Implements #5476
new optional ui config entries:
Would be nice if someone else could test and provide feedback.
one issue, when "full" is used (highly unlikely) it will clutter the mobile view, but at least it gives the user the option.
A few examples: