Skip to content

Conversation

@kb-
Copy link

@kb- kb- commented May 12, 2018

I changed getDateString to a method, to be able to use it within the readValue option function, to format dates. It enables to set a default time different from the current time.

kb- added 2 commits May 12, 2018 01:24
Enables to customize the initial time by setting it in "readValue", in
the options.
readValue: function(element) {
if (!element.value /* && element.getAttribute('data-type') === 'time'
*/) { // initial time if empty
var d = new Date();
d.setHours(0, 0, 0);   // Set hours, minutes and seconds
return this.getDateString(d,true).replace(/:00$/,'');//today's date
string, 00:00 time
// return new Date().toTimeString().split(' ')[0]; // triggers default
behavior
}
return element.value; // triggers default behavior
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant