我正在爲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