Javascript jQuery UI日期范围选择器编号格式

Javascript jQuery UI日期范围选择器编号格式,javascript,jquery,daterangepicker,Javascript,Jquery,Daterangepicker,是否有选项在数字前添加一个“0”和一个字符 ie:1,2,3,4,5,6,7,8,9 成为:01、02、03、04、05、06、07、08、09 工作示例: JavaScript: 工作示例: JavaScript: 工作示例: JavaScript: 工作示例: JavaScript: 一些变通方法可能会有所帮助,请参见下文 function addZero() { setTimeout(function () { $('.ui-state-default').each

是否有选项在数字前添加一个“0”和一个字符

ie:1,2,3,4,5,6,7,8,9

成为:01、02、03、04、05、06、07、08、09

工作示例:

JavaScript: 工作示例:

JavaScript: 工作示例:

JavaScript: 工作示例:

JavaScript:
一些变通方法可能会有所帮助,请参见下文

function addZero() {
    setTimeout(function () {
        $('.ui-state-default').each(function () {
            var t = $(this).text();
            if (t.length == 1) {
                $(this).text('0' + t);
            }
        });
    }, 10);
}
$('#datepicker').datepicker({
    onChangeMonthYear: addZero,
    beforeShow: addZero
});

一些变通方法可能会有所帮助,请参见下文

function addZero() {
    setTimeout(function () {
        $('.ui-state-default').each(function () {
            var t = $(this).text();
            if (t.length == 1) {
                $(this).text('0' + t);
            }
        });
    }, 10);
}
$('#datepicker').datepicker({
    onChangeMonthYear: addZero,
    beforeShow: addZero
});

一些变通方法可能会有所帮助,请参见下文

function addZero() {
    setTimeout(function () {
        $('.ui-state-default').each(function () {
            var t = $(this).text();
            if (t.length == 1) {
                $(this).text('0' + t);
            }
        });
    }, 10);
}
$('#datepicker').datepicker({
    onChangeMonthYear: addZero,
    beforeShow: addZero
});

一些变通方法可能会有所帮助,请参见下文

function addZero() {
    setTimeout(function () {
        $('.ui-state-default').each(function () {
            var t = $(this).text();
            if (t.length == 1) {
                $(this).text('0' + t);
            }
        });
    }, 10);
}
$('#datepicker').datepicker({
    onChangeMonthYear: addZero,
    beforeShow: addZero
});

我认为,
UI-Datepicker
中没有预定义的选项。您应该为此编写自定义代码:

我在Show和onChangeMonthYear事件之前编写了一些示例代码,请尝试以下操作:

$('#picker').datepicker({
    beforeShow: function (txt, inst) {
      setTimeout(function(){
         $("#ui-datepicker-div").find('table tr td[data-handler="selectDay"] > a').each(function(){
             if($(this).text().trim().length < 2){
               $(this).text("0" + $(this).text())
             }
         });            
      }, 100);
    },
    onChangeMonthYear: function (year, month, inst) {
      setTimeout(function(){
         $("#ui-datepicker-div").find('table tr td[data-handler="selectDay"] > a').each(function(){
             if($(this).text().trim().length < 2){
                $(this).text("0" + $(this).text())
             }
         });            
      }, 100);
    }
});
$(“#选取器”).datepicker({
beforeShow:函数(txt、inst){
setTimeout(函数(){
$(“#ui datepicker div”).find('table tr td[data handler=“selectDay”]>a')。每个(函数(){
如果($(this).text().trim().length<2){
$(this.text(“0”+$(this.text())
}
});            
}, 100);
},
onChangeMonthYear:功能(年、月、月){
setTimeout(函数(){
$(“#ui datepicker div”).find('table tr td[data handler=“selectDay”]>a')。每个(函数(){
如果($(this).text().trim().length<2){
$(this.text(“0”+$(this.text())
}
});            
}, 100);
}
});

我认为,
UI日期选择器中没有预定义的选项。您应该为此编写自定义代码:

我在Show
和onChangeMonthYear事件之前编写了一些示例代码,请尝试以下操作:

$('#picker').datepicker({
    beforeShow: function (txt, inst) {
      setTimeout(function(){
         $("#ui-datepicker-div").find('table tr td[data-handler="selectDay"] > a').each(function(){
             if($(this).text().trim().length < 2){
               $(this).text("0" + $(this).text())
             }
         });            
      }, 100);
    },
    onChangeMonthYear: function (year, month, inst) {
      setTimeout(function(){
         $("#ui-datepicker-div").find('table tr td[data-handler="selectDay"] > a').each(function(){
             if($(this).text().trim().length < 2){
                $(this).text("0" + $(this).text())
             }
         });            
      }, 100);
    }
});
$(“#选取器”).datepicker({
beforeShow:函数(txt、inst){
setTimeout(函数(){
$(“#ui datepicker div”).find('table tr td[data handler=“selectDay”]>a')。每个(函数(){
如果($(this).text().trim().length<2){
$(this.text(“0”+$(this.text())
}
});            
}, 100);
},
onChangeMonthYear:功能(年、月、月){
setTimeout(函数(){
$(“#ui datepicker div”).find('table tr td[data handler=“selectDay”]>a')。每个(函数(){
如果($(this).text().trim().length<2){
$(this.text(“0”+$(this.text())
}
});            
}, 100);
}
});

我认为,
UI日期选择器中没有预定义的选项。您应该为此编写自定义代码:

我在Show
和onChangeMonthYear事件之前编写了一些示例代码,请尝试以下操作:

$('#picker').datepicker({
    beforeShow: function (txt, inst) {
      setTimeout(function(){
         $("#ui-datepicker-div").find('table tr td[data-handler="selectDay"] > a').each(function(){
             if($(this).text().trim().length < 2){
               $(this).text("0" + $(this).text())
             }
         });            
      }, 100);
    },
    onChangeMonthYear: function (year, month, inst) {
      setTimeout(function(){
         $("#ui-datepicker-div").find('table tr td[data-handler="selectDay"] > a').each(function(){
             if($(this).text().trim().length < 2){
                $(this).text("0" + $(this).text())
             }
         });            
      }, 100);
    }
});
$(“#选取器”).datepicker({
beforeShow:函数(txt、inst){
setTimeout(函数(){
$(“#ui datepicker div”).find('table tr td[data handler=“selectDay”]>a')。每个(函数(){
如果($(this).text().trim().length<2){
$(this.text(“0”+$(this.text())
}
});            
}, 100);
},
onChangeMonthYear:功能(年、月、月){
setTimeout(函数(){
$(“#ui datepicker div”).find('table tr td[data handler=“selectDay”]>a')。每个(函数(){
如果($(this).text().trim().length<2){
$(this.text(“0”+$(this.text())
}
});            
}, 100);
}
});

我认为,
UI日期选择器中没有预定义的选项。您应该为此编写自定义代码:

我在Show
和onChangeMonthYear事件之前编写了一些示例代码,请尝试以下操作:

$('#picker').datepicker({
    beforeShow: function (txt, inst) {
      setTimeout(function(){
         $("#ui-datepicker-div").find('table tr td[data-handler="selectDay"] > a').each(function(){
             if($(this).text().trim().length < 2){
               $(this).text("0" + $(this).text())
             }
         });            
      }, 100);
    },
    onChangeMonthYear: function (year, month, inst) {
      setTimeout(function(){
         $("#ui-datepicker-div").find('table tr td[data-handler="selectDay"] > a').each(function(){
             if($(this).text().trim().length < 2){
                $(this).text("0" + $(this).text())
             }
         });            
      }, 100);
    }
});
$(“#选取器”).datepicker({
beforeShow:函数(txt、inst){
setTimeout(函数(){
$(“#ui datepicker div”).find('table tr td[data handler=“selectDay”]>a')。每个(函数(){
如果($(this).text().trim().length<2){
$(this.text(“0”+$(this.text())
}
});            
}, 100);
},
onChangeMonthYear:功能(年、月、月){
setTimeout(函数(){
$(“#ui datepicker div”).find('table tr td[data handler=“selectDay”]>a')。每个(函数(){
如果($(this).text().trim().length<2){
$(this.text(“0”+$(this.text())
}
});            
}, 100);
}
});

这件衣服很漂亮:)+1这件衣服很漂亮:)+1这件衣服很漂亮:)+1这件衣服很漂亮:)+1