Skip to main content
Question

Why are empty values replaced with today's date in the DateFormatter

  • September 13, 2016
  • 3 replies
  • 8 views

fmelizard
Contributor
Forum|alt.badge.img+17

Some of my features are sent to the DateFormatter with empty values in the formatted attribute, but they come out with today's date. Why does this happen, and how do I stop this?

3 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • September 13, 2016

The DateFormatter (edit: not DateSetter) is set to use Automatic detection of the date format. When set this way, the transformer tries many different methods to produce a valid date. However one of these methods interprets a blank as the current date. To avoid this, please use specify a date format, or test for blank values before formatting.


david_r
Evangelist
  • September 14, 2016
daveatsafe wrote:

The DateFormatter (edit: not DateSetter) is set to use Automatic detection of the date format. When set this way, the transformer tries many different methods to produce a valid date. However one of these methods interprets a blank as the current date. To avoid this, please use specify a date format, or test for blank values before formatting.

I'm guessing you meant the DateFormatter and not the DateSetter? :-)

takashi
Influencer
  • January 14, 2017

I was not able to reproduce the issue, with FME 2016.1.3.1. e.g.

0684Q00000ArJnKQAV.png

Result: the empty attribute has not been touched, "today" has been replaced with today's date.

Attribute(encoded: utf-8): `_date_empty' has value `'
Attribute(encoded: utf-8): `_date_today' has value `20170114'
However, it seems that the DateFormatter always considers the empty string as a valid date format string. That is, the transformer does nothing for empty attributes even if you set a non-empty value or the null to the "Set Invalid Date Attributes To" parameter. I don't know if it's an intentional behavior.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings