Skip to content

Current date with time of 00:00:00.000 do not become "Today at..." #5

@MrInventor

Description

@MrInventor

Flutter using:
calendar_time: ^2.3.0

resolved to:
calendar_time 2.3.0

Example:

var fromDate = "2025-01-26";
var parsedDate = DateTime.parse(fromDate);
    
print(parsedDate.toString() + " - " + CalendarTime(parsedDate).toHuman);

Prints: 2025-01-26 00:00:00.000 - Sun, Jan 26, 2025 12:00 AM

Result = "Sun, Jan 26, 2025 12:00 AM"
Expected result = "Today at 12:00 AM"

If I add just a microsecond I get the expected result:

var fromDate = "2025-01-26";
var parsedDate = DateTime.parse(fromDate);
parsedDate = parsedDate.add(Duration(microseconds: 1)); 
print(parsedDate.toString() + " " + CalendarTime(parsedDate).toHuman);

Prints: 2025-01-26 00:00:00.000001 - Today at 12:00 AM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions