// 小時 for (let i = 0; i < 25; i++) { const tempHour = i === 24 ? "00" : i < 10 ? "0" + i.toString() : i.toString(); const tempValue = tempHour + ":00" + (i < 12 || i > 23 ? " am" : " pm"); const tempObject = { value: i.toString(), text: tempValue }; this.dayRanges.hours.push(tempObject); } // 分鐘 for (let i = 0; i < 60; i++) { const tempMinute = i === 60 ? "00" : i < 10 ? "0" + i.toString() : i.toString(); const tempObject = { value: i.toString(), text: tempMinute }; this.dayRanges.minutes.push(tempObject); }
// 1-9數字補0
getNumber10plus0(value: any): string {
let result = "00";
if (!isNaN(value)) {
result = value < 10 ? "0" + value.toString() : value.toString();
}
return result;
}
文章標籤
全站熱搜
留言列表