Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error generating the document Invalid date string (12 Déc 2022) passed into 'format_datetime()' filter #282

Closed
kamz69 opened this issue Dec 8, 2022 · 4 comments
Assignees
Labels
bug Something isn't working stale

Comments

@kamz69
Copy link

kamz69 commented Dec 8, 2022

In the report template, i added the following jinja code to get a nicer formated date :
{{ project.end_date | format_datetime("d/m/Y") }}

When the project.end_date is in november, there is no issue but when it is set to December (décembre in french), I got this error :
image

I use the last version of GhostWriter.

@kamz69 kamz69 added the bug Something isn't working label Dec 8, 2022
@chrismaddalena
Copy link
Collaborator

Hey @kamz69,

Thank you for reporting this. A while back, I switched to Python's dateutils for better support for non-English month names. It seems to not like Décembre. I assume any string with an accent mark might cause an issue.

from dateutil.parser import parse
parse("12 Déc 2022")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/dateutil/parser/_parser.py", line 1368, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/dateutil/parser/_parser.py", line 643, in parse
    raise ParserError("Unknown string format: %s", timestr)
dateutil.parser._parser.ParserError: Unknown string format: 12 Déc 2022

I get the same result with locale set to fr_FR. I've found some conflicting information on the subject, but it may be necessary to provide translations (e.g., Déc == Dec) for the initial date string formatting. I'll look into more to see what the best solution might be.

@kamz69
Copy link
Author

kamz69 commented Dec 9, 2022

Hello @chrismaddalena ,

Very fast response 👍
ok thank you, have a nice day.

Copy link

This issue has been labeled as stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jun 19, 2024
Copy link

github-actions bot commented Jul 4, 2024

This issue is closed because it has been inactive for 14 days since being labeled stale. Feel free to re-open the issue with a comment. If this needs further discussion (e.g., a feature request), it might be better to open a topic under the Discussions tab.

@github-actions github-actions bot closed this as completed Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
Status: No status
Development

No branches or pull requests

2 participants