Unparsable Date

I have several date fields in my datamapper. It works great when the dates exist, however if no date exists, then each subsequent date extractions and detail fields no longer display. Is there a way to allow the extraction even if the date field is null?

Add something like the following in your date field’s Post function:

trim().concat(“1900/01/01”).substring(0,10);

This will replace any empty/null date with a default value. Make sure the default value you specify uses the same format as the dates you are extracting.

2 Likes

With 2020.1 you need to use single quotes instead of double quotes

@UomoDelGhiaccio: uhm… no you don’t!
What might happen however, is that if you cut&paste the code from this page the double quotes may get replaced with a different set of quotes (open quote and closing quote), depending on your locale settings. But just like in any JavaScript code, you can use either single or double quotes.

Well, I did cut and paste and thought that it was weird. I’ve seen this before with dashes where I have to retype the dash. I didn’t think about the different characters for quotes. Sorry for the false alarm.