Files
NapCatQQ/.pnpm-store/v3/files/2f/4337448f19bae810de4ed48abae1a92004c47d00f26a1f2a35200ddfe0d76b6fb8ee13bfac1b19a6084d1f9d6813d8bd6989f15f558c00804963bfffac3c2e
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

42 lines
1.1 KiB
Plaintext

import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from "@peculiar/asn1-schema";
let Time = class Time {
constructor(time) {
if (time) {
if (typeof time === "string" || typeof time === "number" || time instanceof Date) {
const date = new Date(time);
if (date.getUTCFullYear() > 2049) {
this.generalTime = date;
}
else {
this.utcTime = date;
}
}
else {
Object.assign(this, time);
}
}
}
getTime() {
const time = this.utcTime || this.generalTime;
if (!time) {
throw new Error("Cannot get time from CHOICE object");
}
return time;
}
};
__decorate([
AsnProp({
type: AsnPropTypes.UTCTime,
})
], Time.prototype, "utcTime", void 0);
__decorate([
AsnProp({
type: AsnPropTypes.GeneralizedTime,
})
], Time.prototype, "generalTime", void 0);
Time = __decorate([
AsnType({ type: AsnTypeTypes.Choice })
], Time);
export { Time };