Set Timezone for my datepicker in javascript - javascript

Here is my javascript for my datepicker, however it grabs the current timezone, i wan't it to always grab EST time. How would i achieve this?
function initdatetime() {
if ($('.dattim').length > 0) {
$('.dattim').datetimepicker({
format: 'd MM yyyy h:i:ss',
autoclose: true,
todayBtn: true,
showMeridian: true
});
}
}

Related

how to disable previous dates in calender in php?

$('#eventDate-container .input-group.date').datepicker({
weekStart: 1, // calendar starts on Monday
autoclose: true,
todayHighlight: true,
startDate: "4/10/2017", // disables all dates prior to this date
datesDisabled: ['01/01/1970', '12/31/2099'] // placeholder sample for possible future use
});
first i think that what you need is a "jquery" code not in "PHP"
, you can disable previous dates from jquery datepicker by using minDate: option
like :
var tardate = new Date("4/10/2017");
$("#eventDate-container").datepicker({
weekStart: 1, // calendar starts on Monday
autoclose: true,
todayHighlight: true,
minDate: tardate,
});
here's jsfiddle link

foundation datepicker datesdisabled

I am trying to disable holidays in my calendar but can't seem to pass the right format to the datesdisabled option.
I have
$('#booking').fdatepicker({
var now = new Date();
$('#booking').fdatepicker({
format: 'dd MM yyyy',
startDate: now,
daysOfWeekDisabled: [0, 4, 5],
datesDisabled:['2018-02-13']
});
})
What am I missing?
Use it this way, as it doesn't support the way you are using it. Also, it doesn't support time, just date.
$(function(){
$('#dpt').fdatepicker({
initialDate: new Date(),
format: 'yyyy-mm-dd hh:ii',
disableDblClickSelection: true,
language: 'es',
pickTime: true,
datesDisabled:['2018-01-15']
});
});

DateRangePicker - autoUpdateInput:false, autoapply:true not working

I used daterangepicker for my application.
Below code works fine as expected.on load it picks today date and displays. But, i need to show only 'placeholder' value. Not date.
When i use autoUpdateInput : false, it shows 'placeholder' value onload. But, after dates are picked, selected date values are not getting inserted.
Is it possible to do autoUpdateInput: false and autoApply: true make work as expected for my application?
Thanks
JS:
$('input[name="Two way"]').daterangepicker({
"autoApply": true,
"minDate": today,
"locale": {
format: 'DD MMM YYYY'
}
});
You can use function(start,end) {} for this.
Look at this:
$('#start_date').daterangepicker({
"showDropdowns": true,
"autoApply": true,
locale: {
format: 'DD/MM/YYYY'
},autoclose: true,
"alwaysShowCalendars": true,
"startDate": '<%= start_date %>',
"endDate": '<%= end_date %>'
}, function(start, end) {
$("#start_date_input").val(start.format('DD/MM/YYYY'));
$("#end_date_input").val(end.format('DD/MM/YYYY'));
Materialize.updateTextFields();
}
);
$('#start_date').on("change", function(){
console.log("changes");
});
Answer of 3rd point-
Yes it is possible to use autoApply=true & autoUpdateInput=false both at same time.
for this you just need to put autoApply parameter before autoUpdateInput
Look at this:
$('input[name="Two way"]').daterangepicker({
autoApply: true,
autoUpdateInput: false,
minDate: today,
locale: {
format: 'DD MMM YYYY'
}
});

How to disable date before today in datetimepicker bootstrap?

Demo and full code is like this : http://fiddle.jshell.net/oscar11/dgb09c5c/5/
My Javascript code is like this :
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd hh:ii:ss',
autoclose: true,
pickerPosition: "bottom-left",
maxView: 3,
minuteStep: 1,
minDate: new Date()
})
How to disable date before today?
I add minDate: new Date(), but it's not working
Any solution to solve my problem?
From Bootstrap datetime picker documentation
$.fn.datetimepicker.defaults = {
maskInput: true, // disables the text input mask
pickDate: true, // disables the date picker
pickTime: true, // disables de time picker
pick12HourFormat: false, // enables the 12-hour format time picker
pickSeconds: true, // disables seconds in the time picker
startDate: -Infinity, // set a minimum date
endDate: Infinity // set a maximum date
};
I modified your Fiddle. Is it what you are looking for? http://fiddle.jshell.net/dgb09c5c/6/

change format bootstrap-datepicker in same input text doesn´t work

I've had some issues in my website...
when I change my radioButton, I wanna set my bootstrap-datepicker format to 'dd/MM/yyyy' or 'MM/yyyy' using just one input text field, but it doesn't work, someone can help me?
This is my javascript function below
function setDatePicker(value) {
if (value === "D") {
LimparCampo('date1');
$('#datetimepicker1, #datetimepicker2').datepicker({
language: 'pt-BR',
format: 'dd/mm/yyyy',
autoclose: true,
todayHighlight: true,
todayBtn: true
});
}
else {
LimparCampo('date1');
$('#datetimepicker1, #datetimepicker2').datepicker({
language: 'pt-BR',
format: 'mm/yyyy',
autoclose: true,
todayHighlight: true,
todayBtn: true
});
}
}
I´ve found the solution
I just use $('#datetimepicker1, #datetimepicker2').datepicker('remove');
Cya ^^

Categories