我正在为jquery移动应用使用jqm-calendar。现在默认的时间格式是24小时。我想将其更改为12小时。jqm-calendar时间格式(默认24小时...宁愿12小时)
谢谢。
https://github.com/JWGmeligMeyling/jqm-calendar
我正在为jquery移动应用使用jqm-calendar。现在默认的时间格式是24小时。我想将其更改为12小时。jqm-calendar时间格式(默认24小时...宁愿12小时)
谢谢。
https://github.com/JWGmeligMeyling/jqm-calendar
在文件JW-JQM-cal.js
添加此功能:
function tConvert (time) {
// Check correct time format and split into components
time = time.toString().match (/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [time];
if (time.length > 1) { // If time format correct
time = time.slice (1); // Remove full string match value
time[5] = +time[0] < 12 ? ' AM' : ' PM'; // Set AM/PM
time[0] = +time[0] % 12 || 12; // Adjust hours
}
return time.join (''); // return adjusted time or original string
}
和在功能plugin.settings.eventHandler插入此2线 .getEventsOnDay(开始,结束,函数(list_of_events):
beginTime =tConvert(beginTime);
endTime=tConvert(endTime);
EDIT
插入之前: TIMESTRING = BEGINTIME + “ - ” +结束时间:**
...
BEGINTIME = tConvert(BEGINTIME);
endTime = tConvert(endTime);
TIMESTRING = BEGINTIME + “ - ” +结束时间,
...
你可以发布你试过吗? – MZaragoza 2014-11-16 03:08:46