diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-09 00:00:12 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-09 00:00:49 +0900 |
| commit | 1c0eb589741de4aa52ef941ff9315b34dbe48aa0 (patch) | |
| tree | 8d821cf3a7fb3f8c753dec7861ad9597f6948493 /crates/shirabe/src/repository/vcs/git_driver.rs | |
| parent | e5b789616ec4c1cbd152c5ccbefe2d27ced4a18f (diff) | |
| download | php-shirabe-1c0eb589741de4aa52ef941ff9315b34dbe48aa0.tar.gz php-shirabe-1c0eb589741de4aa52ef941ff9315b34dbe48aa0.tar.zst php-shirabe-1c0eb589741de4aa52ef941ff9315b34dbe48aa0.zip | |
feat(datetime): resolve datetime TODOs
Introduce shim functions and constants, replacing the ad-hoc chrono
format strings and parse helpers used as phase-b placeholders.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/vcs/git_driver.rs')
| -rw-r--r-- | crates/shirabe/src/repository/vcs/git_driver.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs index 4878ffe..7f8c206 100644 --- a/crates/shirabe/src/repository/vcs/git_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_driver.rs @@ -2,7 +2,7 @@ use crate::io::io_interface; use chrono::TimeZone; -use chrono::{DateTime, Utc}; +use chrono::{DateTime, FixedOffset, Utc}; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ @@ -281,7 +281,10 @@ impl GitDriver { Ok(Some(content)) } - pub fn get_change_date(&mut self, identifier: &str) -> anyhow::Result<Option<DateTime<Utc>>> { + pub fn get_change_date( + &mut self, + identifier: &str, + ) -> anyhow::Result<Option<DateTime<FixedOffset>>> { if identifier.starts_with('-') { return Err(RuntimeException { message: format!( @@ -310,7 +313,9 @@ impl GitDriver { let timestamp_str = GitUtil::parse_rev_list_output(&output, &self.inner.process); let timestamp: i64 = timestamp_str.trim().parse().unwrap_or(0); - Ok(Some(Utc.timestamp_opt(timestamp, 0).unwrap())) + Ok(Some( + Utc.timestamp_opt(timestamp, 0).unwrap().fixed_offset(), + )) } pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> { @@ -514,7 +519,10 @@ impl crate::repository::vcs::VcsDriverInterface for GitDriver { GitDriver::get_file_content(self, file, identifier) } - fn get_change_date(&mut self, identifier: &str) -> anyhow::Result<Option<DateTime<Utc>>> { + fn get_change_date( + &mut self, + identifier: &str, + ) -> anyhow::Result<Option<DateTime<FixedOffset>>> { GitDriver::get_change_date(self, identifier) } |
