{"version":3,"file":"DateUtils.js","names":["defineDs","NumberUtils","formatISO8601","timestamp","options","includeDate","includeTime","includeTimePrefix","includeYear","includeDayName","dayNameSeparatorFromDate","parsed","parseISO8601","output","push","dayName","monthName","shortenMonthNames","slice","shortenDate","parseInt","date","year","hours","minutes","join","getLongDate","addYear","dateObj","toISOString","charAt","toUpperCase","Number","getNumberOfDaysInMonth","month","Date","getDate","getYear","isDateInvalid","d","getFullYear","getWeekNumber","utcDate","UTC","getMonth","dayNum","getUTCDay","setUTCDate","getUTCDate","yearStart","getUTCFullYear","Math","ceil","formatDateDayMonth","Intl","DateTimeFormat","day","format","formatDateMonthYear","formatDateDayMonthYear","formatDateDayDateMonthYear","dayString","formatDateWeekDay","dateString","concat","weekday","formatDateYearMonthDay","prefixNumberWithZeros","getDifferenceInMonths","date1","arguments","length","undefined","date2","d1","d2","months","getMatchingDateFromWeekAndYear","week","arrayOfDates","property","dateToMatch","filter","getWeekAndYearFromHash","hashMatch","location","hash","match","isNaN","parse","isSameDay","isWeekEndOfYearAndMonthIsJanuary","parseTimeZone","timeOffset","parts","split","Error","millisecondsInHour","millisecondsInMinute","data","console","warn","indexOf","dateObject","toLocaleString","timeZone","substring","seconds","timezone","e","setWeekAndYearToHash","history","pushState","locales","replace"],"sources":["DanskeSpil/Framework/NumberGames/Scripts/Helpers/Utils/DateUtils.js"],"sourcesContent":["defineDs('DanskeSpil/Framework/NumberGames/Scripts/Helpers/Utils/DateUtils', [\r\n 'DanskeSpil/Framework/NumberGames/Scripts/Helpers/Utils/NumberUtils',\r\n], (NumberUtils) => {\r\n\r\n\r\n var formatISO8601 = function (timestamp, options) {\r\n if (!timestamp) return '';\r\n\r\n options = options || {};\r\n\r\n var includeDate = typeof options.includeDate === 'undefined' ? true : options.includeDate;\r\n var includeTime = typeof options.includeTime === 'undefined' ? true : options.includeTime;\r\n var includeTimePrefix = typeof options.includeTimePrefix === 'undefined' ? true : options.includeTimePrefix;\r\n var includeYear = typeof options.includeYear === 'undefined' ? true : options.includeYear;\r\n var includeDayName = typeof options.includeDayName === 'undefined' ? false : options.includeDayName;\r\n var dayNameSeparatorFromDate = typeof options.dayNameSeparatorFromDate === 'undefined' ? false : options.dayNameSeparatorFromDate;\r\n\r\n var parsed = parseISO8601(timestamp);\r\n\r\n var output = [];\r\n\r\n if (includeDayName) {\r\n output.push(parsed.dayName);\r\n }\r\n\r\n if (dayNameSeparatorFromDate !== false) {\r\n output.push(dayNameSeparatorFromDate);\r\n }\r\n\r\n if (includeDate) {\r\n var monthName = options.shortenMonthNames ? parsed.monthName.slice(0, 3) + '.' : parsed.monthName;\r\n options.shortenDate ? output.push(parseInt(parsed.date, 10) + ' ' + monthName) : output.push(parseInt(parsed.date, 10) + '. ' + monthName);\r\n }\r\n\r\n if (includeYear) {\r\n output.push(parsed.year);\r\n }\r\n\r\n if (includeTime) {\r\n if (includeTimePrefix) {\r\n output.push('kl.');\r\n }\r\n\r\n output.push(parsed.hours + ':' + parsed.minutes);\r\n }\r\n\r\n return output.join(' ');\r\n };\r\n\r\n\r\n var getLongDate = function (date, addYear) {\r\n var dateObj = parseISO8601(date.toISOString());\r\n return dateObj.dayName.charAt(0).toUpperCase() + dateObj.dayName.slice(1)\r\n + ' d. ' + Number(dateObj.date) + '. ' + dateObj.monthName\r\n + (addYear ? ' ' + dateObj.year : '');\r\n };\r\n\r\n\r\n const getNumberOfDaysInMonth = (year, month) => {\r\n return new Date(year, month, 0).getDate();\r\n };\r\n\r\n\r\n /**\r\n * Returns the year of a date.\r\n * * @param {String|Date} date\r\n * * @return {Number|String}\r\n */\r\n const getYear = (date) => {\r\n if (isDateInvalid(date)) return '';\r\n const d = getDate(date);\r\n return d.getFullYear();\r\n };\r\n\r\n\r\n /**\r\n * Returns week number from a date.\r\n * Function converts a locale date object to a UTC date, then calculates a week number based on the start of the year\r\n * This function takes Week 53 into account as well (happens roughly every 6 years)\r\n * \"Inspiration\" from: https://stackoverflow.com/a/6117889\r\n * * @param {Date} date - The date to where the week number is to be found.\r\n * * @return {Number|String}\r\n */\r\n const getWeekNumber = (date) => {\r\n if (isDateInvalid(date)) return '';\r\n const d = getDate(date);\r\n const utcDate = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));\r\n const dayNum = utcDate.getUTCDay() || 7;\r\n utcDate.setUTCDate(utcDate.getUTCDate() + 4 - dayNum);\r\n const yearStart = new Date(Date.UTC(utcDate.getUTCFullYear(), 0, 1));\r\n return Math.ceil((((utcDate - yearStart) / 86400000) + 1) / 7);\r\n };\r\n\r\n\r\n /**\r\n * Returns a date formatted with ex. '27. oktober'.\r\n * @param {String|Date} date - The date to be formatted.\r\n * @return {String}\r\n */\r\n const formatDateDayMonth = (date) => {\r\n if (isDateInvalid(date)) return '';\r\n const d = getDate(date);\r\n return new Intl.DateTimeFormat('da-DK', { day: 'numeric', month: 'long' }).format(d);\r\n };\r\n\r\n\r\n /**\r\n * Returns a date formatted with ex. 'oktober 2022'.\r\n * @param {String|Date} date - The date to be formatted.\r\n * @return {String}\r\n */\r\n const formatDateMonthYear = (date) => {\r\n if (isDateInvalid(date)) return '';\r\n const d = getDate(date);\r\n return new Intl.DateTimeFormat('da-DK', { month: 'long', year: 'numeric' }).format(d);\r\n };\r\n\r\n\r\n /**\r\n * Returns a date formatted with ex. '27. oktober 2022'.\r\n * @param {String|Date} date - The date to be formatted.\r\n * @return {String}\r\n */\r\n const formatDateDayMonthYear = (date) => {\r\n if (isDateInvalid(date)) return '';\r\n const d = getDate(date);\r\n return new Intl.DateTimeFormat('da-DK', { day: 'numeric', month: 'long', year: 'numeric' }).format(d);\r\n };\r\n\r\n\r\n /**\r\n * Returns a date formatted with ex. 'Lørdag 27. oktober 2022'.\r\n * @param {String|Date} date - The date to be formatted.\r\n * @return {String}\r\n */\r\n const formatDateDayDateMonthYear = (date) => {\r\n if (isDateInvalid(date)) return '';\r\n const d = getDate(date);\r\n let dayString = formatDateWeekDay(d);\r\n dayString = dayString.charAt(0).toUpperCase() + dayString.slice(1);\r\n const dateString = formatDateDayMonthYear(d);\r\n return `${dayString} ${dateString}`;\r\n };\r\n\r\n\r\n /**\r\n * Returns a week date, ex. 'torsdag'.\r\n * @param {String|Date} date - The date from where the day is found.\r\n * @return {String}\r\n */\r\n const formatDateWeekDay = (date) => {\r\n if (isDateInvalid(date)) return '';\r\n const d = getDate(date);\r\n return new Intl.DateTimeFormat('da-DK', { weekday: 'long' }).format(d);\r\n };\r\n\r\n\r\n /**\r\n * Returns a date formatted with ex. '2022-10-27'.\r\n * @param {String|Date} date - The date to be formatted.\r\n * @return {String}\r\n */\r\n const formatDateYearMonthDay = (date) => {\r\n if (isDateInvalid(date)) return '';\r\n const d = getDate(date);\r\n const year = d.getFullYear();\r\n const month = NumberUtils.prefixNumberWithZeros(d.getMonth() + 1);\r\n const day = NumberUtils.prefixNumberWithZeros(d.getDate());\r\n return `${year}-${month}-${day}`;\r\n };\r\n\r\n /**\r\n * Calculates the difference in months between two dates.\r\n * @param {String|Date} date1\r\n * @param {String|Date} date2\r\n * @returns {number}\r\n */\r\n const getDifferenceInMonths = (date1 = new Date(), date2 = new Date()) => {\r\n if (isDateInvalid(date1) || isDateInvalid(date2)) return 0;\r\n const d1 = new Date(date1);\r\n const d2 = new Date(date2);\r\n let months;\r\n months = (d2.getFullYear() - d1.getFullYear()) * 12;\r\n months -= d1.getMonth();\r\n months += d2.getMonth();\r\n return months <= 0 ? 0 : months;\r\n };\r\n\r\n\r\n const getMatchingDateFromWeekAndYear = (week, year, arrayOfDates, property) => {\r\n if (!arrayOfDates || !week || !year) return;\r\n\r\n const dateToMatch = arrayOfDates.filter((d) => {\r\n if (property) {\r\n return week === getWeekNumber(d[property]) && year === getYear(d[property]);\r\n }\r\n\r\n return week === getWeekNumber(d) && year === getYear(d);\r\n });\r\n\r\n if (dateToMatch?.[0]) {\r\n return dateToMatch[0];\r\n }\r\n };\r\n\r\n\r\n const getWeekAndYearFromHash = () => {\r\n // hash should look like \"#uge35-2020\".\r\n const hashMatch = location.hash.match(/uge(\\d{1,2})-(\\d{4})/);\r\n if (hashMatch) {\r\n const week = Number(hashMatch[1]);\r\n const year = Number(hashMatch[2]);\r\n if (week && year) {\r\n return { week, year };\r\n }\r\n }\r\n };\r\n\r\n\r\n /**\r\n * Checks if a date is invalid.\r\n * @param {String|Date} date - The date to be checked.\r\n * @return {Boolean}\r\n */\r\n const isDateInvalid = (date) => {\r\n return isNaN(Date.parse(date));\r\n };\r\n\r\n\r\n /**\r\n * Compares two dates, to see if they're the same day (ignoring time differences).\r\n * @param {String|Date} date1 - The first date to be compared.\r\n * @param {String|Date} date2 - The second date to be compared.\r\n * @return {Boolean}\r\n */\r\n const isSameDay = (date1, date2) => {\r\n if (isDateInvalid(date1) || isDateInvalid(date2)) return false;\r\n return formatDateYearMonthDay(date1) === formatDateYearMonthDay(date2);\r\n };\r\n\r\n\r\n /**\r\n * Checks to see if ex. January 1, 2022 is part of Week 52 of 2021.\r\n * @param {String|Date} date\r\n * @return {Boolean}\r\n */\r\n const isWeekEndOfYearAndMonthIsJanuary = (date) => {\r\n if (isDateInvalid(date)) return false;\r\n const d = getDate(date);\r\n return getWeekNumber(d) > 50 && d.getMonth() === 0;\r\n };\r\n\r\n const parseTimeZone = (timeOffset) => {\r\n const parts = timeOffset.split(':');\r\n if (parts.length !== 2) {\r\n throw new Error('Invalid time offset format');\r\n }\r\n\r\n const hours = parseInt(parts[0], 10);\r\n const minutes = parseInt(parts[1], 10);\r\n\r\n if (isNaN(hours) || isNaN(minutes)) {\r\n throw new Error('Invalid time offset format');\r\n }\r\n\r\n const millisecondsInHour = 60 * 60 * 1000;\r\n const millisecondsInMinute = 60 * 1000;\r\n\r\n return (hours * millisecondsInHour) + (minutes * millisecondsInMinute);\r\n };\r\n\r\n\r\n var parseISO8601 = function (timestamp) {\r\n var data = {};\r\n if (timestamp.length < 19) {\r\n console.warn('Timestamp too short for ISO 8601 formatting!');\r\n } else if (timestamp.indexOf('Z') === timestamp.length - 1) {\r\n // if timestamp is given in UTC, convert it to danish timezone\r\n // swedish locale is used because it resembles ISO8601\r\n data.dateObject = new Date(timestamp);\r\n timestamp = data.dateObject.toLocaleString('sv', { timeZone: 'Europe/Copenhagen' });\r\n }\r\n\r\n data.year = timestamp.substring(0, 4);\r\n data.month = timestamp.substring(5, 7);\r\n data.date = timestamp.substring(8, 10);\r\n data.hours = timestamp.substring(11, 13);\r\n data.minutes = timestamp.substring(14, 16);\r\n data.seconds = timestamp.substring(17, 19);\r\n data.timezone = timestamp.substring(19, 25);\r\n\r\n if (!data.dateObject) {\r\n try {\r\n data.dateObject = new Date(data.year, data.month - 1, data.date, data.hours, data.minutes, data.seconds);\r\n if (data.timezone) {\r\n data.dateObject = new Date(Date.UTC(data.year, data.month - 1, data.date, data.hours, data.minutes, data.seconds)\r\n - parseTimeZone(data.timezone));\r\n }\r\n } catch (e) {\r\n // Empty\r\n }\r\n }\r\n\r\n data.dayName = data.dateObject.toLocaleString('da-DK', { weekday: 'long', timeZone: 'Europe/Copenhagen' });\r\n data.monthName = data.dateObject.toLocaleString('da-DK', { month: 'long', timeZone: 'Europe/Copenhagen' });\r\n\r\n return data;\r\n };\r\n\r\n\r\n const setWeekAndYearToHash = (date) => {\r\n if (history.pushState) {\r\n let year = getYear(date);\r\n if (isWeekEndOfYearAndMonthIsJanuary(date)) {\r\n year--;\r\n }\r\n history.pushState(null, null, `#uge${getWeekNumber(date)}-${year}`);\r\n }\r\n };\r\n\r\n\r\n /**\r\n * Returns a new Date object with default Copenhagen time zone.\r\n * Useful when you only have a simple date string, eg. '2022-12-31', and you want to convert\r\n * it to a date that still resembles December 31, 2022 for eg. Greenland users.\r\n * @param {String|Date} [date=new Date()]\r\n * @param {String} timeZone [timeZone='sv']\r\n * @returns {Date}\r\n */\r\n const getDate = (date = new Date(), timeZone = 'Europe/Copenhagen') => {\r\n // Swedish locale is used because its output format can be used to create a new Date object.\r\n const locales = 'sv';\r\n\r\n if (typeof date === 'string') {\r\n date = new Date(date);\r\n }\r\n\r\n date = date.toLocaleString(locales, { timeZone });\r\n date = date.replace(/-/g, '/'); // Safari version 0-15 fix.\r\n return new Date(date);\r\n };\r\n\r\n\r\n return {\r\n formatISO8601,\r\n getDate,\r\n getLongDate,\r\n getNumberOfDaysInMonth,\r\n getYear,\r\n getWeekNumber,\r\n formatDateDayMonth,\r\n formatDateMonthYear,\r\n formatDateDayMonthYear,\r\n formatDateDayDateMonthYear,\r\n formatDateWeekDay,\r\n formatDateYearMonthDay,\r\n getDifferenceInMonths,\r\n getMatchingDateFromWeekAndYear,\r\n getWeekAndYearFromHash,\r\n isDateInvalid,\r\n isSameDay,\r\n isWeekEndOfYearAndMonthIsJanuary,\r\n parseISO8601,\r\n setWeekAndYearToHash,\r\n };\r\n});\r\n\r\n"],"mappings":"AAAAA,QAAQ,CAAC,kEAAkE,EAAE,CAC3E,oEAAoE,CACrE,EAAGC,WAAW,IAAK;EAGlB,IAAIC,aAAa,GAAG,SAAAA,CAAUC,SAAS,EAAEC,OAAO,EAAE;IAChD,IAAI,CAACD,SAAS,EAAE,OAAO,EAAE;IAEzBC,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAEvB,IAAIC,WAAW,GAAG,OAAOD,OAAO,CAACC,WAAW,KAAK,WAAW,GAAG,IAAI,GAAGD,OAAO,CAACC,WAAW;IACzF,IAAIC,WAAW,GAAG,OAAOF,OAAO,CAACE,WAAW,KAAK,WAAW,GAAG,IAAI,GAAGF,OAAO,CAACE,WAAW;IACzF,IAAIC,iBAAiB,GAAG,OAAOH,OAAO,CAACG,iBAAiB,KAAK,WAAW,GAAG,IAAI,GAAGH,OAAO,CAACG,iBAAiB;IAC3G,IAAIC,WAAW,GAAG,OAAOJ,OAAO,CAACI,WAAW,KAAK,WAAW,GAAG,IAAI,GAAGJ,OAAO,CAACI,WAAW;IACzF,IAAIC,cAAc,GAAG,OAAOL,OAAO,CAACK,cAAc,KAAK,WAAW,GAAG,KAAK,GAAGL,OAAO,CAACK,cAAc;IACnG,IAAIC,wBAAwB,GA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