Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing widget for durations #47

Open
LeaVerou opened this issue May 29, 2016 · 2 comments
Open

Editing widget for durations #47

LeaVerou opened this issue May 29, 2016 · 2 comments

Comments

@LeaVerou
Copy link
Member

If a <time>'s datetime attribute is a duration, an appropriate editing widget needs to be used. Currently, it will incorrectly be a date input.

@LeaVerou LeaVerou added enhancement Effort: low Easy to address issues, ideal for first time contributors! labels Jun 17, 2018
@parulsingh23
Copy link
Contributor

parulsingh23 commented Aug 24, 2020

In elements.js, I'm testing duration as a dateType with the regular expression as /^PT[\d]{1}H/i and using <time datetime="PT2H"/>. However, the input type is still identified as "date" rather than "duration", and I was unsure as to why seeing that date's regular expression is /^[Y\d]{4}-[M\d]{2}-[D\d]{2}$/i. My understanding is that the input type is set only by checking against the dateTypes set, but let me know if there is an additional place I need to look. Thanks!

@LeaVerou
Copy link
Member Author

Hi Parul,

Firstly, you can simplify the regex to /^PT\dH/i ({1} is implied, and [\d] is the same as \d). Furthermore, you can probably simplify it further to /^PT/`, since no date format starts with PT (and assuming it starts with hours, and a 0-9 number of hours at that, will make you lose some).

Apart from that, indeed it should be recognized with the test string you give. I wonder if something more significant is at play, like a failing build or running off remote Mavo or something like that?

@LeaVerou LeaVerou removed the Effort: low Easy to address issues, ideal for first time contributors! label Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants