你的浏览器不支持canvas

js

$('.form_datetime').datetimepicker({
//language: 'fr',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 0,
showMeridian: 1,
format: 'yyyy-mm-dd hh:ii:ss'
});
$('.form_datetime').datetimepicker().on('changeData', function () {
console.log($('#dtp_input1').val())
$('.form_date').datetimepicker('setStartDate', '2020-11-12 12:13:50')
})
$('.form_date').datetimepicker({
language: 'fr',
format: 'yyyy-mm-dd hh:ii:ss',
startDate: '2019-06-20 20:45:14',
// weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
minView: 2,
forceParse: 0
});
var zoneObj = {
'IN': 7,
'ID': 5.5,
'TH': 7,
'VN': 7,
'MY': 8,
'PH': 8,
'TW': 8
}
Date.prototype.format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[
k])
.length)));
}
}
return fmt;
}

function getServerDate() {
return new Date($.ajax({
async: false
}).getResponseHeader("Date"));
}

function getLocalTime(i) {
if (typeof i !== "number") {
return new Date();
}
var d = getServerDate();
var len = d.getTime();
var offset = d.getTimezoneOffset() * 60000;
var utcTime = len + offset;
return new Date(utcTime + 3600000 * i);
}

function eachAreaTime(Tzone) {
var timezone = Tzone; // 时区 : 东区时区1~12 西区时区-1~-12
var date, localTime;
date = getLocalTime(timezone).toString().split("GMT+")[0].toString();
localTime = new Date(date).format("yyyy-MM-dd hh:mm:ss");
return localTime;
}
console.log(eachAreaTime(7),eachAreaTime(8),eachAreaTime(5.5))
$('.countcheck').change(function () {
var ct = $(this).attr("bindname");
if ($(this).prop("checked") == true) {
var times =eachAreaTime(zoneObj[ct]);
$('.config' + ct).show();
if ($(this).val() == "all") {
$('.countcheck').prop("checked", true);
$('.config').hide();
$('.configall').show();
}
$('.config'+ct).find('.form_datetime').datetimepicker('setStartDate',times)
// $('.form_date').datetimepicker('setStartDate', '2020-11-12 12:13:50')
 
} else {
var ct = $(this).attr("bindname")
if ($(this).val() == "all") {
$('.countcheck').prop("checked", "")
$('.config').hide();
$('.configall').hide();
} else {
$('input[value="all"]').prop("checked", "")
$('.configall').hide();
$('.config' + ct).hide();
}
}
// debugger;
})
posted @ 2019-06-03 23:59  云上丶无忧  阅读(210)  评论(0编辑  收藏  举报

来场流星雨,吧