I have a method that I am building that takes in a date from a user as MM/DD/YYYY and then uses that date to query a JDE Table. In order to facilitate this I'm using the ToDate Data Conversion Service in order to change the date from a DisplayDate Format to a JDEDate Format.
The method above takes in the user's input, converts the dates to the necessary format, and then passes the information into the submethod where the query is run.
While using this method, I discovered that if the user refrains from putting in a date(meaning that the toDate service is given an empty string) the
toDate service defaults to returning the value for the current day.
Using this output would break my method as I the user would be looking for results without specified date information rather than information filtered to today's date. I've created a workaround wherein I check if the original date was empty or not before passing in the information from the ToDate service.
What I want to ask today is: Is the default return of the current day intentional? If so, is there another way of converting the date such that no default value would be given if no date was input?
On Date Conversion
-
- Posts: 15
- Joined: February 18th, 2022, 1:29 pm
- Contact:
-
- Posts: 329
- Joined: August 26th, 2021, 9:18 am
- Contact:
Re: On Date Conversion
ToDate is currently intentionally using the current date as the FromDate if nothing is passed in. You would need to do the check outside of the service.
word count: 27
-
- Posts: 472
- Joined: November 16th, 2021, 11:15 am
- Contact:
Re: On Date Conversion
I think it should throw an exception instead when blank was given to convert.
Consider this scenario:
the user is given the option to select a requested date on their order. If they choose a date too soon to today, they incur an additional charge.
There is a service to convert the requested date to the correct JDEDate format to use in some context with JDE.
If the requested date is required, there is no problem, the ToDate service would always receive an input and work.
Though if for any reason it is no longer required, it will look like it works (no exception) but will be telling JDE the user chose today as the requested date and incur and additional charge.
I talked with some other developers on this, it is not intuitive that it defaults to today
Consider this scenario:
the user is given the option to select a requested date on their order. If they choose a date too soon to today, they incur an additional charge.
There is a service to convert the requested date to the correct JDEDate format to use in some context with JDE.
If the requested date is required, there is no problem, the ToDate service would always receive an input and work.
Though if for any reason it is no longer required, it will look like it works (no exception) but will be telling JDE the user chose today as the requested date and incur and additional charge.
I talked with some other developers on this, it is not intuitive that it defaults to today
word count: 139
-
- Posts: 571
- Joined: August 26th, 2021, 9:56 am
- Contact: