Skip to content

Commit 5835bc4

Browse files
hingevabonander
authored andcommitted
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.
1 parent fd25a75 commit 5835bc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sqlx-core/src/sqlite/types/chrono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl<'r> Decode<'r, Sqlite> for NaiveDateTime {
169169

170170
impl<'r> Decode<'r, Sqlite> for NaiveDate {
171171
fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError> {
172-
Ok(NaiveDate::parse_from_str("%F", value.text()?)?)
172+
Ok(NaiveDate::parse_from_str(value.text()?, "%F")?)
173173
}
174174
}
175175

0 commit comments

Comments
 (0)