Skip to content

Commit

Permalink
Fix ValueError in datetimeComponent value setter exception handler:
Browse files Browse the repository at this point in the history
Exception thrown:
ValueError: <class 'TypeError'>: "fromisoformat: argument must be
str" while evaluating

The value should be a string, so call isformat() on the datetime
object.
  • Loading branch information
bobslee committed May 5, 2024
1 parent 829e37e commit b9f1a43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Changelog

## 1.2.7

Fix ValueError in `datetimeComponent` value setter exception handler:\
`ValueError: <class 'TypeError'>: "fromisoformat: argument must be str" while evaluating`

## 1.2.6

- Fix `datetimeComponent` value setter, to properyly parse when the
- Fix `datetimeComponent` value setter, to properly parse when the
`enableTime` property is `False`.\
This fixes a bug/regression in version 1.2.3.
- Update README concerning the datetime component value.
Expand Down
2 changes: 1 addition & 1 deletion formiodata/components/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def value(self, value):
py_format = py_format.replace(fm_formio, fm_py)
done_date_part = True
py_dt = datetime.strptime(value, py_format)
val = datetime.fromisoformat(py_dt)
val = py_dt.isoformat()
super(self.__class__, self.__class__).value.fset(self, val)
return
else:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "formio-data"
version = "1.2.6"
version = "1.2.7"
homepage = "https://github.com/novacode-nl/python-formio-data"
description = "formio.js JSON-data API"
readme = "README.md"
Expand Down

0 comments on commit b9f1a43

Please sign in to comment.