$(function () {
var myDate = new Date();
var y = myDate.getFullYear();
var m = myDate.getMonth();
var d = myDate.getDate();
var h = myDate.getHours();
var f = myDate.getMinutes()+150;
if(h>23){
d = d+1;
}
if(h < 6){
h = 6;
f = 30 + 150;
}
var newjavascript={
plugdatetime:function ($dateTxt,type) {
//var curr = new Date().getFullYear();
var opt = {}
opt.time = {preset : type};
opt.date = {preset : type};
opt.datetime = {
preset : type,
minDate: new Date(y,m,d,h,f),
maxDate: new Date(y,m,d+1,19,00),
stepMinute: 15
};
$dateTxt.val('').scroller('destroy').scroller($.extend(opt[type], {
theme: "android-ics light",
mode: "scroller",
display: "bottom",
lang: "zh",
yearText: "年",
monthText: "月",
dayText: "日",
hourText: "时",
minuteText: "分",
timeWheels: 'HHii',//24小时
timeFormat: 'HH:ii',
setText: '确定',
cancelText: '取消',
dateFormat: 'yy-mm-dd',
onClose:function(textVale,inst){ //插件效果退出时执行 inst:表示点击的状态反馈:set/cancel
var nowTime = textVale.substring(11,textVale.length);
var nows = nowTime.split(":");
var nowH = parseInt(nows[0]);
var nowF = parseInt(nows[1]);
if(nowH >= 0 && nowH<6){
alert("请选择0点到6点30之外的时间。");
//想在此处把input中的时间改成另外一个时间值
}else if(nowH == 6){
if(nowF<30){
alert("请选择0点到6点30之外的时间。");
相关分类