I am using nubuilder-v2.7.4.11-12.10.24-Build529 on Ubuntu 12.10 browsing with Chromium 22.0.1229.94.
When the user clicks on the date selector for a field, the selector should reflect the current value, not today's date. If the current value is NULL, then today's date is acceptable.
The current behavior makes it difficult to slightly adjust a date value, and it is not what most users expect.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Date selector should display current value
-
- Posts: 15
- Joined: Fri Nov 23, 2012 11:31 pm
-
- Posts: 84
- Joined: Mon Jul 04, 2011 12:52 am
Re: Date selector should display current value
actually it's a good point. I have noticed the users do stupid date entries, probably this is the reason.
My solution (not the best, because I hardcoded my date format in nuCalendar.js)
I added a new function to
productionnu2/common.js
and modified the file
productionnu2/nuCalendar.js
modified rows:
27
44-53 (in row 48 is declared which date format to use (d-m-y) or (m-d-y) or (y-m-d))
202-207
its works for me because i use always the same date format on forms.
If u use different formats on different forms then dont use this solution
My solution (not the best, because I hardcoded my date format in nuCalendar.js)
I added a new function to
productionnu2/common.js
Code: Select all
/**
* convert date to JavaScript format
* date - date string
* format - date strings format (y-m-d || d-m-y || m-d-y)
*/
function jsDate(date,format)
{
if(format == 'yyyy-mm-dd' || format == 'y-m-d' || format == 'Y-m-d' || format == 'Y-mm-dd' )
{
date_split = date.split('-');
convertDate = date_split[1]+"/"+date_split[2]+"/"+date_split[0];
}
if(format == 'dd-mm-yyyy' || format == 'd-m-y' || format == 'd-m-Y' || format == 'dd-mm-Y' )
{
date_split = date.split('-');
convertDate = date_split[1]+"/"+date_split[0]+"/"+date_split[2];
}
if(format == 'mm-dd-yyyy' || format == 'm-d-y' || format == 'm-d-Y' || format == 'mm-dd-Y' )
{
date_split = date.split('-');
convertDate = date_split[0]+"/"+date_split[1]+"/"+date_split[2];
}
return convertDate;
}
productionnu2/nuCalendar.js
modified rows:
27
44-53 (in row 48 is declared which date format to use (d-m-y) or (m-d-y) or (y-m-d))
202-207
its works for me because i use always the same date format on forms.
If u use different formats on different forms then dont use this solution
You do not have the required permissions to view the files attached to this post.
-
- Posts: 60
- Joined: Fri Oct 26, 2012 8:09 pm
Re: Date selector should display current value
Hi Zazzium, thanks for the code.
I don't really like amending core files ... but in the absence of a formal solution hey what do we do?
Just means I have to remember each time I upgrade.
I wonder if there will be an "official" solution at some point?
cheers
Martin
I don't really like amending core files ... but in the absence of a formal solution hey what do we do?
Just means I have to remember each time I upgrade.
I wonder if there will be an "official" solution at some point?
cheers
Martin