BUPKIS
    Preparing search index...

    Variable DurationFormatSchemaConst

    DurationFormatSchema: ZodCustomStringFormat<"duration"> = ...

    A Zod schema that validates duration string formats.

    This schema validates human-readable duration strings using a flexible format that supports various time units with both full names and abbreviations. The format is "{amount} {unit}" where amount is a positive integer and unit can be any supported time unit. Extra whitespace is automatically trimmed.

    Supported units (case-insensitive):

    • Milliseconds: millisecond, milliseconds, ms
    • Seconds: second, seconds, s
    • Minutes: minute, minutes, m
    • Hours: hour, hours, h
    • Days: day, days, d
    • Weeks: week, weeks, w
    • Months: month, months (approximate: 30 days)
    • Years: year, years, y (approximate: 365 days)
    DurationFormatSchema.parse('1 hour'); // ✓ Valid
    DurationFormatSchema.parse('30 minutes'); // ✓ Valid
    DurationFormatSchema.parse('2 days'); // ✓ Valid
    DurationFormatSchema.parse(' 5 seconds '); // ✓ Valid (whitespace trimmed)
    DurationFormatSchema.parse('1h'); // ✓ Valid abbreviation
    DurationFormatSchema.parse('10 ms'); // ✓ Valid milliseconds
    DurationFormatSchema.parse('-5 minutes'); // ✗ Throws - negative not allowed
    DurationFormatSchema.parse('1.5 hours'); // ✗ Throws - decimal not allowed
    DurationFormatSchema.parse('5'); // ✗ Throws - missing unit
    DurationFormatSchema.parse('five minutes'); // ✗ Throws - non-numeric amount