specific period fullcalendar - fullcalendar

Hi
I need to use a specific period, eg 08:00 to 12:00, 14:00 to 18:00.

not completely sure what you are asking, but seems like minTime and maxTime might be what you are looking for:
http://arshaw.com/fullcalendar/docs/agenda/minTime/
http://arshaw.com/fullcalendar/docs/agenda/maxTime/

Related

Fullcalendar: start day at 8AM instead of midnight

We are use the Fullcalendar plugin for booking our events
Al lot of the events take place around midnight so often we see events starting at 22:00 and ending at 4:00. It is possible to insert these in Fullcalendar in the week view but it is a little tricky. It would make more sense to us to start the days at 8 in the morning and end at 8 in the morning so events will usually be visible in a single day.
I did not find this option in the documentation, so I would like to know if there is an existing implementation that does this job or else find a hint where I would start to enhance Fullcalendar to make this possible.
It is possible using the minTime and maxTime by setting them as the following.
minTime: "08:00:00",
maxTime: "32:00:00",
Here is a codepen showing this.
However it is quite buggy. If you try to put a small event into the time that would be the next day after 12PM, then the calendar does not really know what to do and the even will be be out of view. If the event is at least long enough to bring it to the next day past 8AM then it will be visible across both days. Due to the bugs with this method I would suggest using the calendar with its default minTime and maxTimes is the best approach.

FullCalendar slotLabelInterval count

I am working on a web page that has FullCalendar in it. I would like to make the agendaWeek-view show time from 06:00 to 22:00 with interval of 4 hours. The 06:00-22:00 time works as it should but how can I change the interval count to start from 06:00? It starts counting from 00:00 and now the first visible time label is 08:00 but I want it to be 06:00. In short, the calendar starts from 06:00 with no time labels on it until at 08:00.
I can't be sure because you have not posted any code but I think this is what you are looking for. slotDuration will let you change the interval where the calendar will display times. So if you set slotDuration: '04:00:00' it will only show a time interval every 4 hours. See an example here.

When is it ok to store datetimes as local time rathen than UTC?

