Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

DateTime.TryParse Issue #194

Closed
Closed

Description

@codeacula

The DateTime.TryParse fallback will successfully parse time-only strings like "3:00 PM" into a DateTime with the default date (0001-01-01). Since the code returns this as a valid parsed result, callers can end up with nonsensical ancient timestamps. If time-only inputs are meant to be supported, anchor them to now.Date (in the user's timezone) before converting to UTC; otherwise consider rejecting them and requiring the explicit fuzzy format (e.g., "at 3pm").

Originally posted by @Copilot in #182 (comment)

Activity

  1. changed the title [-]The `DateTime.TryParse` fallback will successfully parse time-only strings like "3:00 PM" into a `DateTime` with the default date (0001-01-01). Since the code returns this as a valid parsed result, callers can end up with nonsensical ancient timestamps. If time-only inputs are meant to be supported, anchor them to `now.Date` (in the user's timezone) before converting to UTC; otherwise consider rejecting them and requiring the explicit fuzzy format (e.g., "at 3pm").[/-] [+]DateTime.TryParse Issue[/+] on Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions