このコミットが含まれているのは:
2026-07-16 12:39:35 +09:00
コミット 0224c4d2f4
14個のファイルの変更371行の追加130行の削除
+6 -23
ファイルの表示
@@ -81,26 +81,16 @@ class PostMetadataFetcher
day = match[3].to_i
hour = match[4].to_i
minute = match[5]&.to_i || 0
second = match[6]&.to_i || 0
fraction = match[7]
offset = match[8]
whole_second = second + fractional_seconds(fraction)
from =
timestamp =
if offset.present?
Time.new(year, month, day, hour, minute, whole_second, parse_offset(offset)).in_time_zone
Time.new(year, month, day, hour, minute, 0, parse_offset(offset)).in_time_zone
else
Time.zone.local(year, month, day, hour, minute, whole_second)
end
before =
if fraction.present?
from + (10**(-fraction.length))
elsif match[6].present?
from + 1.second
elsif match[5].present?
from + 1.minute
else
from + 1.hour
Time.zone.local(year, month, day, hour, minute)
end
from = timestamp.change(sec: 0, nsec: 0)
before = from + 1.minute
[from, before]
end
@@ -110,12 +100,6 @@ class PostMetadataFetcher
value.match?(/\A[+-]\d{2}:\d{2}\z/) ? value : "#{ value[0, 3] }:#{ value[3, 2] }"
end
def self.fractional_seconds value
return 0 if value.blank?
Rational(value.to_i, 10**value.length)
end
def self.serialise_time value
return nil if value.nil?
@@ -126,6 +110,5 @@ class PostMetadataFetcher
:original_created_range,
:parse_timestamp_range,
:parse_offset,
:fractional_seconds,
:serialise_time
end