Updateable dashboard paste update JobProd_UD.DateField accepts "bad" dates

Just an unusual issue I’ve ran into

After adding a UD date field to JobProd_U.MyDate_c
Created a UBAQ and corresponding dashboard.

Discovered that typos were accepted when Paste/Updating JobProd_U.MyDate_c
e.g. 10/7/0202 instead of 10/7/2020
and that the Job entry screen will throw an error until the values are corrected.

And… still looking for a good way to catch these.
My first thought was DateTime.TryParse but… TBD.
Ideas welcome.

Also, I’m thinking this is a bug… since similar typos for other UD table updates have auto-corrected?

That is odd that it could store a date with the year 0202. Dates prior to 1752 are kind of meaningless as they are pre-gregorian calendar.

BTW. Epicor built-in date fields can only be set to as old as 1/1/1753.

image

Yes, definitely surprised me.
For now, I’m throwing an error if the proposed date is less than the first of the current year.
Thinking there should be a better way but… haven’t stumbled upon one yet.

Be carful using DateTime to store a date. Because it has a time component, two values of the same date won’t be equal, if their times are different. Even affects comparisons.

DateTime dt1 =  DateTime.Now;  // run on 10/8/2020
DateTime dt2 = new DateTime(2020, 10, 08);

dt1 <> dt2

If you had a report that was to include records whose “Date” (but stored as a DateTime) was great than or equal to a user supplied date, and those records had a time component, they might not be included.

This bit me on a report that used a Date field on some records, that was changed to a DateTime in an upgrade. My report’s input parameter only specified the date. This made the Time portion default to 12:00:00 .

So when I had a Condition like TranDate = InputDate, it was ignoring records with TranDate having the same date, but with a time that wasn’t 12:00:00.

10/10/2020 9:53:22 != 10/10/2020

Yeah, related to time, one of the other peculiarities I’ve noticed.
After a bad Paste/Update - those odd date values will display the next time I “Copy to Excel” from the dashboard.
image

Is the Start field in the UD table a Date or DateTime?

Kind of a hack, but what if your Excel file creates a Text field using =Format(C1, "MM/dd/yyyy") Then the clipboard would have a text representation of the date - and only the date.

Date…

There are several of them in JobProd_U and all have the same issue.

I tried Paste/Updating bad values into a couple other UD tables, they didin’t exhibit this behavior.
Versions 10.1.6 and 10.2.xxx

Why I’ve thinking this is just a weird bug.
And guessing I’m one of the few who ever put a UD field in JobProd, not expecting a fix from Epicor anytime soon.

Especially if you don’t submit it as a support case - if you have can you share the number? I’m curious. I’ve always been a bit mystified how well the copy to excel paste to grid update actually works - the designer in me is appalled at all that could go wrong especially with date/time and number formats but it works surprisingly well and is very popular!

1 Like