datetimepicker
datetimepicker copied to clipboard
Selects 1 Hour Before
When opening up the selection for date / time it will be 1 hour wrong. Look below at screenshots to see :
<input type="text" id="start_date_time" name="start_date_time" class="datetimepicker required" value="{{ $meeting->start_date_time->format('m/d/y g:i A') }}" />
<input type="text" name="end_time" class="timepicker required" value="{{ $meeting->end_time->format('g:i A') }}" />
// Date and Time Picker
$('.datetimepicker').datetimepicker({
format: 'm/d/y g:i A',
formatTime: 'g:i A',
step: 30,
startDate: $('input[name="date_start"]').val(),
minDate: $('input[name="date_min"]').val(),
maxDate: $('input[name="date_max"]').val()
});
Same here. Seems to be broken when using 12 hour times with AM/PM. I found that v2.4.5 is the last version that works with my setup (2.4.6 results in JS errors, 2.4.7+ subtracts an hour).
I format the time using ruby
datetime = datetime.strftime('%Y-%m-%d %l:%M %p').squeeze(' ')
setup
$('#post_published_at').datetimepicker
format: 'Y-m-d g:i A'
formatTime: 'g:i A'
scrollMonth: false
@xdan I use v2.5.4 ,this issue is still there , when I changed time to 24 hour formate , it worked well. Following is my code:
book.date_time_picker_end = (tomorrow.getMonth() + 1) + '/' + tomorrow.getDate() + '/' + tomorrow.getFullYear() + ' ' + "01:00 PM";
$('#date_time_picker_end').datetimepicker({
value: (tomorrow.getMonth() + 1) + '/' + tomorrow.getDate() + '/' + tomorrow.getFullYear() + ' ' + "01:00 PM",
step: 10,
minDate: ' date.getFullYear()+' / '+(date.getMonth()+1)+' / '+date.getDate() ',
format: 'm/d/Y h:i A',
formatTime: 'h:i A',
onChangeDateTime: function (dp, $input) {
var endTimeNow = book.date_time_picker_end;
var startTime = parseInt(new Date(book.date_time_picker_start).valueOf() + "");
var endTime = parseInt(new Date(dp).valueOf() + "");
console.log("end time ip is v",$input);
console.log("end time ip is t",new Date($input.val()).valueOf()+"");
console.log("end time dp is v",dp);
console.log("end time dp is t",new Date(dp).valueOf()+"");
console.log("end time et is v",book.date_time_picker_end);
console.log("end time et is t",new Date(book.date_time_picker_end).valueOf()+"");
if (endTime <= startTime) {
MessageBox.toast("End time must be later than appointment time");
// book.date_time_picker_end = endTimeNow;
$('#date_time_picker_end').val(endTimeNow);
} else {
book.date_time_picker_end = $input.val();
}
}
});
I have the same problem!
It is with specifies the format property: "d/m/Y g:i A"
Any solution for this?
Thanks in advance!
I believe the issue is with php-date-formatter.js version 1.3.3 in the method parseDate.
Try replacing this:
case 'g': case 'h': vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') : (vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1; mer = vDateParts[vMeriIndex]; if (vMeriIndex > -1) { vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 : (_compare(mer, vSettings.meridiem[1]) ? 12 : -1); if (iDatePart >= 1 && iDatePart -1) { out.hour = iDatePart + vMeriOffset - 1; } else if (iDatePart >= 0 && iDatePart = 0 && iDatePartwith this:
case 'g': case 'h': vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') : (vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1; mer = vDateParts[vMeriIndex]; if (vMeriIndex > -1) { vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 : (_compare(mer, vSettings.meridiem[1]) ? 12 : -1); if (iDatePart == 12 && vMeriOffset == 0) { out.hour = 0; } else if (iDatePart == 12 && vMeriOffset == 12) { out.hour = 12; } else if (iDatePart >= 1 && iDatePart -1) { out.hour = iDatePart + vMeriOffset; } else if (iDatePart >= 0 && iDatePart = 0 && iDatePart
The solution is use a recent version of php-date-formatter, like 1.3.4.
As I'm using https://github.com/shekibobo/xdan-datetimepicker-rails that comes with a .full
version, which embeds php-date-formatter
inside xdan-datetimepicker
. I had to ignore the .full
version and load the "not full version" + php-date-formatter.js 1.3.4 + jQuery Mousewheel.
I'm also seeing this issue, is there any timeline on when it will be addressed?
Same as #596
I have the same kind of problem, but the "opposite" : I have one hour less into the input than on the timepicker list, when the input is initially blank. I use 24h format for time.
Maybe a problem about dealing with timezones (GMT+1 for me) ?
(Using version 2.5.4)
I see this problem on version 2.5.20 using php-date-formatter 1.3.4.
I am also seeing this issue using 2.5.20
Still facing the same issue. Let us know if anybody found a solution to this
The solution quoted on Dec 7, 2016 still works for us.
apply this option, It is working fine validateOnBlur: false
@gems-deepak validateOnBlur: false is not working in my case:
$('#appointmentSidebarDatetimeControl').datetimepicker({ step: 20, format: 'd-m-Y h:i A', formatTime: 'h:i A', formatDate: 'd-m-Y', validateOnBlur: false, });
Hi, I have an equal problem with the DATE. I set the timezone to EUROPE/AMSTERDAM. I want the passed minutes between to given times. Next example: $begin = strtotime("12:00"); $end = strtotime("13:23"); $laptime = $end - $begin; echo date('H:i:s', $laptime); result is 02:23 !! When i don't set the timezone the result s 01:23 (as aspected).
Whit the timezone set to EUROPE/AMSTERAM the result of echo date('H:i:s', 0) is 01:00