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

valueAsTemporal: date/time input integration with JavaScript Temporal API #10882

Open
o-t-w opened this issue Dec 22, 2024 · 0 comments
Open
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@o-t-w
Copy link

o-t-w commented Dec 22, 2024

What problem are you trying to solve?

Now that Temporal is on its way to stage 4, it might be worth considering how <input type="date">, <input type="time">, <input type="week">, <input type="month"> could integrate with this API.

What solutions exist today?

Getting the value of a date input with valueAsDate returns a Date object. The value of a date input can be set by providing a Date object to valueAsDate. Converting between a Date object and Temporal is possible but not ideal. Alternatively you have to work with string values.

How would you solve it?

Previous discussion: tc39/proposal-temporal#107 Below is the strawman from that thread updated with the current syntax (the Civil prefix has been changed to Plain).

Add a valueAsTemporal getter/setter to HTMLInputElement
<input type=date> accepts/returns PlainDate
<input type=time> accepts/returns PlainTime
<input type=datetime-local> accepts/returns PlainDateTime
<input type=month> accepts/returns PlainYearMonth

Alternatively, separate valueAsPlainDate, valueAsPlainTime, valueAsPlainDateTime, valueAsPlainYearMonth.

@o-t-w o-t-w added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Dec 22, 2024
@o-t-w o-t-w changed the title date/time input integration with JavaScript Temporal API valueAsTemporal: date/time input integration with JavaScript Temporal API Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

1 participant