aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs/git_bitbucket_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/git_bitbucket_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/git_bitbucket_driver.rs')
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index f8cfd7a..de1f814 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -2,13 +2,13 @@
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, LogicException, PhpMixed, RuntimeException, array_key_exists,
- array_search_mixed, extension_loaded, http_build_query_mixed, implode, in_array, is_array,
- sprintf, strpos,
+ DATE_RFC3339, InvalidArgumentException, LogicException, PhpMixed, RuntimeException,
+ array_key_exists, array_search_mixed, extension_loaded, http_build_query_mixed, implode,
+ in_array, is_array, sprintf, strpos,
};
use crate::cache::Cache;
@@ -461,7 +461,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- 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(fallback) = self.fallback_driver.as_mut() {
return fallback.get_change_date(identifier);
}
@@ -486,11 +486,8 @@ impl GitBitbucketDriver {
.fetch_with_oauth_credentials(&resource, false)?
.decode_json()?;
- // TODO(phase-b): port PHP `new \DateTimeImmutable($commit['date'])`
let date_str = commit.get("date").and_then(|v| v.as_string()).unwrap_or("");
- let date: DateTime<Utc> = chrono::DateTime::parse_from_rfc3339(date_str)
- .map_err(|e| anyhow::anyhow!(e))?
- .with_timezone(&Utc);
+ let date: DateTime<FixedOffset> = shirabe_php_shim::date_create(date_str)?;
Ok(Some(date))
}
@@ -920,7 +917,10 @@ impl crate::repository::vcs::VcsDriverInterface for GitBitbucketDriver {
GitBitbucketDriver::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>>> {
GitBitbucketDriver::get_change_date(self, identifier)
}