Date/Time input for an HTML Form - javascript

I'm having trouble finding an elegant way to allow for date/time input in an html form. I am thinking of having drop down menus for year, month, day, hour, minute, second, millisecond that are populated with valid entries only. I could do this by hard coding values for each drop down menu, but I'm thinking there must be a more elegant way to do this, perhaps with some already existing javascript library that I have not found yet. Any tips for getting this done?
edit: Second, and if possible, millisecond precision is needed for what I'm working on.
edit#2: After reading some of the comments, I have come to the realization that it is probably a bad idea to have drop down menus for the large range of values required by hours/minutes/seconds and especially milliseconds. I think will go with having the DatePicker prototype date chooser, along with a simple textfield for time input.

This can be done quite elegantly with a Jquery plug-in called Datepicker

There are many calendars which can do this, with both date and time :
Calendar Date Select
Control.DatePicker (based on PrototypeJS) my favourite, I made an enhanced version, with more features, I can share it
Dynarch calendar but I find it too heavy
and others

I think a very easy way to do this is by using PHP i.e. for making choosing a day and a month:
Use the select command for the form, then insert a PHP line to initiate a for loop. So for the days the loop would go from 1 -> 31 and for the month from 1 -> 12. So instead of hard coding it for all the days months etc, you can neatly fit it into one line of code with a small bit of PHP added.

You could expand on on this plugin since you want second/millisecond
http://www.jnathanson.com/index.cfm?page=jquery/clockpick/ClockPick

Related

How to make datepicker show all dates of the month in one row

I'm new to jQuery and I'm currently trying to figure out a way to manipulate datepicker so that it would show all the dates of a single month in just one row.
I'm trying to build a multi-unit hotel reservation-type calendar to be used as admin (not client-facing). I've got so far as to build a calendar-looking thing from scratch using loops and <ul> (this is from my research of popular BnB websites that have calendars with blocking click-and-drag functionalities). So the multi-unit calendar for February would have Days 1-28 as columns, and each unit/room as the rows.
I know jQuery comes with documentation for their API but in all honesty I have crawled through the interwebs and there is just not a single answer for my question.
Is there a simple method that controls how many cells printed per row? Because obviously a regular calendar always has 7 days per row. Or would I have to code this from scratch or is there somehow a more complicated but doable way with Datepicker?
Thank you all in advance!

JQuery Multiple Month Calendar View

I'm looking for suggestions/recommendations for a JQuery/Javascript calendar that can display multiple months at once (ie. previous month, current month, next month) like so:
(The attached mockup shows a 4-month view, but I think we'll actually be doing a 3-month view).
I DO NOT need a date picker. This is basically meant to display a user's schedule, with no ability to choose a specific month/year (beyond the side-scrolling). We'll pull events out of our database, hook them into the calendar somehow, and then on a day click/hover (or both), display additional information. Events will not be editable from this view - it is display only.
I've looked into general JQuery calendar plugins (Ion Calendar, CLNDR), but none seem to have the basic multiple-month functionality I need. Multi-lingual support (or the ability to add multi-lingual text) is also important to us. I was really hoping to find a ready-made plugin for this - can't be the first time someone's tried to do it!
In case it's any use/help, we use ColdFusion and MSSQL Server. We've also got JQuery 1.9.1, JQueryUI 1.10.0 and Bootstrap 2.3.2.
Edit: I did look at the JQuery UI datepicker, but it won't work for the functionality I need. I can't see any way to attach data to a specific date, or to be able to style certain days differently than others. I think the primary issue w/ it is that it's a datepicker, not a display calendar.
Like Sean said in the comments, the best option you have is probably FullCalendar. Although multi-month isn't supported out of the box, you might be able to achieve it by adding multiple calendars. Check out Issue #199, which describes a possible solution.
Regarding the multi-lingual problem: although it isn't multi-lingual by itself, FullCalendar does support modifying the days, months, etc. See Text/Time Customization. You could use ColdFusion's MonthAsString and DayOfWeekAsString functions to make it multi-lingual yourself.

Planning tool JQuery / MVC 4

The webapplication I would like to build gives the user the possibility to select a period on a calendar. On the selected days they can write the start and end hour. The total amount of hours gets calculated. On the image below you can see what I would like to accomplish. What is a good way to get started programming this? Is there a good tutorial to get me started?
Is there a JQuery widget that gives a good start?
On the left you got some Employees and for each of them the user can select the period and fill in the hours they have to work.
I hope u get the idea that i have in mind. Please feel free to ask me any specifications.
I'm using MVC 4 - razor pages for the webapp
Thanks in advance
I've made something very similar in a MVC2 app with jQuery to check schedules for formative actions.
I first place a temporary span for the action and load it into the calendar provided by jQuery's datepicker, later I overwrite it's onSelect event to affect and save my data.
So when I click on a day of the calendar (only days on the previously selected time span are clickable) I allow user to introduce data for the schedule on that day.
Data saving to server is managed through AJAX calls that saves during using interaction.

jQuery datePicker endDate

I'm using this particular datepicker script (which is not the one provided in jQuery itself, but they happen to have the sane name)
datePicker
And in the examples there's an option to only select dates in the past selectables, however, i can't figure out how to set selectables dates in the past INCLUDING today, without trying to fool the datePicker that the end date is tomorrow (which causes the calendar to render tomorrow selectable, but at select it does nothing)
After lot of testing however i've come into some light about the problem, it seems that when you pass the endDate to the script it transform it to string to later again transform it to a Date object, when doing this the script seems to ignore the hour and it simple puts 00:00:00:00 but when checking the max selectable date it gets 12:00:00:00, since the date i'm givin is greater than today it becomes not selectable.
Thanks in advance
PD: Suggestions like "use another calendar then" means too many changes, so i'd rather try to fix the current one.

"AJAX" Calendar Widget that include Time Selection

Are there any existing AJAX/Javascript Date picker widgets/libraries that also allow you to select a time range? That is, after picking a date, an existing UI pops-up/becomes available to select a time range for the same.
I'm looking for example of things like this. UI Libraries that offer some form of date picking, followed by a step to pick a time range.
Yes, I know, a dozen different ways this could be implemented myself. I'm interesting in knowing what kind of preexisting libraries exist for this problem domain.
Here are some of the MANY choices:
Fancy Time Picker
NoGray Time Picker
This JQuery Plugin
Any+Time
Another JQuery Plugin
JQuery pt.TimeSelect
Clock Pick
Clock Picker
TimePickr
-
John Resig (The J IN JQuery) has this to say about it.
You'll need to combine a DATE Plugin with a Time Plugin, don't try to cram both into one dialog

Categories