Skip to content

Commit

Permalink
Remove timezone from python datetime string formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jnj16180340 authored and bovee committed Jun 18, 2022
1 parent 4f35ee5 commit b0283c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions entab-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ fn py_from_value(value: Value, py: Python) -> PyResult<PyObject> {
Value::Null => py.None().as_ref(py).into(),
Value::Boolean(b) => b.to_object(py),
Value::Datetime(d) => {
// return an ISO 8601 formatted string
d.format("%+").to_string().to_object(py)
// NB: For files without timezone data (and all NaiveDateTime?),
// .format("%+") panics. So timezone is omitted
d.format("%Y-%m-%dT%H:%M:%S%.f").to_string().to_object(py)
// TODO: it would be nice to use Python's built-in datetime, but that doesn't appear to
// be abi3-compatible right now
// let timestamp = d.timestamp_millis() as f64 / 1000.;
Expand Down

0 comments on commit b0283c4

Please sign in to comment.