grails datePicker submit date with timeZone - grails

I am sending date through g:datePicker as Eastern time by default.
How do I have an option where i pass date based on the timeZone selected?
Please help.

Grails datepicker tag does not and should not deal with your timezone. Its just a presentation of date and accepts Date object. Meaning that whatever timezone the date object has it will be that.
There are number of libraries to handle timezone on client side such as ECMAScript Internationalization API, moment.js and many others. On the server side you have libraries such as Joda-time and so on. I am sure if you search on Google you can find plenty more options.
Just handle your timezone conversion, then the presentation layer could be Grails datepicker or bootstrap-datepicker or jquery and etc.

Related

Force TMonthCalendar to display user defined date format

By default TMonthCalendar shows date in the format that is set in Windows control panel (Short Date). I want to override this setting and force TMonthCalendar to always display my format regardless of Windows setting. Is it possible ?
As far as I know, you can not change the date format settings of TMonthCalendar.
The reason for this is the fact that TMonthCalendar is actually just a wrapper around a calendar API from the OS. That is why not only is the date format in the form that is set in OS regional settings, but the whole look of the calendar matches the look of the OS on which you are running your application on.
So, I'm afraid you will have to look at some third party components for this. For instance, TMS Software has several calendar and date-time picking components as part of TPlannerCalendar.
No, this control is a wrapper for the native Month Calendar Control. As the documentation states:
The month-calendar control gets its format and all strings from
LOCALE_USER_DEFAULT.

I want to change the datepicker for my mobile website on iOS

Currently the datepickers trigger the default iOS datepicker with dd-mm-yyyy format. I would like it to trigger the dddd-dd-mm-yyyy format so users are better at picking the correct date because they can see the actual day of the week.
Is this possible for a mobile website?
I'm not sure about doing it for mobile website. But we can change format of default iOS date picker if you want. It's directly not possible through date picker. There is another component called UIPickerView in iOS, through which we can achieve this. Check how to create UIPickerView for mobile website and place the values you want in pickerView.
So after doing more research on the subject I have found that it is possible to use datetime-local. This triggers the native datepicker with ddd-dd-mm format but also accounts for the year (so scrolling over december 31 will make the date object move to the next year). This workaround has issues with IE though, so is not a universal solution.

Custom input type=date in jquery mobile 1.2.1

I use input type "date" with jquery mobile. But for each device it display different result.
+ Android operating system: choose input date the same type of android calendar
+ iOS: choose input date date the sam type of iOS
+ Desktop: choose input date the same type of operating system install on desktop
I want display dd/MM/yyyy format standard for all device. How to custom format default input date???
Thank you so much!
You can do this, but this is too much of a waste of time and involves cumbersome use of HTML5's localStorage api. For more info, look at this question. In this case also, it's not possible to make type=date behave uniformly in all browsers because each browser handles this differently and you don't have any control over it.
HTML5's standards indicate usage of YYYY-MM-DD format but the browsers sniff your local date format and use that. See this from w3:
The format used "on the wire", i.e. in HTML markup and in form submissions, is intended to be computer-readable and consistent irrespective of the user's locale. Dates, for instance, are always written in the format "YYYY-MM-DD", as in "2003-02-01". Users are not expected to ever see this format.
and this question at jquery Mobile site.
All this must tell you that doing this will take a lot of effort from you. Instead, it would be better if you use some other alternative to this, taken from this question like this : http://jsbin.com/ukelis/1/edit
you could change the dateformat in the altFormat option in the JS and make this work for you. You could also look at this - a mobile version for jquery UI's datepicker.

How DateTime is validated in MVC Unobtrusive Validation?

Using MVC4 with client-side & unobtrusive validation enabled, I'm trying to understand how the validation determine if an entered DateTime value is valid or not.
In my application this formatted date is valid: 01/31/2013,
while if I enter: 31/01/2013, I get:
The field [fieldId] must be a date
How does it determined what is a valid date?
How does it determined what is a valid date?
It uses the current culture defined on your client browser to determine the correct format. For example if your browser is configured to use en-US as default language then the correct format is M/d/yyyy. If you client browser is configured to use fr-FR language the correct format is dd/MM/yyyy.
It will all depend on what language is your browser configured to use.
Great Question. This seems to be an ongoing issue from MVC 3. I see it all the time. There are countless complaints about the issue like this http://forums.asp.net/t/1831712.aspx/1
Darin Dimitrov wrote a great post in which he uses DataStringFormat to force it.
Format datetime in asp.net mvc 4
I highly recommend it. Great read. If you use it, give a +1 to his answer.
For my $$$ I will stick to and swear by JQuery date pickers populating uneditable controls for the user's benefit.

jquery.mobile: how to ask user for date ranges?

I need to ask users of my jquery mobile web site to select a date range.
I can't find any suitable jquery-mobile plugin. I looked for a lot of plugins for date-time picking (the most promising to me being "jQM-DateBox"), but no one seems to allow for a date range.
Any suggestion?
As far as i know there isn't any plugin which provides date ranges until now.
The available date plugins for jQM are
The jQM-Datebox
The MobiScroll
In my opinion the most common way is to use two dateboxes, one for the start date and one for the end date. Initially the end date will be deactivated. The user will select the start date and using the change event you will have to complete the end date with the same date as the selected start date. Afterwards the user will have the option to modify the end date or not.
Im not sure how it works in jQuery Mobile but you could try jQuery UI DateRangePicker (much of jQuery ui is in jQuery Mobile) ...
http://tamble.github.io/jquery-ui-daterangepicker/
Ill be interested to know the outcome.

Resources