Feature add mask for work hours field in reports form#345
Conversation
DurationFieldForm and unit test for it
kbeker
left a comment
There was a problem hiding this comment.
All OK, just please answer for question
employees/forms.py
Outdated
|
|
||
| class DurationFieldForm(forms.DurationField): | ||
| widget = DurationInput | ||
| widget = DurationInput(attrs={"data-mask": "99:99", "placeholder": "H:MM"}) |
There was a problem hiding this comment.
What does it mean that this field has 99:99 mask?
There was a problem hiding this comment.
https://dobsondev.com/2017/04/14/using-jquery-mask-to-mask-form-input/
- ‘0’: {pattern: /\d/}
- ‘9’: {pattern: /\d/, optional: true}
There was a problem hiding this comment.
So shouldn't it be 90:00? Which means that you should have at least one digit before : and two after. This way you can type in values like 12:00, 8:00 and 0:30. Or maybe I have misunderstood this completely.
There was a problem hiding this comment.
quite frankly, it must be 09:99 (checked empirically;)).
rwrzesien
left a comment
There was a problem hiding this comment.
Looks good, I am a little bit curious about having two version of jquery and jquery-ui. Maybe removing older one can avoid unexpected issues.
c594034 to
faf4795
Compare
2204cd3 to
4911733
Compare
resolves: #315