Data in ISO 8601 format gets rendered as multiple columns without date prefix by default

Answered
Corwin Sheahan asked on June 18, 2018

Hi there! 
When uploading data from a csv file, if entries in a column match the ISO 8601 date format, they are automatically split into 3 separate fields (month, day, year) even when no date format prefix (e.g. "d+", "ds+", etc.) is applied to the column header. From a user's perspective, this is confusing as the raw input data originally contained 1 field, not 3. Additionally, the output csv is modified to include 3 columns instead of 1 for date. Also, usage of "datePattern" and "dateTimePattern" to attempt to format the data is useless, since there is no column header prefix applied.

I think the bug here is in configurability. If the column is going to be automagically parsed and formatted as a date regardless of the presence of a column header prefix, then "datePattern" and "dateTimePattern" configurations should at least work on that. Better option is to only parse if there is a prefix present, or to at least offer an api configuration to prevent automatic parsing of dates in ISO 8601 format.
I've attached a file to repro this behavior

6 answers

Public
Tanya Gryshko Tanya Gryshko Flexmonster June 19, 2018

Hello, Corwin,
Thank you for writing to us!
We do agree that from a user’s perspective, raw input data with one field should be rendered into one field by default.
The current Flexmonster behavior has a historical background. When we first added date support, the only supported format was hierarchical (3 separate fields). Since then we have added more data formats but the hierarchical format remained the default one. Lots of our clients' applications depend on such default behavior. Hereby it is rather hard to make a change to a default format.
We kindly ask you to specify date prefixes in the data source to get the dates rendered into one field.
Regards,
Tanya

Public
Corwin Sheahan June 19, 2018

Hi Tanya,
 
That's reasonable. Would it be possible to add a field in the Options object which would allow for configuration, and set the default behavior to be the historical behavior? This way it still offers your clients control without breaking previous implementations.

Public
Corwin Sheahan June 19, 2018

We have users who can configure their own column headers, so it is not a reliable path forward for us to be able to consistently add headers to ISO 8601 formatted data

Public
Tanya Gryshko Tanya Gryshko Flexmonster June 20, 2018

Hi, Corwin,
Thanks for a quick reply.
We agree that configuring column headers is not a reliable path for such cases. Our team will add the global option for specifying date type in case of CSV and JSON data sources. The update will be released on July the 16th.
Would that work for you?
Regards,
Tanya

Public
Corwin Sheahan June 20, 2018

Hi Tanya,
 
Thanks for the response, that will work 🙂

Public
Tanya Gryshko Tanya Gryshko Flexmonster July 16, 2018

Hi Corwin!
I'm glad to inform you that the new minor version is already released!
New option property defaultDateType was added to specify which data type should be applied to date fields by default ("date", "date string", "year/month/day", "year/quarter/month/day" or "datetime") for CSV and JSON data sources.
Please have a look at the following sample showing how this new property is set: https://jsfiddle.net/flexmonster/x82zt5oe/.
Would be grateful for your feedback.
Regards,
Tanya

Please login or Register to Submit Answer