Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

timestamp.js.map 21KB

1
  1. {"version":3,"sources":["../../../../src/components/VCalendar/util/timestamp.ts"],"names":[],"mappings":";;OACO,IAAM,cAAsB,8EAA5B;AACP,OAAO,IAAM,aAAqB,+BAA3B;AAEP,OAAO,IAAM,gBAA0B,CAAC,CAAD,EAAI,EAAJ,EAAQ,EAAR,EAAY,EAAZ,EAAgB,EAAhB,EAAoB,EAApB,EAAwB,EAAxB,EAA4B,EAA5B,EAAgC,EAAhC,EAAoC,EAApC,EAAwC,EAAxC,EAA4C,EAA5C,EAAgD,EAAhD,CAAhC;AACP,OAAO,IAAM,qBAA+B,CAAC,CAAD,EAAI,EAAJ,EAAQ,EAAR,EAAY,EAAZ,EAAgB,EAAhB,EAAoB,EAApB,EAAwB,EAAxB,EAA4B,EAA5B,EAAgC,EAAhC,EAAoC,EAApC,EAAwC,EAAxC,EAA4C,EAA5C,EAAgD,EAAhD,CAArC;AACP,OAAO,IAAM,oBAAoB,EAA1B;AACP,OAAO,IAAM,oBAAoB,EAA1B;AACP,OAAO,IAAM,YAAY,EAAlB;AACP,OAAO,IAAM,YAAY,CAAlB;AACP,OAAO,IAAM,UAAU,CAAhB;AACP,OAAO,IAAM,eAAe,CAArB;AACP,OAAO,IAAM,kBAAkB,EAAxB;AACP,OAAO,IAAM,eAAe,EAArB;AACP,OAAO,IAAM,aAAa,CAAnB;AA+BP,OAAM,SAAU,cAAV,CAA0B,SAA1B,EAAiD,QAAjD,EAAqE,KAArE,EAAuF;AAC3F,QAAM,QAAQ,cAAc,SAAd,CAAd;AACA,gBAAY,KAAZ,EAAmB,SAAS,CAAT,CAAnB,EAAgC,OAAhC;AACA,oBAAgB,KAAhB;AACA,QAAI,KAAJ,EAAW;AACT,uBAAe,KAAf,EAAsB,KAAtB,EAA6B,MAAM,OAAnC;AACD;AACD,WAAO,KAAP;AACD;AAED,OAAM,SAAU,YA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CAAZ;AACA,kBAAU,IAAV,CAAe,cAAc,GAAd,EAAmB,IAAnB,EAAyB,GAAzB,CAAf;AACD;AAED,WAAO,SAAP;AACD;AAED,OAAM,SAAU,2BAAV,CAAuC,MAAvC,EAAuD,UAAvD,EAA0F;AAC9F,QAAM,iBAAsC,SAAtC,cAAsC,CAAC,EAAD,EAAK,EAAL;AAAA,eAAY,EAAZ;AAAA,KAA5C;AAEA,QAAI,OAAO,IAAP,KAAgB,WAAhB,IAA+B,OAAO,KAAK,cAAZ,KAA+B,WAAlE,EAA+E;AAC7E,eAAO,cAAP;AACD;AAED,WAAO,UAAC,SAAD,EAAY,KAAZ,EAAqB;AAC1B,YAAI;AACF,gBAAM,gBAAgB,IAAI,KAAK,cAAT,CAAwB,UAAU,SAAlC,EAA6C,WAAW,SAAX,EAAsB,KAAtB,CAA7C,CAAtB;AACA,gBAAM,OAAU,UAAU,UAAU,IAApB,EAA0B,CAA1B,CAAV,SAA0C,UAAU,UAAU,MAApB,EAA4B,CAA5B,CAAhD;AACA,gBAAM,OAAO,UAAU,IAAvB;AACA,mBAAO,cAAc,MAAd,CAAqB,IAAI,IAAJ,CAAY,IAAZ,SAAoB,IAApB,eAArB,CAAP;AACD,SALD,CAKE,OAAO,CAAP,EAAU;AACV,mBAAO,EAAP;AACD;AACF,KATD;AAUD","sourcesContent":["\nexport const PARSE_REGEX: RegExp = /^(\\d{4})-(\\d{1,2})(-(\\d{1,2}))?([^\\d]+(\\d{1,2}))?(:(\\d{1,2}))?(:(\\d{1,2}))?$/\nexport const PARSE_TIME: RegExp = /(\\d\\d?)(:(\\d\\d?)|)(:(\\d\\d?)|)/\n\nexport const DAYS_IN_MONTH: number[] = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\nexport const DAYS_IN_MONTH_LEAP: number[] = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\nexport const DAYS_IN_MONTH_MIN = 28\nexport const DAYS_IN_MONTH_MAX = 31\nexport const MONTH_MAX = 12\nexport const MONTH_MIN = 1\nexport const DAY_MIN = 1\nexport const DAYS_IN_WEEK = 7\nexport const MINUTES_IN_HOUR = 60\nexport const HOURS_IN_DAY = 24\nexport const FIRST_HOUR = 0\n\nexport interface VTimestamp {\n date: string\n time: string\n year: number\n month: number\n day: number\n weekday: number\n hour: number\n minute: number\n hasDay: boolean\n hasTime: boolean\n past: boolean\n present: boolean\n future: boolean\n}\n\nexport interface VTimeObject {\n hour: number\n minute: number\n}\n\nexport type VTime = number | string | VTimeObject\n\nexport type VTimestampFormatter = (timestamp: VTimestamp, short: boolean) => string\n\nexport type VTimestampFormatOptions = (timestamp: VTimestamp, short: boolean) => object\n\nexport type VTimestampOperation = (timestamp: VTimestamp) => VTimestamp\n\nexport function getStartOfWeek (timestamp: VTimestamp, weekdays: number[], today?: VTimestamp): VTimestamp {\n const start = copyTimestamp(timestamp)\n findWeekday(start, weekdays[0], prevDay)\n updateFormatted(start)\n if (today) {\n updateRelative(start, today, start.hasTime)\n }\n return start\n}\n\nexport function getEndOfWeek (timestamp: VTimestamp, weekdays: number[], today?: VTimestamp): VTimestamp {\n const end = copyTimestamp(timestamp)\n findWeekday(end, weekdays[weekdays.length - 1])\n updateFormatted(end)\n if (today) {\n updateRelative(end, today, end.hasTime)\n }\n return end\n}\n\nexport function getStartOfMonth (timestamp: VTimestamp): VTimestamp {\n const start = copyTimestamp(timestamp)\n start.day = DAY_MIN\n updateWeekday(start)\n updateFormatted(start)\n return start\n}\n\nexport function getEndOfMonth (timestamp: VTimestamp): VTimestamp {\n const end = copyTimestamp(timestamp)\n end.day = daysInMonth(end.year, end.month)\n updateWeekday(end)\n updateFormatted(end)\n return end\n}\n\nexport function parseTime (input: any): number | false {\n if (typeof input === 'number') {\n // when a number is given, it's minutes since 12:00am\n return input\n } else if (typeof input === 'string') {\n // when a string is given, it's a hh:mm:ss format where seconds are optional\n const parts = PARSE_TIME.exec(input)\n if (!parts) {\n return false\n }\n return parseInt(parts[1]) * 60 + parseInt(parts[3] || 0)\n } else if (typeof input === 'object') {\n // when an object is given, it must have hour and minute\n if (typeof input.hour !== 'number' || typeof input.minute !== 'number') {\n return false\n }\n return input.hour * 60 + input.minute\n } else {\n // unsupported type\n return false\n }\n}\n\nexport function validateTimestamp (input: any): boolean {\n return !!PARSE_REGEX.exec(input)\n}\n\nexport function parseTimestamp (input: string, now?: VTimestamp): VTimestamp | null {\n // YYYY-MM-DD hh:mm:ss\n const parts = PARSE_REGEX.exec(input)\n\n if (!parts) return null\n\n const timestamp: VTimestamp = {\n date: input,\n time: '',\n year: parseInt(parts[1]),\n month: parseInt(parts[2]),\n day: parseInt(parts[4]) || 1,\n hour: parseInt(parts[6]) || 0,\n minute: parseInt(parts[8]) || 0,\n weekday: 0,\n hasDay: !!parts[4],\n hasTime: !!(parts[6] && parts[8]),\n past: false,\n present: false,\n future: false\n }\n\n updateWeekday(timestamp)\n updateFormatted(timestamp)\n\n if (now) {\n updateRelative(timestamp, now, timestamp.hasTime)\n }\n\n return timestamp\n}\n\nexport function parseDate (date: Date): VTimestamp {\n return updateFormatted({\n date: '',\n time: '',\n year: date.getFullYear(),\n month: date.getMonth() + 1,\n day: date.getDate(),\n weekday: date.getDay(),\n hour: date.getHours(),\n minute: date.getMinutes(),\n hasDay: true,\n hasTime: true,\n past: false,\n present: true,\n future: false\n })\n}\n\nexport function getDayIdentifier (timestamp: VTimestamp): number {\n return timestamp.year * 10000 + timestamp.month * 100 + timestamp.day\n}\n\nexport function getTimeIdentifier (timestamp: VTimestamp): number {\n return timestamp.hour * 100 + timestamp.minute\n}\n\nexport function updateRelative (timestamp: VTimestamp, now: VTimestamp, time = false): VTimestamp {\n let a = getDayIdentifier(now)\n let b = getDayIdentifier(timestamp)\n let present = a === b\n\n if (timestamp.hasTime && time && present) {\n a = getTimeIdentifier(now)\n b = getTimeIdentifier(timestamp)\n present = a === b\n }\n\n timestamp.past = b < a\n timestamp.present = present\n timestamp.future = b > a\n\n return timestamp\n}\n\nexport function updateMinutes (timestamp: VTimestamp, minutes: number, now?: VTimestamp): VTimestamp {\n timestamp.hasTime = true\n timestamp.hour = Math.floor(minutes / MINUTES_IN_HOUR)\n timestamp.minute = minutes % MINUTES_IN_HOUR\n timestamp.time = getTime(timestamp)\n if (now) {\n updateRelative(timestamp, now, true)\n }\n\n return timestamp\n}\n\nexport function updateWeekday (timestamp: VTimestamp): VTimestamp {\n timestamp.weekday = getWeekday(timestamp)\n\n return timestamp\n}\n\nexport function updateFormatted (timestamp: VTimestamp): VTimestamp {\n timestamp.time = getTime(timestamp)\n timestamp.date = getDate(timestamp)\n\n return timestamp\n}\n\nexport function getWeekday (timestamp: VTimestamp): number {\n if (timestamp.hasDay) {\n const _ = Math.floor\n const k = timestamp.day\n const m = ((timestamp.month + 9) % MONTH_MAX) + 1\n const C = _(timestamp.year / 100)\n const Y = (timestamp.year % 100) - (timestamp.month <= 2 ? 1 : 0)\n\n return (((k + _(2.6 * m - 0.2) - 2 * C + Y + _(Y / 4) + _(C / 4)) % 7) + 7) % 7\n }\n\n return timestamp.weekday\n}\n\nexport function isLeapYear (year: number): boolean {\n return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)\n}\n\nexport function daysInMonth (year: number, month: number) {\n return isLeapYear(year) ? DAYS_IN_MONTH_LEAP[month] : DAYS_IN_MONTH[month]\n}\n\nexport function copyTimestamp (timestamp: VTimestamp): VTimestamp {\n const { date, time, year, month, day, weekday, hour, minute, hasDay, hasTime, past, present, future } = timestamp\n\n return { date, time, year, month, day, weekday, hour, minute, hasDay, hasTime, past, present, future }\n}\n\nexport function padNumber (x: number, length: number): string {\n let padded = String(x)\n while (padded.length < length) {\n padded = '0' + padded\n }\n\n return padded\n}\n\nexport function getDate (timestamp: VTimestamp): string {\n let str = `${padNumber(timestamp.year, 4)}-${padNumber(timestamp.month, 2)}`\n\n if (timestamp.hasDay) str += `-${padNumber(timestamp.day, 2)}`\n\n return str\n}\n\nexport function getTime (timestamp: VTimestamp): string {\n if (!timestamp.hasTime) {\n return ''\n }\n\n return `${padNumber(timestamp.hour, 2)}:${padNumber(timestamp.minute, 2)}`\n}\n\nexport function nextMinutes (timestamp: VTimestamp, minutes: number): VTimestamp {\n timestamp.minute += minutes\n while (timestamp.minute > MINUTES_IN_HOUR) {\n timestamp.minute -= MINUTES_IN_HOUR\n timestamp.hour++\n if (timestamp.hour >= HOURS_IN_DAY) {\n nextDay(timestamp)\n timestamp.hour = FIRST_HOUR\n }\n }\n\n return timestamp\n}\n\nexport function nextDay (timestamp: VTimestamp): VTimestamp {\n timestamp.day++\n timestamp.weekday = (timestamp.weekday + 1) % DAYS_IN_WEEK\n if (timestamp.day > DAYS_IN_MONTH_MIN && timestamp.day > daysInMonth(timestamp.year, timestamp.month)) {\n timestamp.day = DAY_MIN\n timestamp.month++\n if (timestamp.month > MONTH_MAX) {\n timestamp.month = MONTH_MIN\n timestamp.year++\n }\n }\n\n return timestamp\n}\n\nexport function prevDay (timestamp: VTimestamp): VTimestamp {\n timestamp.day--\n timestamp.weekday = (timestamp.weekday + 6) % DAYS_IN_WEEK\n if (timestamp.day < DAY_MIN) {\n timestamp.month--\n if (timestamp.month < MONTH_MIN) {\n timestamp.year--\n timestamp.month = MONTH_MAX\n }\n timestamp.day = daysInMonth(timestamp.year, timestamp.month)\n }\n\n return timestamp\n}\n\nexport function relativeDays (timestamp: VTimestamp,\n mover: VTimestampOperation = nextDay, days = 1): VTimestamp {\n while (--days >= 0) mover(timestamp)\n\n return timestamp\n}\n\nexport function findWeekday (timestamp: VTimestamp, weekday: number,\n mover: VTimestampOperation = nextDay, maxDays = 6): VTimestamp {\n while (timestamp.weekday !== weekday && --maxDays >= 0) mover(timestamp)\n\n return timestamp\n}\n\nexport function getWeekdaySkips (weekdays: number[]): number[] {\n const skips: number[] = [1, 1, 1, 1, 1, 1, 1]\n const filled: number[] = [0, 0, 0, 0, 0, 0, 0]\n for (let i = 0; i < weekdays.length; i++) {\n filled[weekdays[i]] = 1\n }\n for (let k = 0; k < DAYS_IN_WEEK; k++) {\n let skip = 1\n for (let j = 1; j < DAYS_IN_WEEK; j++) {\n const next = (k + j) % DAYS_IN_WEEK\n if (filled[next]) {\n break\n }\n skip++\n }\n skips[k] = filled[k] * skip\n }\n\n return skips\n}\n\nexport function createDayList (start: VTimestamp, end: VTimestamp, now: VTimestamp,\n weekdaySkips: number[], max = 42, min = 0): VTimestamp[] {\n const stop = getDayIdentifier(end)\n const days: VTimestamp[] = []\n let current = copyTimestamp(start)\n let currentIdentifier = 0\n let stopped = currentIdentifier === stop\n\n if (stop < getDayIdentifier(start)) {\n return days\n }\n\n while ((!stopped || days.length < min) && days.length < max) {\n currentIdentifier = getDayIdentifier(current)\n stopped = stopped || currentIdentifier === stop\n if (weekdaySkips[current.weekday] === 0) {\n current = nextDay(current)\n continue\n }\n const day = copyTimestamp(current)\n updateFormatted(day)\n updateRelative(day, now)\n days.push(day)\n current = relativeDays(current, nextDay, weekdaySkips[current.weekday])\n }\n\n return days\n}\n\nexport function createIntervalList (timestamp: VTimestamp, first: number,\n minutes: number, count: number, now?: VTimestamp): VTimestamp[] {\n const intervals: VTimestamp[] = []\n\n for (let i = 0; i < count; i++) {\n const mins = (first + i) * minutes\n const int = copyTimestamp(timestamp)\n intervals.push(updateMinutes(int, mins, now))\n }\n\n return intervals\n}\n\nexport function createNativeLocaleFormatter (locale: string, getOptions: VTimestampFormatOptions): VTimestampFormatter {\n const emptyFormatter: VTimestampFormatter = (_t, _s) => ''\n\n if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {\n return emptyFormatter\n }\n\n return (timestamp, short) => {\n try {\n const intlFormatter = new Intl.DateTimeFormat(locale || undefined, getOptions(timestamp, short))\n const time = `${padNumber(timestamp.hour, 2)}:${padNumber(timestamp.minute, 2)}`\n const date = timestamp.date\n return intlFormatter.format(new Date(`${date}T${time}:00+00:00`))\n } catch (e) {\n return ''\n }\n }\n}\n"],"sourceRoot":""}