decord/alpha/source/modules/threads/getTimestampString.tsx

124 lines
3.3 KiB
TypeScript

// Module ID: 7695
// Function ID: 7696
// Name: getTimestampString
// Dependencies: [1115, 4314, 2]
// Exports: default
// Module 7695 (getTimestampString)
import util from "util" /* 1115 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
let c3 = 2592000;
let c4 = 31104000;
const result = size.fileFinishedImporting("modules/threads/getTimestampString.tsx");
export default function getTimestampString(arg0, fn) {
let flag = arg2;
if (arg2 === undefined) {
flag = true;
}
importDefault = undefined;
let time;
const diffResult = require("module_4314")().diff(require("module_4314")(arg0), "s");
let tmp4;
if (null != fn) {
tmp4 = fn();
}
function formatString(minutes, diffResult) {
if (tmp3) {
let tmp5 = tmp[minutes];
if (tmp5 == null) {
let tmp6;
if (tmp2 != null) {
tmp6 = tmp2[minutes];
}
tmp5 = tmp6;
}
if (tmp5 == null) {
tmp5 = null;
}
let tmp4 = tmp5;
} else {
tmp4 = undefined;
if (tmp2 != null) {
tmp4 = tmp2[minutes];
}
if (tmp4 == null) {
tmp4 = null;
}
}
let tmp7 = null;
if (null != tmp4) {
let formatToPlainStringResult = tmp4;
if (typeof tmp4 !== "string") {
const intl = util.intl;
const obj = { count: diffResult };
formatToPlainStringResult = intl.formatToPlainString(tmp4, obj);
}
tmp7 = formatToPlainStringResult;
}
return tmp7;
}
importDefault = tmp4;
time = { seconds: flag(tmp2[0]).t.sMPmtq, minutes: flag(tmp2[0]).t.N9M4N1, hours: flag(tmp2[0]).t.p0KedC, days: flag(tmp2[0]).t.gjK5av, months: flag(tmp2[0]).t.kHo4Or, years: flag(tmp2[0]).t.KjKr2P };
if (diffResult < 60) {
let seconds;
if (tmp4 != null) {
seconds = tmp4.seconds;
}
if (null != seconds) {
let formatStringResult = formatString("seconds", diffResult);
} else {
formatStringResult = formatString("minutes", 1);
}
if (null != formatStringResult) {
return formatStringResult;
}
}
if (diffResult < 3600) {
const _Math = Math;
const formatStringResult1 = formatString("minutes", Math.floor(diffResult / 60));
if (null != formatStringResult1) {
return formatStringResult1;
}
}
if (diffResult < 86400) {
const _Math2 = Math;
const formatStringResult2 = formatString("hours", Math.floor(diffResult / 3600));
if (null != formatStringResult2) {
return formatStringResult2;
}
}
if (diffResult < c3) {
const _Math3 = Math;
const formatStringResult3 = formatString("days", Math.floor(diffResult / 86400));
if (null != formatStringResult3) {
return formatStringResult3;
}
}
if (diffResult < c4) {
const _Math4 = Math;
const formatStringResult4 = formatString("months", Math.floor(diffResult / tmp11));
if (null != formatStringResult4) {
return formatStringResult4;
}
}
if (diffResult >= c4) {
let years;
if (tmp4 != null) {
years = tmp4.years;
}
if (null != years) {
const _Math5 = Math;
const formatStringResult5 = formatString("years", Math.floor(diffResult / tmp14));
if (null != formatStringResult5) {
return formatStringResult5;
}
}
}
let obj = require("module_4314")();
tmp11 = c3;
return require("module_4314")(arg0).format("LL");
};