AnsweredAssumed Answered

Date field funny business

Question asked by JimmyCox on Nov 30, 2017
Latest reply on Dec 1, 2017 by bigtom


I've been tearing my hair out trying to figure out these issues I've been having with implementing mark_scott's fantastic LOgiCATOR module.

You can see more details of the problems i've been having here: New LOgiCATOR Blog Post Published: "Ready, Set, Integrate"


Basically I had found that at one point in the script it was grabbing the value from the date field it uses for searching and flipping its format to US style.

In the script it was using GetAsDate ( Rule::value_date ) and watching it in the data viewer I could see it getting changed from 23/11/2017 to 11/23/2017.

Both the LOgiCATOR file and my solution were set to use the system defaults. So then when it did the search part it put 11/23/2017 into the date field I was searching and that threw up a [500] error saying that the date was the wrong format.

If I went in to the dataviewer mid script and changed the $_value variable to 23/11/2017 manually, when it performed the find it worked.

Here's where it gets weirder:

I then tested it in the LOgiCATOR demo file, and found that it too was switching the date around when doing GetAsDate. Even though again, it was using the system default so even if I tried to enter a date into a field in the US format it would give me an error.

But when it got to the search part of the script in the demo file I was watching the dataviewer and the actual field on the layout and the $_value variable said 11/23/2017 but when it entered find mode and set field, this time it came into the field and flipped back and was entered as 23/11/2017 and the search worked. Yet in the demo also if I manually switched the variable around in the data viewer to 23/11/2017 this time the find wouldn't work.

My Solution and the Demo both use the System Default for dates and neither of them have any validation on the fields in Manage Database.

The dates seem to be flipping between formats at will and without the script telling them too.

It's frustrating the hell out of me.

Has anyone seen anything like this before? Am I missing something very simple?



Please feel free to make me look like a dickhead if I am.