novacode-nl / python-formio-data

Python object API for Formio.js (JSON) data
MIT License
19 stars 10 forks source link

[BUG] DateTime - Invalid isoformat string #28

Open lieblinger opened 2 years ago

lieblinger commented 2 years ago

The following issue pops up by printing a form with DateTime component and applies to latest version of python-formio-data (4.0):

ValueError: Invalid isoformat string: '2022-04-25T19:29:58.000Z'

Error to render compiling AST
ValueError: Invalid isoformat string: '2022-04-25T19:29:58.000Z'
Template: formio_report_qweb.report_formio_form_template
Path: /t/div/div[2]/t
Node: <t t-foreach="o._formio.components.items()" t-as="component">
                    <t t-set="component" t-value="component[1]"/>
                    <t t-call="formio_report_qweb.component"/>
                </t>

Date Format String in Form Builder Component:

dd/MM/yyyy HH:mm
bobslee commented 2 years ago

I can't reproduce this datetime component (with your format) to store with the fraction 000Z. Can you provide the full JSON of the component?

Apparently there's a need to parse the datetime value to cover such case. I wasn't aware of this fraction, but found some info:

https://stackoverflow.com/questions/16151383/what-does-the-000z-of-yyyy-mm-ddt000000-000z-mean .000 is the fraction of a second and Z indicates UTC timezone.

https://stackoverflow.com/questions/28949911/what-does-this-format-means-t000000-000z

bobslee commented 1 year ago

@lieblinger possible to test this with the affected form and the latest version of the library?

I did some persing improvements in datetimeComponent.