Skip to content

Calling setValue changes currentDate not properly #39

Description

@freeearth

Hello.
If I call setValue on already existing datetimepicker,
then it set it properly in frontend views, but getValue return non correct value
in terms of month, e.g. if I set 06 January 2025, the getValue return 10 February 2025
I find it changed after calling _loadDateData function at line 990 - https://github.com/jiandaoyun/Perfect-DateTimePicker/blob/f5d274b173d316576fc915bb02b20a05546f682c/src/jquery.datetimepicker.js#L990C17-L990C30
Probably inside a loop of _loadDateData near the line -

I fixed it, replaced currentDate = value; at line https://github.com/jiandaoyun/Perfect-DateTimePicker/blob/f5d274b173d316576fc915bb02b20a05546f682c/src/jquery.datetimepicker.js#L989C16-L989C37 with currentDate = structuredClone(value); i.e. creating a copy of Date object.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions