UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

23 lines (21 loc) 774 B
import { __name } from '../../chunk-PAWJFY3S.mjs'; import { Result } from '@sapphire/result'; import { Identifiers } from '../errors/Identifiers.mjs'; function resolveDate(parameter, options) { const parsed = new Date(parameter); const time = parsed.getTime(); if (Number.isNaN(time)) { return Result.err(Identifiers.ArgumentDateError); } if (typeof options?.minimum === "number" && time < options.minimum) { return Result.err(Identifiers.ArgumentDateTooEarly); } if (typeof options?.maximum === "number" && time > options.maximum) { return Result.err(Identifiers.ArgumentDateTooFar); } return Result.ok(parsed); } __name(resolveDate, "resolveDate"); export { resolveDate }; //# sourceMappingURL=date.mjs.map //# sourceMappingURL=date.mjs.map