Skip to content

[BUG] Critical Date Parsing Failure in Event Status Logic (utils/status.ts) #960

@Sreejesh06

Description

@Sreejesh06

Describe the bug.

The getEventStatus function in utils/status.ts uses a simple .split('-') method to identify date ranges. While this works for standard ISO formats, it fails on the human-readable format used in city-lists.json (e.g., "19-20, February 2026").

The Technical Failure:
When the code encounters "19-20, February 2026":

  1. It splits the string into ["19", "20, February 2026"].
  2. new Date("19") returns Invalid Date.
  3. new Date("20, February 2026") returns a valid Date object.

Since the startDate becomes invalid, all subsequent comparison logic (today >= startDate) fails, leading to incorrect event statuses (Upcoming/Ongoing/Ended) being displayed on the UI.

Expected behavior

The parser should be intelligent enough to realize that "19" and "20" both belong to "February 2026."

  • Input: "19-20, February 2026"
  • Expected Output: An array containing two valid Date objects: Feb 19, 2026 and Feb 20, 2026.

Screenshots

Image Image

How to Reproduce

  1. Open utils/status.ts.
  2. Go to line 5, which contains the problematic line.
  3. Run the following command in the terminal:
    console.log(new Date('30 September - 1 October, 2026'.split('-')[0]))
    You will clearly see the issue. It should interpret the date as 30 September 2026, but instead it is parsed as 30 September 2001 due to the way JavaScript's Date parser handles incomplete date strings.

🖥️ Device Information [optional]

  • Operating System (OS):Mac
  • Browser:Arc
  • Browser Version:

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions