Built in service or any other way to identify invalid date

Hello All,

I have a requirement.
Do we have any built in service that can be used to identify if the input date is invalid or not.
Example: 2929-07-28 should be returned as invalid.

Urgent help needed!

Regards,
Khushaboo Shandilya

Hi Khushaboo,

We can check for the date formats using built in service dateTimeFormat and that will fail if there is invalid date.

But there is no straight built in service to confirm if the date is valid or not as far as I know.

Regards,
Firoz N

1 Like

Hi Khushaboo,

your example is a valid date (even when 909 years in the future) as per the accordning ISO documentation for dates.
If you want to exclude dates that far in the future, you will have to validate it by your self.

There is an interesting discussion about calculating date differences in this topic:

Regards,
Holger

Hi,

Just wondering: Are you trying to develop/implementing this logic in wm.io/cloud tenant or on-prem IS instance setup thru?

Anyways there is none OOTB service available to check and scan if it’s a future date (reject) vs current date (valid case) and so may need to go with custom java code validation techniques etc…

HTH,
RMG

For those interested, attached is a quick sample of a service I just put together in webMethods.io Integration FlowService without any java coding required using the public date services. It could be improved, but gives you an idea.

This checks for a historical date, to make sure someone isn’t older than 150 :slight_smile:
but the check could be flipped in the opposite direction.

I couldn’t attach the zip export here as it’s not an allowed extension, so to use:

  1. open the text file and copy the json content into your paste buffer
  2. Create/open a webmethods.io flow service in a project
  3. Add an input variable called dateString, and an output variable called valid
  4. Add one empty transform pipeline
  5. Paste using the toolbar icon

dateValidation.txt (11.5 KB)

Thanks a lot and time Dave on putting this info to SAG community :slight_smile:

Cheers from the tech community!
RMG

Hi,
Can you explain your use-case and reason why the above date should be invalid?