Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calendar Date Picker - Off by One Month? SOLVED
11-30-2017, 04:21 AM, (This post was last modified: 12-04-2017, 07:04 AM by phil.)
#1
Calendar Date Picker - Off by One Month? SOLVED
Locale USA

Whenever I click on a date field to pop the Calendar Date Picker it is off by one month (+30 days).

   

Is this expected functionality and, if not, how can I make it so the Calendar Date Picker defaults to the date shown in the date fields?

Is this a MiscFunctions.js thing?
https://www.linkedin.com/in/eclipsepaulbecker
Reply
11-30-2017, 05:06 AM,
#2
RE: Calendar Date Picker - Off by One Month?
Which script is it, or all? Some scripts have the date field set for 30 days hence or 30 days before.

Tim
Reply
11-30-2017, 05:10 AM, (This post was last modified: 11-30-2017, 05:38 AM by VortecCPI.)
#3
RE: Calendar Date Picker - Off by One Month?
After looking at MiscFunctions.js I believe this is a locale issue.

Trying to resolve it now...
(11-30-2017, 05:06 AM)falkoner Wrote: Which script is it, or all? Some scripts have the date field set for 30 days hence or 30 days before.

Tim

It happens in every date field I have tried so far. I assume the calendar should default to the month for the dates shown in the date fields?
https://www.linkedin.com/in/eclipsepaulbecker
Reply
11-30-2017, 08:54 AM,
#4
RE: Calendar Date Picker - Off by One Month?
Yes it should. To be honest these days all the browsers support the HTML5 date picker and we probably ought to switch to that. It requires some minor changes to each script to get it to work, it's not a drop in replacement.

I can see the problem with the month getting added on, but mystified as to how it happens. Other date formats appear ok. If you get a solution let me know, otherwise I will look myself, but it won't be tomorrow as I am travelling.

Tim
Reply
11-30-2017, 10:37 PM, (This post was last modified: 11-30-2017, 10:38 PM by VortecCPI.)
#5
RE: Calendar Date Picker - Off by One Month?
I made two small changes in MiscFunctions.js and it seems to work as I need it to now.

drawCalendar(md, dt.getFullYear(), dt.getMonth()-1, dt.getDate()+1, dF);

A hack for sure but it gets me where I need to be for now...
https://www.linkedin.com/in/eclipsepaulbecker
Reply
12-02-2017, 02:56 AM, (This post was last modified: 12-02-2017, 03:13 AM by TimSchofield.)
#6
RE: Calendar Date Picker - Off by One Month?
The problem is this then shows the wrong date for d/m/Y date formats.

I need to find time to properly look into this.

Tim
(12-02-2017, 02:56 AM)falkoner Wrote: The problem is this then shows the wrong date for d/m/Y date formats.

I need to find time to properly look into this.

Tim

Turned out to be easier than I expected. Change lines 252/253 of javascripts/MiscFunctions.js to be the following:

m = parseInt(dA[0], 10)-1;
d = parseInt(dA[1], 10);

Thanks
Tim
Reply
12-02-2017, 06:15 AM,
#7
RE: Calendar Date Picker - Off by One Month?
Thank you Tim!
https://www.linkedin.com/in/eclipsepaulbecker
Reply
12-02-2017, 05:56 PM, (This post was last modified: 12-04-2017, 07:03 AM by phil.)
#8
RE: Calendar Date Picker - Off by One Month? SOLVED
Committed to SVN thanks
Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Reply
12-03-2017, 12:18 AM,
#9
RE: Calendar Date Picker - Off by One Month?
Thank you both for your help and for committing changes.
https://www.linkedin.com/in/eclipsepaulbecker
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)