Skip to content

Incorrect transforming of JavaScript Date into yyyy-mm string #100

@andreybpanfilov

Description

@andreybpanfilov

Describe the bug

To extract "month keys" the code uses date.toISOString().substr(0,7), the issue is the browser's date-time always gets converted to UTC timezone (The toISOString() method of Date instances returns a string representing this date in the date time string format, a simplified format based on ISO 8601, which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always UTC, as denoted by the suffix Z) - when applying such algorithm to the first day of month we may get one month shift, e.g.: 02:00 am October 1st 2025 AEDT -> 04:00 pm September 30 2025 UTC -> 2025-09, and due to that non-UTC clients may observe something like below due to this shift:

Image

Expected behavior

No response

Minimal reproducible example

No response

Add-on Version

4.5.0

Vaadin Version

24.3

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions