Editor datetime field, set picker value
Editor datetime field, set picker value
When using a datetime
field in Editor, I often find it would be useful to set the initial value/month in the datetime picker UI when the user first clicks the field to edit it (I'm trying to set the picker's value, NOT the field value)
Example use case:
I have a "Last Contacted" date field that typically gets updated by the user every few months. When the user updates this, they are usually going to enter today's date. But when they click the field, the date picker opens to the current value, which is usually several months ago. So they have to click next several times to get to today.
I know there is a "Today" button that will take them to today in the picker UI (I've implemented that) but I would love to automatically set the picker to today without the need to click a button.
I have other use cases where it would be useful to set the picker's initial value when it is opened; is there any way to do this?
It seems like I might be able to do it with DateTime.val(), but I don't see any way to get the DateTime API instance that is being used by the editor field.
This question has accepted answers - jump to:
Answers
Hi,
There is no way to do that at the moment I'm afraid. An API to control what year / month is shown by the picker might be nice - I've added a feature request for that.
There is no way to have a separate value for the date picker and the Editor field though, that would never work (same applies to the
DateTime.val()
method - it will match the input elements value).Allan
@allan Thanks for the clarification on the relationship between the picker value and the Editor field. Yes, an API to control the year/month shown would be nice; thanks for adding that as a feature request.
Hi,
I've just committed the change to add this feature. We need to add unit tests before it is fully released, but it seems good in what testing I've done. This is the commit if you are interested and want to use it just now.
Allan
@allan Thanks!