DatePicker: dateStyleClasses shifts to wrong date
See original GitHub issueDescribe the defect When added metadata with some styles, the styles is applied to wrong date: shifts +/- one day.
Environment:
- PF Version: 10.0
- Time zone in browser is UTC+06:00
To Reproduce Steps to reproduce the behavior:
- Set time zone on you PC to UTC+06:00
- After 18:00 styles is shifts on next day
Solution Function toISODateString() in datepicker.js now is:
toISODateString: function (b) {
return b.toISOString().substring(0, 10)
}
must be:
toISODateString: function (b) {
return new Date(b.getTime() - (b.getTimezoneOffset() * 60000)).toISOString().substring(0, 10)
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Material UI DatePicker Showing Wrong Date - Stack Overflow
I've faced the same problem. After all, I added a parseISO method on my date, you need to specify the timezone of the...
Read more >[DatePicker] date select on right calendar shifts to left #2471
I'm going to mark this issue as an enhancement to provide the ability to configure this behavior since we now want the position...
Read more >Solved: Date picker sends wrong date and wrong format
I have created two forms in PowerApps, that sends a selected date to an excel file. Settings in PowerApps: Default date: Today(). Date...
Read more >PickerOptions | PrimeFaces JavaScript API Docs
Whether the date picker overlay is shown when the element focused. showOtherMonths. showOtherMonths: boolean. Displays days belonging to other months.
Read more >SwiftUI Date Picker is Problematic | Apple Developer Forums
The date format is getting changed with specific dates and not everytime i select a new one. BUT, I found a workaround. You...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If someone needs this MonkeyPatch now just apply this to your application JS.
Propably not covered by integration tests.
toISODateString
is currently only called fromrenderDateCellContent
during evaluation ofthis.options.dateStyleClasses
. So we at least should not break other functionally. And dateStyleClasses is only populated via dateMetadata introduced with PF 10. (Think we have no integration tests for dateMetadata.)