thekingsimo / jquery-week-calendar

Automatically exported from code.google.com/p/jquery-week-calendar
0 stars 0 forks source link

Use the timeFormat setting while rendering the table #117

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The table is rendered without the timeFormat setting. This disallows for 
e.g. setting business hours from 8:30h until 17:30h.

A beginning of a patch would be replacing:

         for (var i = start; i < end; i++) {
            var bhClass = (options.businessHours.start <= i && 
options.businessHours.end > i) ? "wc-business-hours" : "";
            calendarBodyHtml += "<div class=\"wc-hour-header " + bhClass 
+ "\">"
            if (options.use24Hour) {
               calendarBodyHtml += "<div class=\"wc-time-header-cell\">" + 
self._24HourForIndex(i) + "</div>";
            } else {
               calendarBodyHtml += "<div class=\"wc-time-header-cell\">" + 
self._hourForIndex(i) + "<span class=\"wc-am-pm\">" + self._amOrPm(i) 
+ "</span></div>";
            }
            calendarBodyHtml += "</div>";
         }

with

for (var i = start; i < end; i++) {
            var bhClass = (options.businessHours.start <= i && 
options.businessHours.end > i) ? "wc-business-hours" : "";
            calendarBodyHtml += "<div class=\"wc-hour-header " + bhClass 
+ "\">"
            if (options.use24Hour) {
               calendarBodyHtml += "<div class=\"wc-time-header-cell\">" + 
self._24HourForIndex(i) + "</div>";
            } else {
                            var date = new Date
(2000, 1, 1, self._hourForIndex(i),  self._hourForIndex(i)%1*60, 0);
              calendarBodyHtml += "<div class=\"wc-time-header-cell\">" + 
self._formatDate(date, options.timeFormat) + "<span class=\"wc-am-pm\">" + 
self._amOrPm(i) + "</span></div>";
            }
            calendarBodyHtml += "</div>";
         }

in jquery.weekcalendar.js.

Even better would be two settings: timeTableFormat and timeFormFormat (to 
give the user more control).

Original issue reported on code.google.com by koosvdk...@gmail.com on 18 Jan 2010 at 10:09