Skip to content

Commit

Permalink
feat: get local time offset
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
  • Loading branch information
simonsan committed Mar 19, 2024
1 parent fe4e0b3 commit 4be9ae5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/core/src/domain/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,16 @@ pub fn convert_naive_to_utc_date_time(
Ok(date_time.into())

Check warning on line 980 in crates/core/src/domain/time.rs

View check run for this annotation

Codecov / codecov/patch

crates/core/src/domain/time.rs#L980

Added line #L980 was not covered by tests
}

/// Get the local time zone offset to UTC to guess the time zones
///
/// # Returns
///
/// The local time zone offset
#[must_use]
pub fn get_local_time_zone_offset() -> i32 {
Local::now().offset().local_minus_utc()

Check warning on line 990 in crates/core/src/domain/time.rs

View check run for this annotation

Codecov / codecov/patch

crates/core/src/domain/time.rs#L989-L990

Added lines #L989 - L990 were not covered by tests
}

/// Wrapper for the UTC date time to store in the database
#[derive(Debug, Serialize, Deserialize, Hash, Clone, Copy, Eq, PartialEq, PartialOrd, Ord)]
pub struct PaceStorageDateTime(DateTime<Utc>);
Expand Down

0 comments on commit 4be9ae5

Please sign in to comment.