import "dayjs/locale/da"
import "dayjs/locale/de"
import "dayjs/locale/fi"
import "dayjs/locale/sv"

import d from "dayjs"
import nb from "dayjs/locale/nb"
import advancedFormat from "dayjs/plugin/advancedFormat"
import customParseFormat from "dayjs/plugin/customParseFormat"
import duration from "dayjs/plugin/duration"
import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
import isToday from "dayjs/plugin/isToday"
import relativeTime from "dayjs/plugin/relativeTime"
import timezone from "dayjs/plugin/timezone"
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", { ...nb, name: "no" }, true)

/**
 *  If more plugins are needed https://day.js.org/docs/en/plugin/plugin
 */
d.extend(advancedFormat)
d.extend(isToday)
d.extend(relativeTime)
d.extend(timezone)
d.extend(utc)
d.extend(isSameOrAfter)
d.extend(isSameOrBefore)
d.extend(duration)
d.extend(customParseFormat)

export const dt = d
