Automattic / Automattic/jetpack
Business Hour Block: Time validations are missing.
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Steps to reproduce the behavior
1. Go to 'My site > Page/Post > Add new page/post'
2. Add the block 'Business Hours'
3. Select the same value in the opening and closing time.
* What I expected to happen
It should show a validation to change the closing time to be different
* What actually happened
It let the user enter the same value for opening and closing hours.
Screenshot

4. Opening time is 1 pm and closing 9 am
* What I expected to happen
It should show some message that closing time falls on the next day
* What actually happened
It lets the user enter without any message or warning.
Screenshot

5. Add multiple slots with similar opening hours.
* What I expected to happen
Multiple slots with the same opening hours shouldn't show up and it can be validated.
* What actually happened
Multiple slots with the same opening hours show up.
Screenshot

6. Add multiple slots, on the last slot leave the opening hour blank and enter a time on the closing hour.
* What I expected to happen
There shouldn't be any comma before the hidden slot.
* What actually happened
There's a comma after the second slot on Monday because the opening time is blank on the last slot.
Screenshot

7. Enter any special character in the time input boxes.
* What I expected to happen
The input box should validate the characters entered.
* What actually happened
It lets the user add any character.
Screenshot

### Context
#### Browser / OS version
Safari/Mac OS Big Sur 11.2.3
#### Is this specific to the applied theme? Which one?
No
#### Does this happen on simple or atomic sites or both?
Both
#### Is there any console output or error text?
No
#### Level of impact (Does it block purchases? Does it affect more than just one site?)
No
#### Reproducibility (Consistent, Intermittent) Leave empty for consistent.
#### Screenshot / Video: If applicable, add screenshots to help explain your problem.
Contributor guide
Research direction
Start by reproducing the reported cases in the Business Hours block: equal times, overnight hours, duplicate slots, blank openings, and special characters. Review the block's time-input and slot-validation entry points, then verify that each invalid case shows the expected validation or formatting behavior without introducing the reported comma.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100