From 1c0eb589741de4aa52ef941ff9315b34dbe48aa0 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 9 Jun 2026 00:00:12 +0900 Subject: 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) --- crates/shirabe/src/advisory/partial_security_advisory.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'crates/shirabe/src/advisory/partial_security_advisory.rs') diff --git a/crates/shirabe/src/advisory/partial_security_advisory.rs b/crates/shirabe/src/advisory/partial_security_advisory.rs index 2062570..f72ecaa 100644 --- a/crates/shirabe/src/advisory/partial_security_advisory.rs +++ b/crates/shirabe/src/advisory/partial_security_advisory.rs @@ -4,10 +4,10 @@ use crate::advisory::AnySecurityAdvisory; use crate::advisory::SecurityAdvisory; use crate::package::version::VersionParser; use anyhow::Result; -use chrono::{DateTime, TimeZone, Utc}; +use chrono::{DateTime, Utc}; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::Preg; -use shirabe_php_shim::{PhpMixed, UnexpectedValueException}; +use shirabe_php_shim::{DATE_RFC3339, PhpMixed, UnexpectedValueException}; use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::SimpleConstraint; @@ -57,12 +57,9 @@ impl PartialSecurityAdvisory { && data.contains_key("reportedAt"); if has_full_data { - let reported_at: DateTime = Utc - .datetime_from_str( - data["reportedAt"].as_string().unwrap_or(""), - "%Y-%m-%dT%H:%M:%S+00:00", - ) - .unwrap_or_default(); + let reported_at: DateTime = + shirabe_php_shim::date_create(data["reportedAt"].as_string().unwrap_or("")) + .unwrap_or_default(); let sources: Vec> = data["sources"] .as_list() .map(|list| { -- cgit v1.3.1