jonthornton / Datepair.js

A javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar.
https://www.jonthornton.com/Datepair.js
359 stars 85 forks source link

feature request: updateDateTime #21

Closed espen closed 10 years ago

espen commented 10 years ago

I have a hidden field for that stores the complete datetime (as my API currently only takes one field). I want to update this field with date and time value. Not sure how common this is but it would be really nice to have a function that is called only when either date/time is changed. If both date and time is set and validated then return datetime, otherwise (if both or any of the date/time fields are empt/invalid) return nil.

jonthornton commented 10 years ago

I think the rangeSelected event is what you're looking for.

espen commented 10 years ago

Indeed. Great. Thanks for a useful plugin and the quick response.

espen commented 10 years ago

I will set up a demo with this issue later but perhaps before I do that know if there is any issues with the rangeSelected event and hidden fields ? I have to manually do a refresh on rangeIncomplete to be able to trigger rangeSelected.

I basically want to use just one date/time and then get the value when both fields are filled in properly.

https://gist.github.com/espen/10bb2031f7480745eefe

jonthornton commented 10 years ago

Could you throw this into a jsFiddle so I can see a working version?