RobinHerbots / RobinHerbots/Inputmask
Treat 24:00 as an equivalent of 00:00
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 2.1k
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 1
Description
We have users entering punch in / punch out times into a timesheet and we use this great inputmask library with a basic 'h:s' mask.
Users can enter in/out times like '08:30' - '17:00', which works great.
When the user works a night shift and started working before midnight and finishes after midnight he enters time like so '23:00' - '06:00' (for example Monday night 23:00 until Tuesday morning 06:00)
In cases where we don't allow time entry that passes into the next day we currently set the 'punch out' time to '00:00', signifying the user can only enter time until midnight. So '23:00' - '06:00' gets truncated to '23:00' - '00:00'. (Some customers' back-end systems don't allow timespans across multiple days)
We would like to truncate to '24:00' so it becomes clear to the user they entered a valid punch out time but the system doesn't allow more than 24:00 hours.
If i simply set the input field value like this j$(element).val('24:00') the input field value becomes '20:0_' instead of '24:00'.
I understand 24:00 is not exactly a valid moment in time but for a nicer user experience it would be great to allow this input and treat it as '00:00'
Thanks for reading this far, can't wait to get some thoughts on this.
Regards,
Leon
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the basic h:s time mask and reproduce setting the field to 24:00, which currently becomes 20:0_. The work is done when 24:00 is accepted and treated as equivalent to 00:00 while preserving the requested user-facing value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100