Skip to content

Day after tomorrow is not working correctly #3

@bartdelange

Description

@bartdelange

The code below is incorrectly suggesting that the second date in the list is occurring tomorrow.
I am using rrules to generate the date instances and convert them with the timezone package.

    final now = tz.TZDateTime.now(tz.UTC);
    final startOfDay = tz.TZDateTime.from(
      DateTime(
        now.year,
        now.month,
        now.day,
      ),
      tz.local,
    ).toUtc();
    print(now);
    // -> flutter: 2024-02-08 17:33:55.557756Z
    print(widget.plant.wateringNotificationDates(startOfDay).take(3));
    // -> flutter: (2024-02-08 16:00:00.000Z, 2024-02-10 16:00:00.000Z, 2024-02-13 16:00:00.000Z)
    print(widget.plant.wateringNotificationDates(startOfDay).take(3).map((e) => e.toLocal().relativeTime(context)));
    // -> flutter: (1 hour ago, tomorrow, in 4 days)

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