A week after timepicker version 1.0.2 was released, I am releasing 1.0.3. This comes after I noticed a couple issues with changes in 1.0.2. Also I had already been working on refreshing the documentation, so I figured there was no better time than now to push that out as well. So what changed?
- Documentation refresh
- Code reduction by becoming a bit more DRY
- Fix date parsing bug
- Fix timepicker() requiring at least an empty options object
- Fix conflict with Mootools slider
- Fix bug preventing minify
As you see not a lot as far as timepicker changes, just a couple bug fixes, but the documentation should be much more robust. Enjoy!


20 Responses
Scott Benton
Sep 18, 2012First of all, thanks so much for this really nice piece of code. It’s fantastic. However, I’m having an issue with the date time picker handling existing data in the input field.
I’ve got a simple date field, initialized with the following:
$j(‘#start-date’).datetimepicker({ampm:true,dateFormat:”yy-mm-dd”,stepMinute:15});
The field is pre-populated from a database with the following (as an example):
2012-09-22 08:00 am
I was using the 1.0.2 version until this morning, and the TimePIcker UI was not picking up the time, but the DatePicker was displaying the date correctly, and didn’t update the input field unless I clicked something in the DateTimePicker UI.
I have updated to 1.0.3, and in the same scenario, the TimePicker part of the UI is updating to reflect the data in the input field. However, the DatePicker UI is resetting to todays date, rather than the date in my input field, even if I don’t click anything in the UI. So if I just click on the field, and then click “Done” in the date time picker, it’s leaving the time as-is, but changing the date to todays date.
I’m going to play around with this and see what I can come up with, but thought you should know. Thanks again!
trent
Sep 18, 2012I may have fixed this earlier in the dev branch on github. Try that out if you can before spending too much time
Freeland
Sep 21, 2012Hi
I am using your created timepicker in one project. It is very useful plugin. But I missed one feature. Is it possible to selet multiply dates & times lika a multidatepicker does? If this feature wre in your time picker it would be absolutly amazing plugin. I tryed to do it by my self but looks like my JQuery knowledges are to weak :). Thanks for support
trent
Sep 23, 2012From the feature you explain I don’t believe timepicker can do this.
Ed Med
Sep 25, 2012Hi,
I had been using version 0.9.6, but now I wanted to upgrade to 1.0.3, but this version is buggy.
I have form inputs with date, time and datetime combinations.
I have an date input field which has value “30.11.2011″, but when i click on the input, the current date is selected. JS is $(‘input.date’).datepicker({ dateFormat: ‘dd.mm.yy’ });
This should work, what is the problem?
trent
Sep 25, 2012Give the dev branch on Github a try, I believe this bug has been fixed there.
Sergey
Sep 26, 2012I’m using timepicker plugin but I’m using two different fields (datepicker and timepicker) on the same page.
The problem is that splitDateTime(“dd/mm/yy”, “05/06/07″) returns ["", "05/06/07"] when it is called as $.datepicker.parseDate(“dd/mm/yy”, “05/06/07″)
Sergey
Sep 26, 2012Also on line 1580 (version of timepicker is 1.0.3)
if (err.indexOf(“:”) >= 0) {
but err can be an object sometime so an exception is raised. I’ve hacked it with the .toString() but anyway…
Andrew
Sep 26, 2012Hey, great job on the library, it looks fantastic. I’ve just downloaded 1.0.3 and any time I try to set the max date on an existing control it gets totally buggered up.
I’ve tried:
$(this.fieldselector).datetimepicker(“option”, “maxDateTime”, new Date());
$(this.fieldselector).datetimepicker(“option”, “maxDateTime”, new Date(Date.now));
$(this.fieldselector).datetimepicker(“option”, “maxDate”, new Date());
$(this.fieldselector).datetimepicker(“option”, “maxDate”, new Date(Date.now));
$(this.fieldselector).datetimepicker(“option”, “maxDate”, “+0d”);
In all cases, future date are not being disabled and my control is lossing the time value (goes back to 00:00). Also, this is my first time using the library so I don’t know if this behaviour existed in any previous release or if I’m just using the option correctly…
Any ideas?
Andrew
Sep 26, 2012Nevermind, got it working but using the latest version of jquery with $(this.fieldselector).datetimepicker(“option”, “maxDate”, new Date());
Using maxDateTime still does nto work but since maxDate works all is good.
Krish
Sep 26, 2012Scott Benton & Ed Med mention the problem with timepicker setting the value to the current date.
I am seeing the same problem with both 1.0.1, 1.0.3 & on 1.0.3-10 (the dev branch). After looking at the problem a bit what I notice is that if I initialize the form input with the local time eg “27/09/2012 08:00 pm +1000″ then timepicker will pick it up fine but if I initialize the input with the equivalent UTC value “27/09/2012 10:00 am +0000″ then it chokes and sets it to current time.
Trent, is this a bug? can we initialize with UTC or do you expect the app to initialize it with a specific timezone?
I hope this can be fixed soon. Its a bit of deal breaker because it would be quite complex to always initialize with the local time because my application and database is always working with UTC. Its going to be pretty complex to always initialize with local time.
trent
Sep 27, 2012Sounds like it could be a bug, yes. It should parse what ever is passed in the input on page load. So if you are prepopulating the input with “27/09/2012 10:00 am +0000″ it should see your timezone. There must be something happening with that.
Just double checking, you are using “z” in your timeformat? and showTimezone: true?
Krish
Sep 27, 2012Here is the js function I use.
function addDateTimePicker(inputElement, minimumDate, maximumDate){
inputElement.datetimepicker({
addSliderAccess: true,
sliderAccessArgs: { touchonly: false },
showTimezone: true,
minDate : minimumDate,
maxDate : maximumDate,
ampm: true,
stepMinute: 5,
dateFormat : ‘dd/mm/yy’,
timeFormat: ‘hh:mm tt z’,
timezoneText: ‘Zone’,
timezone: ‘+1000′,
timezoneList: [
{"value": "+1000", "label": "AEST"},
{"value": "+1100", "label": "AEDT"}
],
separator: ‘ ‘
});
}
Krish
Sep 27, 2012oops sorry
function addDateTimePicker(inputElement, minimumDate, maximumDate){
inputElement.datetimepicker({
addSliderAccess: true,
sliderAccessArgs: { touchonly: false },
showTimezone: true,
minDate : minimumDate,
maxDate : maximumDate,
ampm: true,
stepMinute: 5,
dateFormat : 'dd/mm/yy',
timeFormat: 'hh:mm tt z',
timezoneText: 'Zone',
timezone: '+1000',
timezoneList: [
{"value": "+1000", "label": "AEST"},
{"value": "+1100", "label": "AEDT"}
],
separator: ' '
});
}
Tung Hock
Sep 28, 2012I am using datepicker and your datetimepicker concurrently, right now having problem to retrieve date from datepicker(“getDate”), it always return today’s date.
trent
Sep 28, 2012Tung Hock, grab the dev branch, it is fixed there I’m pretty sure.
Joao
Sep 29, 2012Found a bug
in you example page in section: “Set the min/max date and time with a Date object”
The month displayed is OFF 1+ month.
$('#rest_example_3').datetimepicker({
minDate: new Date(2010, 11, 20, 8, 30),
maxDate: new Date(2010, 11, 31, 17, 30)
});
It show DECEMBER but it should be November.
trent
Sep 29, 2012Hey Joao, not a bug, in javascript the month in the Date object is 0 based, so 0 = January, 11 = December. Don’t know why, but we play the cards we’re dealt.
Joao
Sep 29, 2012Thanks trent for the reply. I am kinda new to the javascript world and that starting with zero is really odd lol
João Marcelo
Oct 05, 2012Hello, I would like to know how to hide the time if not selected by the user.