File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,13 @@ def self.parse_iso8601_timestamp(timestamp_value)
249249 if timestamp_value =~ /\A (\d {4}-\d {2}-\d {2}) (\d {2}:\d {2}:\d {2}(?:\. \d +)?)(?: )\+ 0000\z /
250250 timestamp_value = "#{ $1} T#{ $2} +00:00"
251251 end
252+ # Ensure the timestamp explicitly includes a UTC indicator
253+ return nil unless timestamp_value =~ /(Z|\+ 00:00|\+ 0000)\z /
252254 return nil unless iso8601_timestamp? ( timestamp_value )
253255 t = Time . parse ( timestamp_value ) rescue nil
254256 return nil unless t
257+ # The check for UTC indicator in regex makes this t.utc? or t.utc_offset == 0 redundant
258+ # but kept for safety, though it should always be true now if Time.parse succeeds.
255259 ( t . utc? || t . utc_offset == 0 ) ? t . to_i : nil
256260 end
257261
You can’t perform that action at this time.
0 commit comments