Closed cschwarz007 closed 4 years ago
I can't think of anything that changed. Are you sure you're not doing any other processing on effective_date
? The JSON representation of a date looks like a string but the actual object is not a string, but rather a datetime.datetime
object. It looks like you are using English, but are you using a language other than English?
I did some debugging: Using a bare minimal DOCX template with my interview script still gives me the "Bad Date", regardless of the language setting I use (I use English and German). date-test.docx
However, using this minimal interview script gives me a correct result:
initial: True
code: |
set_language('de')
---
question:
What date shall the agreement come into effect?
decoration: calendar-alt
fields:
- Effective date: effective_date
datatype: date
default: ${ today() }
---
mandatory: True
question: |
Your document with the following date is ready: ${ effective_date.format() }
attachment:
docx template file: date-test.docx
But I searched my entire interview and except for the variable setting (mentioned in my post above) I do not process effective_date
anywhere else. Adding to my consufion: when I include ${ effective_date.format() }
in my interview, it gives me the correct output (which should be an indication that it is of the correct type, i. e. DADateTime - or not?). I am a bit lost. Anything I can do to circle in on the error?
When you did the initial docker run
, did you set LOCALE
and OTHERLOCALE
, and if so, what were the settings? https://docassemble.org/docs/docker.html#LOCALE
Alternatively, did you set os locale
and other os locales
in your Configuration, and if so, what are the settings? Also, if you did set those settings, did you do a docker stop
/docker start
afterwards? https://docassemble.org/docs/config.html#os%20locale
I did not set LOCALE
or OTHERLOCALE
specifically...
The os locale
and other os locale
in the config file are set to the initial values of the docker image:
locale: en_US.utf8
os locale: en_US.UTF-8 UTF-8
Anything I need to change on these settings?
Your server is set up as a provincial American server. Locales need to be set up at the operating system level or else Python will not have access to the locale information it needs.
Try setting the following in you Configuration:
os locale: en_US.UTF-8 UTF-8
other os locales:
- de_DE.UTF-8 UTF-8
- de_CH.UTF-8 UTF-8
(you might not need the second one; that's for Switzerland.)
And then you need to do docker stop -t 600 <containerID>
followed by docker start <containerID>
. Then when the OS starts up, it will configure the available locales so that de_DE is supported.
After solving issue #325, this problem is solved too. It apparently had to do with the language setting for the template. I did not need to change any locales...
I am setting a variable
effective_date
as follows:to use it in my DOCX template ("Agreement ... made and entered as of {{ effective_date }}...").
However, when the attachment is generated it gives me a "Bad date" in the PDF. The variable is set correctly:
"effective_date": "2020-11-23T00:00:00+01:00",
I am using v1.1.108 and could swar that it used to work before (1.1.104 and prior)... Anything changed?