Topic: Date format inconsistency

When the date format is chosen as "DDMMYYYY" in display setup the date_picker function does not work correctly.

It appears dates are only passed to the function as "MMDDYYYY"

ie. with the date entry fields as 06-12-2009 (12 June 2009) with date format "MMDDYYY"  the date_picker function opens to 12 June 2009 as expected.

with the date entry fields as 12-06-2009 (12 June 2009) with date format "DDMMYYYY" the date_picker function opens to 6 December 2009

/Andre

Re: Date format inconsistency

This is strange. I cannot reproduce this error. Please can anybody reproduce this error, and plese give exact details if you can.

/Joe

Re: Date format inconsistency

I have placed a self running (EXE) video to demonstrate this. Download or run from the site. Your choice.

http://zjunction.com/datefunc.exe



/Andre

Re: Date format inconsistency

Yes I see that your example is doing something wrong. Maybe there is a javascript problem on your client. This is the first time I have heard of this.
And I still can't reproduce it.
Did you try to logout and login again to see if it helps?

/Joe

Re: Date format inconsistency

BTW, what tool do you use for creating the demo?

/Joe

Re: Date format inconsistency

joe wrote:

Yes I see that your example is doing something wrong. Maybe there is a javascript problem on your client. This is the first time I have heard of this.
And I still can't reproduce it.
Did you try to logout and login again to see if it helps?

/Joe

I am using Java 6 update 13 - all my other java stuff works fine. Other demos elsewhere using similar techniques work fine. I doubt it would be the java.

My regional settings in XP is "English - South Africa" .  Try setting your region to mine, also my short date in XP is "dd/MM/yyyy" and the long date is "dd MM yyyy"

Logged in and out a few times.

The tool I used is Screen2EXE found at http://www.screen-record.com/screen2exe.htm

/Andre

Re: Date format inconsistency

Hello Andre,
I have change to English - South Africa and I have now reproduced the error.
If you use the / as date separator only the american format MM/DD/YYYY is working.
But if you use any of the other separators everything work just fine. So you will have to use either '-', '.' or blank as the separator to get the DDMMYYYY to work.
I have no idea where to look for this behavious. It seems to be in the operating system.

/Joe

8 (edited by ITCynic 06/14/2009 12:40:29 pm)

Re: Date format inconsistency

joe wrote:

It seems to be in the operating system.

I very much doubt it is the operating system as this would have quite a impact on many applications that use dates. (remember the Y2K debacle?).

In my days as a Clipper programmer I would have checked the the date format type ( ie American or British )
and then evaluated the date entry field to pass the correct date format to the calendar  function.

If the date is British and the calendar function is American I would rearrange the date string in the correct order before calling the calendar function,

For example

If date = "British"
  dDay = DAY( dDate)
  dMonth = MONTH( dDate )
  dyear = YEAR( dYear )

dResult = GetCalendar( dMonth + "/" + dDay + "/" + dYear + "/" )
dDate = DAY( dResult) + "/" + MONTH( dResult) + "/" + YEAR(dResult) // Would return dDate in British format

else

dResult = GetCalendar( dDate)
dDate = MONTH( dResult) + "/" + DAY( dResult) + "/" + YEAR(dResult) // Would return dDate in American format

endif

Not being a PHP coder I am not sure how one would do this, but I am in the process of trying to teach myself PHP so I can modify your forms layouts.

Regards

/Andre

Re: Date format inconsistency

Well, my friend. As an old C and C++ programmer I think our algorithms are quite ok. Your solution is only partly working as is. If you look at the date formatting in all the date fields, they are correctly formatted. It is when calling the JavaScript routines that things get screwed up when using the / as separator in the English - Southafrica environment and not american style.
Would be glad to hear if any other regions are having problem with the / as date separator.

/Joe

Re: Date format inconsistency

Hi Joe

Your solution is only partly working as is.

It was not my intention to provide a piece of working code, I cobbled that together in a few seconds to explain the concept of what I would have done if I were writing in Clipper. Besides I have not coded for at least 15 years now.

I think our algorithms are quite ok.

