Skip to content

[Bug]: test(cron): add comprehensive timezone parsing test coverage #91654

Description

@SpecialLeon

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

test(cron): add comprehensive timezone parsing test coverage

Steps to reproduce

test(cron): add comprehensive timezone parsing test coverage

Expected behavior

test(cron): add comprehensive timezone parsing test coverage

Actual behavior

test(cron): add comprehensive timezone parsing test coverage

OpenClaw version

2026.06.09

Operating system

Ubuntu24.04

Install method

pnpm dev

Model

minimax

Provider / routing chain

openclaw

Additional provider/model setup details

test(cron): add comprehensive timezone parsing test coverage

Problem

The parseAbsoluteTimeMs function in src/cron/parse.ts handles ISO 8601 timestamp parsing for cron schedules, but the existing test coverage was minimal (only 2 test cases). This left several edge cases untested:

  • Different timezone offset formats (+HH:MM, -HH:MM, +HHMM, -HHMM)
  • UTC indicator variations (Z, z)
  • Sub-second precision (milliseconds, microseconds, nanoseconds)
  • Timezone edge cases (half-hour offsets like +05:30, 45-minute offsets like +12:45)
  • Maximum/minimum timezone offsets (+14:00, -12:00)
  • Whitespace handling
  • Invalid format rejection

Solution

Added comprehensive test coverage with 39 test cases organized into logical groups:

  1. Epoch milliseconds - Tests numeric timestamp parsing and rejection of out-of-range values
  2. ISO 8601 date only - Tests date-only strings normalized to midnight UTC
  3. ISO 8601 datetime without timezone - Tests implicit UTC assumption
  4. ISO 8601 with Z (UTC) timezone - Tests various UTC indicators including sub-second precision
  5. ISO 8601 with timezone offset (colon format) - Tests standard ±HH:MM formats including edge cases
  6. ISO 8601 with timezone offset (no colon format) - Tests ±HHMM format compatibility
  7. ISO 8601 with milliseconds and timezone - Tests combined sub-second precision with timezones
  8. Whitespace handling - Tests trimming and empty string rejection
  9. Invalid formats - Tests rejection of truly malformed date strings
  10. Edge cases - Tests leap years, year boundaries, and realistic timestamp ranges
  11. Real-world cron examples - Tests common scheduling scenarios

Testing

All 39 tests pass successfully, providing confidence that the parser correctly handles:

  • Standard ISO 8601 formats used in cron scheduling
  • International timezone formats (Beijing +08:00, EST -05:00, IST +05:30, etc.)
  • High-precision timestamps for sub-second scheduling requirements
  • Graceful rejection of invalid inputs

Files Changed

  • src/cron/parse.test.ts - Expanded from 2 to 39 comprehensive test cases

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.bugSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions