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/svn_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/svn_driver.rs')
| -rw-r--r-- | crates/shirabe/src/repository/vcs/svn_driver.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs index ef8787a..f4e2bba 100644 --- a/crates/shirabe/src/repository/vcs/svn_driver.rs +++ b/crates/shirabe/src/repository/vcs/svn_driver.rs @@ -1,7 +1,7 @@ //! ref: composer/src/Composer/Repository/Vcs/SvnDriver.php use anyhow::Result; -use chrono::{DateTime, TimeZone, Utc}; +use chrono::{DateTime, FixedOffset, Utc}; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ @@ -296,7 +296,7 @@ impl SvnDriver { Ok(Some(output)) } - pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<Utc>>> { + pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> { let identifier = format!("/{}/", trim(identifier, Some("/"))); let (path, rev) = if let Ok(Some(m)) = @@ -329,10 +329,9 @@ impl SvnDriver { .unwrap_or(false) { let date_str = m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default(); - // PHP: new \DateTimeImmutable($match[1], new \DateTimeZone('UTC')) - return Ok(Utc - .datetime_from_str(date_str.trim(), "%Y-%m-%d %H:%M:%S %z") - .ok()); + return Ok(shirabe_php_shim::date_create::<Utc>(date_str.trim()) + .ok() + .map(|d| d.fixed_offset())); } } } @@ -638,7 +637,10 @@ impl crate::repository::vcs::VcsDriverInterface for SvnDriver { SvnDriver::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>>> { SvnDriver::get_change_date(self, identifier) } |