My post was/is not a comment on your coding styles or algorithms. In fact I have repeatedly stated on this forum that you guys have a brilliant application and commended you for the good work so far.

It is when calling the JavaScript routines that things get screwed up when using the / as separator in the English - South Africa environment

When I evaluated FA in v2.03 I am sure this was not an issue.


Off topic :-

From both your and Janusz's reply's to various user posts, I get the impression that you are both :-

a) extremely passionate about FA
b) always too busy to provide detailed help / how to's
c) seem sensitive when someone points out a deficiency or bug in the application and you would rather have a finger pointed elsewhere.

I do understand that FA does not pay your bills and is a labour of love with development being done when resources permit and I commend you and Janusz on your incredible efforts. For a 2 man team to get this much accomplished is pretty impressive.

I was under the impression this forum was about users communicating with the developers (yourselves) to assist in creating the best Open Source accounting package there is.

But I keep reading questions of a similar type being asked and not being addressed because it "will be considered in the next version" or "will be addressed in the next version" or "we are too busy with the next version".

I think the users of FA and fellow forumites should ask themselves the following questions.

"I prefer constant development to the next version with new features."    or

"I prefer a freeze on new features with more bugs being ironed out of current versions."

Personally, I prefer a freeze on new features until bugs are ironed out in current versions.

I have been following the progress of FA for the past 11 months, hoping it will get to a point where I can start recommending it to clients but all that is happening is new feature requests rather than making existing features stable, rock solid and bullet-proof.

Maybe, what I am looking for (a stable, customizable application actively supported by the community) is not really on offer here yet.

Please view these comments from someone who really wants to use and promote this application (like other forumites) and see it become the best Open Source accounting package there is.



Regards

/Andre

Re: Date format inconsistency

Hello again,
I will not start arguing about your last issues. Only explain what has happened about the region English - South Africa.
The following browsers are handling everything ok with date formatting while operating in South Africa region:
Firefox 3.0.8,
Google Chrome 2.0
The following browsers are not handling the / separator correctly in date formatting in South Africa region:
Internet Explorer 8.0
Opera 9.5
These were the browsers I have here. What is the conclusion from these tests?

When operating in South Africa region, the JavaScript engines inside Internet Explorer and Opera are not working properly when using a / separator in the date formatting.
So you can either follow my former instructions or change to Firefox/Google chrome for correct handling.

/Joe

12 (edited by ITCynic 06/14/2009 03:34:00 pm)

Re: Date format inconsistency

Hi Joe

No difference in behavior, still incorrect. Using FireFox 3.0.11

http://zjunction.com/datefunc2.exe

/Andre

13 (edited by p2409 06/14/2009 07:56:16 pm)

Re: Date format inconsistency

ALL browsers have a host of discrepancies/bugs when handling javascript. The engine's have previously been the last thing the browser developers have worried about.

In response to ITCynic, I support the developers 100% in the way they prioritise work. In your case, the best guess is this is a javascript problem with the date picker (I looked at the PHP code too), and I'd prefer they didn't waste time trying to accommodate browser issues for one country (so far). If you don't believe javascript engines are crappy, ask yourself why google has spent millions developing a framework that tries to integrate them!

I have a totally different view to ITCynic on the way bugs are handled in FA. Genuine, reproducible and significant bugs get almost immediate attention off these guys - more than any I've seen in any other software, commercial or otherwise. In regards to help, I think the guys also do a sterling job - to those who can communicate their problem and understand accounting adequately. To clueless people on here who ask questions like: "can someone tell me how to interface FA to xxxx payroll" etc, or "can someone do all the hard work so I don't have investigate or learn about my problem" I would encourage the guys to keep giving them polite, but short shrift. This is open source software - you get what you put in.

To be blunt ITCynic, come back when you understand and have debugged the PHP code, otherwise make an offer to pay someone to sort out the problem for you rather than criticise the developers because they don't do it your way . Your experiences with dates in non-browser applications you've used since Y2K are irrelevant - as I said, javascript engines are awful. A more practical piece of advice for you would be to replace the existing javascript date picker with another one (there are heaps of them out there) - not too difficult, and will narrow down the problem for you.