This is a question similar to this one.
I'm really tempted to store datetimes in my app as local time rather than as UTC (which is considered a best practice). In the app I have a number of events happening, each assigned to a given location. Always when I display them to the user, I want to show the local time of the event. I.e.:
====================================================================================
Event time (with TZ) | As UTC | As local time | To be displayed |
====================================================================================
2014-01-15 22:30 GMT | 2014-01-15 22:30 | 2014-01-15 22:30 | 2014-01-15 22:30 |
2014-01-15 23:30 GMT+1 | 2014-01-15 22:30 | 2014-01-15 23:30 | 2014-01-15 23:30 |
2014-01-16 00:30 GMT+2 | 2014-01-15 22:30 | 2014-01-16 00:30 | 2014-01-16 00:30 |
====================================================================================
If I decide to store the event times in UTC:
it will be difficult to display them (because with each event I need to have the event's timezone and format the date for that timezone).
it will be very difficult to query them (i.e. if I want to show all events that happened on 2014-01-15 local time I need for each event to compare that event's time with what '2014-01-15' means in that event's timezone. Not sure if this is even possible in SQL...)
If I decide to store the event times as local times:
I will not be able to compare times of events for different locations (but this is ok for me)
Since in the vast majority of cases in the app I'm interested in the local time (usually displaying the, so called "television time") and there aren't many cases where I'm creating new datetime objects (for which I need the location timezone), I believe saving datetimes as local time is justified in this case.
Do you think it is? What are other downsides of storing local times?
Thanks in advance for your attention and help.
The most commonly overlooked case of when not to use UTC is for scheduling of future times - especially in recurrence patterns.
Imagine if you're alarm clock was scheduled by UTC. Say you set it for 7:00 AM daily. On the day after a DST transition, you'd either wake up at 6:00 AM or 8:00 AM depending on which direction the transition was.
Also, the rules by which we determine time zone offsets and daylight saving time changes get updated all the time! So you can't take some future local time and convert it to UTC without also retaining the local time itself. Otherwise, when things change, you won't have an original source of truth and again all your times will be off.
I've posted on this many times before.
Of course, once the event has occurred, then you certainly want to record the time either at UTC, or using a DateTimeOffset.
Another common use case is for dates without times, especially birth dates and other anniversary dates. These should always just be stored as year, month, day (such as in a date field type in most databases) - with no conversion between time zones or UTC.
Regarding your specific points:
If I decide to store the event times in UTC ... it will be difficult to display them...
That is quite easy actually. Almost every programming environment can do this easily. The only place this is difficult is in JavaScript for non-local time zones, and there are libraries to cope with that.
If I decide to store the event times in UTC ... it will be very difficult to query them (i.e. if I want to show all events that happened on 2014-01-15 local time I need for each event to compare that event's time with what '2014-01-15' means in that event's timezone. Not sure if this is even possible in SQL...)
That is true. Everybody's "today" is different. If you need data tied to a floating "day" then that is another case for not storing in UTC. However, a DateTimeOffset would give you the advantages of both.
If I decide to store the event times as local times ... I will not be able to compare times of events for different locations (but this is ok for me)
It's more than that. A local DateTime without an Offset may be ambiguous to to daylight saving time fall-back transitions. So you could have a single local value that you can't distinguish which of two points in time it corresponds to.
Regarding "television time" - reserve that concept for things that are truly "floating". Example: A company has offices all over the world that all start at 8:00 AM. That's a floating time.

ASP.NET Time Drop Downs and AM/PM Issue

I've searched already for some ideas on this but the answers were totally code-based; my problem is also a HCI/Usability issue:
https://stackoverflow.com/search?q=[asp.net]+time+am+pm
I have an events form with a calendar. Then I have three drop down lists for Hours, Mins and AM/PM. But technically, 12 Noon and 12 Midnight are not AM or PM, correct?
http://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight
I have thought about adding "Noon" and "Midnight" to the AM/PM drop down but I would be assuming that the user would know the correct usage (they won't). I could create the AM/PM as a cascading drop down based on the hour selected?
There are probably many ways to hack this up - but I'm looking for suggestions that take usability into account - simple and elegant solution anyone?
Simple solution would be not to use an ambiguous system, use the 24-hour clock instead and the problem goes away.
In modern western society 12:00am refers to midnight and 12pm to noon. the simple solution we normally employ is to avoid any form of confusion and use a 24:00 based time instead. It also results in one less drop down to select from in this case.

What is the best control should be used for disabling range of dates and times, so user cannot selects them?

I am implementing a business requirement for boats booking, each booking is a period (from datetime : to datetime).
So, I'm looking for a control to implement the following functions:
Disable booked periods so user be aware of booked periods, hence user cannot selects them.
e.g. We have the following booked periods
BoatName From To
Boat 1 01-01-2011 10:00 AM 01-01-2011 12:00 AM
Boat 1 02-01-2011 09:00 AM 04-01-2011 09:00 AM
Based on above booking details, all dates and times should be available except the following
01-01-2011 as a day should be available but times from 10:00 AM to 12:00 shouldn't be available.
02-01-2011 as a day should be available but times from 09:00 AM to 11:59 PM shouldn't be available.
03-01-2011 the whole day and time shouldn't be available because the whole days is booked.
04-01-2011 as a day should be available, but times from 12:00 AM to 09:00 AM shouln't be available.
So, is there a control that can implement that functionality?
Or, if I'm going to use ASP.NET Calendar Control or Telerik Calendar Control, how to implement such functionality?
I suppose you can do that with the telerik calendar using coding as in these demos:
http://demos.telerik.com/aspnet-ajax/carrental/default.aspx
http://demos.telerik.com/aspnet-ajax/calendar/examples/design/sunny/defaultcs.aspx
You may also take a peek at other live demos for picker validation they have or projects in their code library.

Resources