underscore props instead of camelCase

This commit is contained in:
Bernt Christian Egeland 2023-02-19 15:19:15 +01:00
parent 0f86a800c6
commit f9f8ba7ec6

View File

@ -38,13 +38,13 @@ export const getNowYesterdayInLong = (): number => {
interface DateTimeStyle { interface DateTimeStyle {
timezone: string; timezone: string;
use12hour: boolean | undefined; use12hour: boolean | undefined;
dateStyle: 'full' | 'long' | 'medium' | 'short'; date_style: 'full' | 'long' | 'medium' | 'short';
timeStyle: 'full' | 'long' | 'medium' | 'short'; time_style: 'full' | 'long' | 'medium' | 'short';
strftime_fmt: string; strftime_fmt: string;
} }
export const formatUnixTimestampToDateTime = (unixTimestamp: number, config: DateTimeStyle): string => { export const formatUnixTimestampToDateTime = (unixTimestamp: number, config: DateTimeStyle): string => {
const { timezone, use12hour, dateStyle, timeStyle, strftime_fmt } = config; const { timezone, use12hour, date_style, time_style, strftime_fmt } = config;
const locale = window.navigator?.language || 'en-US'; const locale = window.navigator?.language || 'en-US';
if (isNaN(unixTimestamp)) { if (isNaN(unixTimestamp)) {
@ -61,8 +61,8 @@ export const formatUnixTimestampToDateTime = (unixTimestamp: number, config: Dat
// else use Intl.DateTimeFormat // else use Intl.DateTimeFormat
const formatter = new Intl.DateTimeFormat(locale, { const formatter = new Intl.DateTimeFormat(locale, {
dateStyle, dateStyle: date_style,
timeStyle, timeStyle: time_style,
timeZone: timezone || Intl.DateTimeFormat().resolvedOptions().timeZone, timeZone: timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
hour12: use12hour !== null ? use12hour : undefined, hour12: use12hour !== null ? use12hour : undefined,
}); });