14 (edited by ITCynic 06/15/2009 07:07:43 am)

Re: Date format inconsistency

p2409 wrote:

otherwise make an offer to pay someone to sort out the problem for you rather than criticise the developers because they don't do it your way

Thanks for your insight, I actually did offer to pay for an amended purchase order layout and unfortunately both developers are "too busy". In any event, I am busy reviewing the code to see how to do the mods myself.

As per your suggestion, I will try a different java date picker, thanks for that tip.

Re: Date format inconsistency

Hello Andre and all other that might have problem with shifting the date-format and separator. This is not a fault in the English -South Africa region. It is a browser cache problem.
Before changing the date-format (preferences), empty the browsers caches. When selecting the new date-format/separator try to do a couple of changes forth and back and update everytime. It will force a new js to be uploaded to the company/no/js_cache folder. This mechanism has been done to speed up the routines, but unfortunately, also to irritate Andre a great deal. So I have to apolygize a lot for this.
Hopefully this helps also for eventually others.

/Joe

Re: Date format inconsistency

Hey Joe,

Thanks for persevering with this issue. See ..... you are passionate about FA smile

I cleared the browser cache and date picker works fine now.

Regards

/Andre

17 (edited by p2409 06/15/2009 11:44:22 am)

Re: Date format inconsistency

Hi ITCynic and Joe

I spent a spare 30 minutes today looking into this date format problem (I'm going to customise it for faster data entry for me), and can shed some light on it for you to either fix it, or workaround it. FA uses an interesting javascript cache technique to reflect user preferences by using code that actually creates a new code file - in this case date_picker.js which lives in
/company/x/js_cache  (where x is your company number).

When you change your user date format in the display_prefs.php screen, the system updates the $_POST variable with your requested format and other changes you want. A few other steps are run, and then /includes/ui/ui_view.inc actually writes out a NEW javascript file that includes the code for the date picker, including the order of days and months. This file goes in your /company/??/js_cache folder, replacing the old one. So... you end up with a new javascript file (date_picker.js in this case) that matches your formatting preferences.

ITCynic, it sounds like your date_picker.js file is NOT being copied into the  /company/x/js_cache directory properly. You can see if this is occurring by checking line 51 of the date_picker.js file: 

if(dateField){try{var dateString=new String(dateField.value);var dateParts=dateString.split('-');selectedDay=parseInt(dateParts[0],10);selectedMonth=parseInt(dateParts[1],10);selectedYear=parseInt(dateParts[2],10);}catch(e){}

(this is part of the 'show' function which takes your on screen inputted date, and updates the popup when you click it).

Note this line should contain your separator 'split('-') AND the right offsets for day and month that come from the text input box screen. In the case above, Day is element 0, month is element 1, representing a 31-12-2009 style date.

Your problem might be caused by write permissions on the directory, or some other defect in the .js file copying process.

If you plan on sticking to one format,and one separator, you can overcome your problem by just editing this date_picker.js manually, replacing line 51 with the one above (assuming you want 31-12-2009 format). Try this and let us know how it goes. It does sound like a problem unique to your environment though, as everybody else is creating the date_picker.js file and copying it successfully.

Cheers
Pete


PS. HAHA - I just missed Joe and ITCynic's updates - oh well, I've learnt about the date picker and will let the forum know when I've updated a new one I want that will let you type in
12032009
120309
12-03-09
12-3-2009 etc.

I find the digits only way very quick to enter data.

Re: Date format inconsistency

Hey Pete.

Thanks for all that research you have done. Most impressed smile

For now I have done what Joe has suggested, namely clearing the cache browser. That makes it seem to work.
In retrospect, I should have considered the browser cache as I have seen this cause strange behavior elsewhere, especially when creating websites in Drupal.

Regards

/Andre

Re: Date format inconsistency

Hi Guys

I am also in RSA and wanted to use date format DD/MM/YYYY and set it accordingly in preferences.

I get the same error where the date is displyed still in USA format: MM/DD/YYYY

I use Fire Fox 3.5.3

Vista Home Preium English South Africa.

I tried your response with DD MM YYYY and it worked.

Thanks    smile

Wynand