docassemble icon indicating copy to clipboard operation
docassemble copied to clipboard

Date and time format problem

Open Electricity2015 opened this issue 1 year ago • 1 comments

image

The date and time are not formated like in metadata

the result is :

image

Electricity2015 avatar Jul 15 '24 09:07 Electricity2015

The metadata settings are date format and time format, not format date and format time. https://docassemble.org/docs/initial.html#date%20format

A datatype: time field defines a datetime.time object. https://docassemble.org/docs/fields.html#time

Thus when the object is reduced to text, the textual representation depends on the datetime package, which doesn't know anything about docassemble or docassemble's metadata settings.

The metadata setting time format is used when format_time() is called without a format parameter.

metadata:
  date format: dd.MM.YYYY
  time format: HH.mm
---
question: |
  Date and time
fields:
  - Date: example_date
    datatype: date
  - Time: example_time
    datatype: time
---
mandatory: True
question: |
  Text representation
subquestion: |
  Date: ${ example_date }
  
  Time: ${ format_time(example_time) }

jhpyle avatar Jul 15 '24 10:07 jhpyle

Closing due to lack of activity.

jhpyle avatar Sep 22 '24 19:09 jhpyle