// Module ID: 5072 // Function ID: 5073 // Name: TimestampUtils // Dependencies: [4286, 4196, 1090, 2] // Exports: formatTimestampMention, parseTimestamp, unparseTimestamp // Module 5072 (TimestampUtils) import DurationsDefault from "Durations" /* 1090 */; import _modDef4196 from "module_4196" /* 4196 */; import DateUtils from "DateUtils" /* 4286 */; import size from "module_2" /* 2 */; const TIMESTAMP_FORMATS = { t(date) { return DateUtils.dateFormat(date, "LT"); }, T(date) { return DateUtils.dateFormat(date, "LTS"); }, d(date) { return DateUtils.dateFormat(date, "L"); }, D(date) { return DateUtils.dateFormat(date, "LL"); }, f(date) { return DateUtils.dateFormat(date, "LLL"); }, F(date) { return DateUtils.dateFormat(date, "LLLL"); }, s(date) { return DateUtils.dateFormat(date, "L LT"); }, S(date) { return DateUtils.dateFormat(date, "L LTS"); }, R(toDate) { const result = _modDef4196.relativeTimeThreshold("s"); const result1 = _modDef4196.relativeTimeThreshold("s", 60); const result2 = _modDef4196.relativeTimeThreshold("ss"); const result3 = _modDef4196.relativeTimeThreshold("ss", -1); const result4 = _modDef4196.relativeTimeThreshold("m"); const result5 = _modDef4196.relativeTimeThreshold("m", 60); try { const tmpResult = tmp(4196); let fromNowResult = tmp(4196)(toDate.toDate()).fromNow(); const tmpResultResult = tmp(4196)(toDate.toDate()); const result6 = tmp(4196).relativeTimeThreshold("s", result); const tmpResult5 = tmp(4196); const result7 = tmp(4196).relativeTimeThreshold("ss", result2); const tmpResult6 = tmp(4196); const result8 = tmp(4196).relativeTimeThreshold("m", result4); if (fromNowResult == null) { const tmpResult8 = tmp(4196); fromNowResult = tmp(4196)(toDate.toDate()).fromNow(); const tmpResult4Result = tmp(4196)(toDate.toDate()); } return fromNowResult; } catch (err) { } } }; Object.setPrototypeOf(TIMESTAMP_FORMATS, null); const keys = Object.keys(TIMESTAMP_FORMATS); const regExp = new RegExp("^"); let result = size.fileFinishedImporting("modules/markup/TimestampUtils.tsx"); export { TIMESTAMP_FORMATS }; export const DEFAULT_TIMESTAMP_FORMAT = "f"; export const TIMESTAMP_REGEX = regExp; export const formatTimestampMention = function formatTimestampMention(mention) { ({ timestamp, format } = mention); const tmp = _modDef4196; const tmpResult = tmp(Number(timestamp) * DurationsDefault.Millis.SECOND); if (tmpResult.isValid()) { let f; if (null != format) { f = obj[format]; } if (null == f) { f = obj.f; } obj = { timestamp, format, parsed: tmpResult, full: null, formatted: null }; obj.full = obj.F(tmpResult); obj.formatted = f(tmpResult); return obj; } else { return null; } const NumberResult = Number(timestamp); }; export const parseTimestamp = function parseTimestamp(timestamp, format) { const tmp = _modDef4196; const tmpResult = tmp(Number(timestamp) * DurationsDefault.Millis.SECOND); let tmp3 = null; if (tmpResult.isValid()) { let f; if (null != format) { f = obj[format]; } if (null == f) { f = obj.f; } obj = { timestamp, format, parsed: tmpResult, full: null, formatted: null }; obj.full = obj.F(tmpResult); obj.formatted = f(tmpResult); tmp3 = obj; } return tmp3; }; export const unparseTimestamp = function unparseTimestamp(timestamp, format) { if (null != format) { const _HermesInternal2 = HermesInternal; let combined = ""; } else { const _HermesInternal = HermesInternal; combined = ""; } return combined; };