21 lines
765 B
TypeScript
21 lines
765 B
TypeScript
const iskFormater = new Intl.NumberFormat("is-IS", {
|
|
minimumFractionDigits: 2,
|
|
maximumFractionDigits: 2
|
|
});
|
|
|
|
export const formatIsk = (value: number | bigint) => iskFormater.format(value) + " ISK";
|
|
|
|
export const percentFormater = new Intl.NumberFormat("en-US", {
|
|
style: "percent",
|
|
minimumFractionDigits: 0,
|
|
maximumFractionDigits: 0
|
|
});
|
|
|
|
|
|
const timeFormat = new Intl.NumberFormat("en-US", {
|
|
minimumFractionDigits: 0,
|
|
maximumFractionDigits: 0,
|
|
minimumIntegerDigits: 2
|
|
});
|
|
|
|
export const formatEveDate = (date?: Date | null) => !date ? '' : `${date.getUTCFullYear()}.${timeFormat.format(date.getUTCMonth() + 1)}.${timeFormat.format(date.getUTCDate())} ${timeFormat.format(date.getUTCHours())}:${timeFormat.format(date.getUTCMinutes())}`; |