UNPKG

@evil-gauss/core

Version:
28 lines 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DateHelper = void 0; class DateHelper { static firstTimestampSeparator = 'T'; static lastTimestampSeparator = 'Z'; static MsInSecond = 1e3; static SecondsInMinute = 60; static MinutesInHour = 60; static HoursInDay = 24; static DaysInWeek = 7; static DaysInHalfYear = 180; static DaysInYearQuarter = DateHelper.DaysInHalfYear / 2; static DaysInMonth = 30; static MsInMinute = DateHelper.SecondsInMinute * DateHelper.MsInSecond; static MsInHour = DateHelper.MinutesInHour * DateHelper.MsInMinute; static MsInDay = DateHelper.HoursInDay * DateHelper.MsInHour; static SecondsInHour = DateHelper.MinutesInHour * DateHelper.SecondsInMinute; static SecondsInDay = DateHelper.HoursInDay * DateHelper.SecondsInHour; static secondsToMs = (seconds) => seconds * DateHelper.MsInSecond; static nsToMs = (ns) => Math.floor(ns / 1_000_000); static msToSeconds = (ms) => Math.floor(ms / DateHelper.MsInSecond); static getFullTime = (timestamp) => new Date(timestamp).toISOString().split(DateHelper.firstTimestampSeparator)[1].replace(DateHelper.lastTimestampSeparator, ''); static fromUTCMsToLocalMs = (ms) => ms - new Date(ms).getTimezoneOffset() * DateHelper.MsInSecond * DateHelper.SecondsInMinute; static getUTCMs = (ms) => ms + new Date(ms).getTimezoneOffset() * DateHelper.MsInSecond * DateHelper.SecondsInMinute; } exports.DateHelper = DateHelper; //# sourceMappingURL=date.helper.js.map