Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui5-date-picker: adapt and restore the time zone changing test #4443

Closed
unazko opened this issue Dec 7, 2021 · 1 comment · Fixed by #4829
Closed

ui5-date-picker: adapt and restore the time zone changing test #4443

unazko opened this issue Dec 7, 2021 · 1 comment · Fixed by #4829
Assignees
Labels
bug This issue is a bug in the code Medium Prio TOPIC B

Comments

@unazko
Copy link
Contributor

unazko commented Dec 7, 2021

Hello colleagues,

Bug Description

The test with name "Calendar selection works on different timezones" is disabled via the following PR: #4428
Enabling strict parsing for the ui5-date-picker component formatter by default causes this particular test to fail.
There is a mocked Date.prototype.getDate method in the test sample, which alongside with strict parsing set to true causes the
DateFormatter to not be able to parse the string values from the input fields.

Steps to Reproduce

  1. Go to the local test page: http://localhost:8080/test-resources/pages/DatePicker_test_page.html
  2. Type "-6" into the ui5-step-input control with label "Set date 0 Timezone":
  3. Press the corresponding "Apply" button
  4. Grab any ui5-date-picker component element from the DOM and execute in the console:
    $0.getFormat().parse("Jan 1, 2019")

Expected Behavior

A JS date object should be successfully generated by the parse method. Instead the parse method
returns null.

Isolated Example

Use the test page, which is relevant to the particular test: http://localhost:8080/test-resources/pages/DatePicker_test_page.html

Context

  • UI5 Web Components version: latest
  • OS/Platform: windows
  • Browser: Chrome
  • Affected component: ui5-date-picker

Best Regards,
Boyan

@a-z-ivanov
Copy link
Contributor

The DateFormat's parse method wasn't expected to call getDate on the already correctly parsed JS Date :( However the result is declared invalid and replaced with null when the day does not match the one from the string. As we do not have a way to mock the JS Date, I suggest to delete the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug in the code Medium Prio TOPIC B
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

2 participants