aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs/github_driver.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-09 00:00:12 +0900
committernsfisis <nsfisis@gmail.com>2026-06-09 00:00:49 +0900
commit1c0eb589741de4aa52ef941ff9315b34dbe48aa0 (patch)
tree8d821cf3a7fb3f8c753dec7861ad9597f6948493 /crates/shirabe/src/repository/vcs/github_driver.rs
parente5b789616ec4c1cbd152c5ccbefe2d27ced4a18f (diff)
downloadphp-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/github_driver.rs')
-rw-r--r--crates/shirabe/src/repository/vcs/github_driver.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs
index 45ba7b7..aa1e135 100644
--- a/crates/shirabe/src/repository/vcs/github_driver.rs
+++ b/crates/shirabe/src/repository/vcs/github_driver.rs
@@ -2,13 +2,14 @@
use crate::io::io_interface;
use anyhow::Result;
-use chrono::{DateTime, Utc};
+use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, RuntimeException, array_diff, array_key_exists, array_map,
- array_search_mixed, base64_decode, basename, count, empty, explode, extension_loaded, in_array,
- parse_url_all, sprintf, strpos, strtolower, substr, trim, urlencode,
+ DATE_RFC3339, InvalidArgumentException, PhpMixed, RuntimeException, array_diff,
+ array_key_exists, array_map, array_search_mixed, base64_decode, basename, count, empty,
+ explode, extension_loaded, in_array, parse_url_all, sprintf, strpos, strtolower, substr, trim,
+ urlencode,
};
use crate::cache::Cache;
@@ -821,7 +822,7 @@ impl GitHubDriver {
Ok(Some(content))
}
- 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>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_change_date(identifier);
}
@@ -851,11 +852,8 @@ impl GitHubDriver {
_ => String::new(),
};
- Ok(Some(
- DateTime::parse_from_rfc3339(&date_str)
- .map(|dt| dt.with_timezone(&Utc))
- .unwrap_or_else(|_| Utc::now()),
- ))
+ let date: DateTime<FixedOffset> = shirabe_php_shim::date_create(&date_str)?;
+ Ok(Some(date))
}
pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
@@ -1364,7 +1362,10 @@ impl crate::repository::vcs::VcsDriverInterface for GitHubDriver {
GitHubDriver::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>>> {
GitHubDriver::get_change_date(self, identifier)
}