Skip to content

[P1] Fix date parsing - handle missing year and relative dates #29

Closed

Description

@KalebCole

Problem

The date parser has multiple issues:

  1. Missing year defaults to 2001 - Mar 15 8am parsed as March 15, 2001 instead of 2026
  2. Relative dates not handled - "next Sunday" should work
  3. AM/PM edge cases - "1am" vs "1pm" need careful handling

Examples of failures

Input Expected Actual
Mar 15 8am 2026-03-15T08:00 2001-03-15T08:00
next Sunday 8am Next Sunday Error or wrong date

Root Cause

function parseDateTime(dateStr) {
  const date = new Date(cleanStr);  // JS Date defaults to 2001 for monthless dates
}

Solution

  1. If no year specified, assume current year (or next year if date has passed)
  2. Support relative dates: "next Sunday", "tomorrow", "in 2 weeks"
  3. Use a proper date parsing library (chrono-node) or add robust logic
  4. Add unit tests for edge cases

Acceptance Criteria

  • Mar 15 8am → March 15 of current/next year
  • next Sunday 8am → Correct upcoming Sunday
  • tomorrow 7pm → Tomorrow at 7 PM
  • Dates in the past (this year) roll to next year

Activity

  1. KalebCole commented on Mar 11, 2026

    @KalebCole
    OwnerAuthor

    Fixed in a4288e3 — parseDateTime() handles missing year, relative dates (tomorrow, next Saturday)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions