fix handling of the old database for in command

This commit is contained in:
Abraham Toriz 2021-07-17 22:15:03 -05:00
parent ee44b22efd
commit acf2e30883
No known key found for this signature in database
GPG Key ID: D5B4A746DB5DD42A
3 changed files with 4 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/target
fake_old_config.yml
.env
timetrap.sqlite3

View File

@ -75,7 +75,7 @@ impl<'a> Command<'a> for InCommand {
mod tests {
use pretty_assertions::assert_eq;
use ansi_term::Color::Yellow;
use chrono::TimeZone;
use chrono::{TimeZone, Local};
use crate::test_utils::PrettyString;
use crate::database::SqliteDatabase;
@ -183,7 +183,7 @@ mod tests {
let e = d.entries_full(None, None).unwrap().into_iter().next().unwrap();
assert_eq!(e.note, Some("hola".into()));
assert_eq!(e.start, Utc.from_utc_datetime(&now.naive_local()));
assert_eq!(e.start, Utc.from_utc_datetime(&now.with_timezone(&Local).naive_local()));
assert_eq!(e.end, None);
assert_eq!(e.sheet, "default".to_owned());

View File

@ -30,7 +30,7 @@ fn local_to_utc(t: DateTime<Utc>) -> Result<DateTime<Utc>> {
///
/// Used to insert times into the old database format.
fn utc_to_local(t: DateTime<Utc>) -> DateTime<Utc> {
Utc.from_utc_datetime(&t.naive_local())
Utc.from_utc_datetime(&t.with_timezone(&Local).naive_local())
}
/// Maps an entire vector of entries from the old database format to the new,