canvs / fullcalendar

Automatically exported from code.google.com/p/fullcalendar
0 stars 0 forks source link

Option to show time range for events #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have hacked FC to support display of time ranges for events to satisfy my
requirements. It would be nice if this could be done via a simple option
(showTimeRange = true).  Or maybe showTime could be changed to have values
of "none", "start", "end", and "range".

The following code will display time ranges like "9:00a-10:30a" if the time
format is set to "g:ix".  I realize this code is very hacky, and I'm sure
the r2l part isn't right. But I just wanted to illustrate a solution.

function buildEventText(event, element) {
    $("<span class='event-title' />")
        .text(event.title)
        .appendTo(element);
    var st = typeof event.showTime == 'undefined' ? showTime : event.showTime;
    if (st != false) {
        if (st == true || st == 'guess' &&
            (event.start.getHours() || event.start.getMinutes() ||
             event.end.getHours() || event.end.getMinutes())) {
                var timeStr = $.fullCalendar.formatDate(event.start, timeFormat);
                var timeEndStr = $.fullCalendar.formatDate(event.end, timeFormat);
                var timeElement = $("<span class='event-time' />");
                if (r2l) element.append(timeElement.text(' ' + timeStr + '-' +
timeEndStr));
                else element.prepend(timeElement.text(timeStr + '-' + timeEndStr + ' '));
            }
    }
}

Original issue reported on code.google.com by yowza...@gmail.com on 17 Jun 2009 at 12:16

GoogleCodeExporter commented 9 years ago
i think this is a good idea and adds flexibility, but i would make the api a 
little
different. i would somehow include it in the timeFormat option, so that the
programmer can use something other than the '-' if they want. maybe something 
like
this...

timeFormat: "g:ix-{g:ix}"

...where things in brackets enclose the end date. i'll have to think about this 
one a
little bit more, but can almost promise it will be in some future release. i'll
update this thread when i make more concrete plans. thanks

Original comment by adamrs...@gmail.com on 29 Jun 2009 at 3:54

GoogleCodeExporter commented 9 years ago

Original comment by adamrs...@gmail.com on 30 Jun 2009 at 6:33

GoogleCodeExporter commented 9 years ago
v1.3 just released. you can now show time ranges using the 'timeFormat' option 
and
the *new* formatDates (http://arshaw.com/fullcalendar/docs/date-utils.php) 
format.
please respond to this thread if any troubles. thanks.

Original comment by adamrs...@gmail.com on 21 Sep 2009 at 10:28

GoogleCodeExporter commented 9 years ago
I have some problems using the timeFormat to display 'H:mm{ - H:mm}'

The following is included, I use only the agenda:
timeFormat: 'H:mm{ - H:mm}',

But it still show only the start hour 'H:mm'

Browser: Safari 5.0.2

Original comment by maximsch...@gmail.com on 7 Nov 2010 at 9:36

GoogleCodeExporter commented 9 years ago
maximschelfhout, can you post this as a new issue, and remember to include 
everything needed for me to recreate the bug? (html file, js files, etc...)

Original comment by adamrs...@gmail.com on 22 Nov 2010 at 12:14

GoogleCodeExporter commented 9 years ago
I have the same problem.
I have configured calenda as: timeFormat: 'H:mm{ - H:mm}',

In month view I see the time correctly es. 09.30-17:30
but in the title of any event in dayBasic view I see 09:30 5:30

I see it ehit any browser
Whoat other parameters I need to change?
Thanks
Alessandro

Original comment by ago...@gmail.com on 29 Nov 2010 at 1:35

GoogleCodeExporter commented 9 years ago

Original comment by adamrs...@gmail.com on 14 Aug 2013 at 2:11

GoogleCodeExporter commented 9 years ago

Original comment by adamrs...@gmail.com on 14 Aug 2013 at 2:12