From 5835bc4951588cd0275e6a2437a42feca1f2a695 Mon Sep 17 00:00:00 2001 From: Gevorg Hindoyan <3110467+hingev@users.noreply.github.com> Date: Sat, 8 Aug 2020 13:17:31 +0400 Subject: [PATCH] Fix NaiveDate parse_from_str argument order The [documentation](https://docs.rs/chrono/0.4.13/chrono/naive/struct.NaiveDate.html#method.parse_from_str) specifies that `NaiveDate::parse_from_str` takes two arguments: value and format, in respective order. Due to this, `DATE` fields could not be read into `NaiveDate`... and I have ptsd. --- sqlx-core/src/sqlite/types/chrono.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlx-core/src/sqlite/types/chrono.rs b/sqlx-core/src/sqlite/types/chrono.rs index c94ed8164..cd01c3bde 100644 --- a/sqlx-core/src/sqlite/types/chrono.rs +++ b/sqlx-core/src/sqlite/types/chrono.rs @@ -169,7 +169,7 @@ impl<'r> Decode<'r, Sqlite> for NaiveDateTime { impl<'r> Decode<'r, Sqlite> for NaiveDate { fn decode(value: SqliteValueRef<'r>) -> Result { - Ok(NaiveDate::parse_from_str("%F", value.text()?)?) + Ok(NaiveDate::parse_from_str(value.text()?, "%F")?) } }