#42373 closed defect (bug) (fixed)
Customizer: Can't Schedule 0:00 - 0:59 when 24-hour clock setting
Reported by: | atachibana | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Customize | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
In the Customizer of Version 4.9 Beta 4, I can't specify between 0:00 - 0:59 for Schedule when settings is 24-hour clock.
Reproduce Step
Preparation
- Administration Screen -> Settings -> General
- Select 12:xx / 'H:i' (3rd option) at Time Format
- Click Save Changes
Customizer
- Start Customizer
- Click Settings
- Select Schedule
- Input '0' at hour field in Time.
Then 'Invalid hour' is displayed and can't specify it.
Attachments (8)
Change History (27)
#2
@
7 years ago
@westonruter
Looks like this can easily get patched changing L.145 in
class-wp-customize-date-time-control.php to
<input id="{{ idPrefix }}date-time-hour" type="number" size="2" autocomplete="off" class="date-input hour" data-component="hour" min="0" max="{{ maxHour-1 }}">
#3
@
7 years ago
- Milestone changed from Awaiting Review to 4.9
- Owner set to westonruter
- Status changed from new to accepted
#5
@
7 years ago
@Presskopp @westonruter
I tested the patch.
For 24-hour clock, it is OK.
But even 12-hour clock, '0' have to be specified instead of '12'. For example, '0:30 AM' for 30 min past midnight.
I'm not familiar with 12-hour clock in US/EU, but it won't be acceptable...
#6
@
7 years ago
Uh, yes, maybe not in the most elegant way, but I changed the patch and it should be fixing it now
#7
@
7 years ago
@Presskopp Thank you for the fix!
I tested below cases and could conduct all successfully.
T/C 01 : 24-hour clock
1) 0:0
2) 0:59
3) 23:59
4) 24:00 - should be error 'Invalid hour'
T/C 02 - 12-hour clock
1) 0:00 -> If you type '0', then automatically converted to '12'. It is good.
2) 12:00
3) 12:59
4) 13:00 - should be error 'Invalid hour'
#8
@
7 years ago
I found some additional issues with date time control.
- Min/max could be simplified, as @peterwilsoncc patched in 42373.3.diff.
- Setting validity message was not properly translatable.
- Emptying an input or giving it an invalid value would not trigger an error to keep the customizer from saving (silently accepted).
- Zero-padding was getting in the way of user input.
I don't really see the need for updateMinutesForHour
. The max
for minutes can be just always 59. I don't think we need to worry about supporting 24:00
.
#9
@
7 years ago
42373.5.diff also removed updateMinutesForHour
.
@atachibana @Presskopp Would you please review and test this?
#10
@
7 years ago
@westonruter ran some manual tests:
- Date to November 31
- Browser shows warning on day box
- Invalid date warning notification shows
- Schedule button blocks saving
- Change month to October (ie schedule for October 31)
- Browser warning disappears
- Invalid date notification disappears
- Schedule button works.
- Change month to November
- Day changes to 30
#11
follow-up:
↓ 12
@
7 years ago
@westonruter
Comment #7 test cases were confirmed, except no more automatic conversion for typing '0' to '12'. (and, This is OK).
Also, Leading zero function is beautiful :-)
One confirmation about UI.
Pop up error message such as 'Invalid hour' is shown only when the first error occurred.
Is it as your expectation? If so, then OK.
Step
1) Type '24' in hour field. 'Invalid hour' will be popup and border color be Red.
2) Type '2' in hour field. Border color will be Blue.
3) Type '24' in hour field, again. Border color is Red, but no popup message.
#12
in reply to:
↑ 11
@
7 years ago
Replying to atachibana:
Pop up error message such as 'Invalid hour' is shown only when the first error occurred.
Is it as your expectation? If so, then OK.
Yes, only the first is supposed to be flagged as an error.
Step
1) Type '24' in hour field. 'Invalid hour' will be popup and border color be Red.
2) Type '2' in hour field. Border color will be Blue.
3) Type '24' in hour field, again. Border color is Red, but no popup message.
An error notification should appear if you tab out of the hour field.
#13
@
7 years ago
@westonruter
Thank you for the explanation. I confirmed.
Now, I can schdedule my theme change at midnight :-)
#14
@
7 years ago
- Keywords commit added
I'll commit this in ~10 hours unless someone finds something amiss before then.
#15
@
7 years ago
LGTM!
An enhancement for a future release could be to in/decrement hours and days while looping through minutes/hours.
'Invalid hour' for 0 in 24-hour time (= 12 am in 12-hour time)