fixed formatting with pre-commit

This commit is contained in:
0phoff 2024-01-17 14:01:52 +01:00
parent a8229f9716
commit defdf5c4f0
2 changed files with 13 additions and 3 deletions

View File

@ -105,7 +105,7 @@ function relativeDate(date, formatter) {
const units = ["second", "minute", "hour", "day", "week", "month", "year"];
const delta = Math.round((date.getTime() - Date.now()) / 1000);
const unitIndex = cutoffs.findIndex(cutoff => cutoff > Math.abs(delta));
const unitIndex = cutoffs.findIndex((cutoff) => cutoff > Math.abs(delta));
const divisor = unitIndex ? cutoffs[unitIndex - 1] : 1;
return formatter.format(Math.floor(delta / divisor), units[unitIndex]);

View File

@ -70,10 +70,20 @@ function formatValue(t, mapping, rawValue) {
value = t("common.bitrate", { value });
break;
case "date":
value = t("common.date", { value, lng: mapping?.locale, dateStyle: mapping?.dateStyle ?? "long", timeStyle: mapping?.timeStyle });
value = t("common.date", {
value,
lng: mapping?.locale,
dateStyle: mapping?.dateStyle ?? "long",
timeStyle: mapping?.timeStyle,
});
break;
case "relativeDate":
value = t("common.relativeDate", { value, lng: mapping?.locale, style: mapping?.style, numeric: mapping?.numeric });
value = t("common.relativeDate", {
value,
lng: mapping?.locale,
style: mapping?.style,
numeric: mapping?.numeric,
});
break;
case "text":
default: