63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import "dayjs/locale/da"
|
|
import "dayjs/locale/de"
|
|
import "dayjs/locale/fi"
|
|
import "dayjs/locale/sv"
|
|
|
|
import d from "dayjs"
|
|
import isToday from "dayjs/plugin/isToday"
|
|
import relativeTime from "dayjs/plugin/relativeTime"
|
|
import utc from "dayjs/plugin/utc"
|
|
|
|
/**
|
|
* dayjs export Norwegian as nb [Norwegian Bokmål] so here we create the same
|
|
* setup as nb has.
|
|
* https://day.js.org/docs/en/customization/customization
|
|
* https://github.com/iamkun/dayjs/blob/dev/src/locale/nb.js
|
|
*/
|
|
d.locale("no", {
|
|
name: "no",
|
|
weekdays: "søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),
|
|
weekdaysShort: "sø._ma._ti._on._to._fr._lø.".split("_"),
|
|
weekdaysMin: "sø_ma_ti_on_to_fr_lø".split("_"),
|
|
months:
|
|
"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split(
|
|
"_"
|
|
),
|
|
monthsShort:
|
|
"jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),
|
|
ordinal: (n: any) => `${n}.`,
|
|
weekStart: 1,
|
|
formats: {
|
|
LT: "HH:mm",
|
|
LTS: "HH:mm:ss",
|
|
L: "DD.MM.YYYY",
|
|
LL: "D. MMMM YYYY",
|
|
LLL: "D. MMMM YYYY [kl.] HH:mm",
|
|
LLLL: "dddd D. MMMM YYYY [kl.] HH:mm",
|
|
},
|
|
relativeTime: {
|
|
future: "om %s",
|
|
past: "%s siden",
|
|
s: "noen sekunder",
|
|
m: "ett minutt",
|
|
mm: "%d minutter",
|
|
h: "en time",
|
|
hh: "%d timer",
|
|
d: "en dag",
|
|
dd: "%d dager",
|
|
M: "en måned",
|
|
MM: "%d måneder",
|
|
y: "ett år",
|
|
yy: "%d år",
|
|
},
|
|
})
|
|
|
|
/**
|
|
* If more plugins are needed https://day.js.org/docs/en/plugin/plugin
|
|
*/
|
|
d.extend(isToday)
|
|
d.extend(relativeTime)
|
|
d.extend(utc)
|
|
|
|
export const dt = d
|