我正在尝试设置datepicker的默认日期,但它不起作用
def andCritera = new ArrayList<BasicDBObject>();
def orCritera1= new ArrayList<BasicDBObject>();
orCritera1.add('name', java.util.regex.Pattern.compile('(?i)^test1`'))
orCritera1.add('name', java.util.regex.Pattern.compile('(?i)^dev`'))
def orQuery1 = new BasicDBObject("\$or", orCritera1);
andCritera.add(orQuery1)
def orCritera2= new ArrayList<BasicDBObject>();
orCritera1.add('email', java.util.regex.Pattern.compile('(?i)^test`'))
def orQuery2 = new BasicDBObject("\$or", orCritera2);
andCritera.add(orQuery2)
def query = new BasicDBObject("\$and", andCritera);
def cursor = collection.find(query)
while (cursor.hasNext()) {
println 'person '+ cursor.next();
}
这是结果
答案 0 :(得分:1)
Javascript日期对象与Twitter引导程序日期选择器格式不兼容。
您需要逐步创建默认日期。现在这应该工作:
$(document).ready(function () {
var today = new Date();
var mm = today.getMonth() + 1; //Month starts from 0
var yyyy = today.getFullYear();
if(mm<10){
mm='0'+mm
}
today = mm+'-'+yyyy;
$('.datepicker input').val(today);
$('.datepicker input').datepicker({
autoclose: true,
orientation: "top auto",
todayHighlight: true,
format: "mm-yyyy",
viewMode: "months",
minViewMode: "months"
});
});
更新:添加today
值以输入第一个