@@ -252,20 +252,20 @@ def self.parse_iso8601_timestamp(timestamp_value)
252252 timestamp_value = "#{ $1} T#{ $2} +00:00"
253253 end
254254 return nil unless iso8601_timestamp? ( timestamp_value )
255-
255+
256256 # Manual parsing to avoid mocked Time.iso8601
257257 if timestamp_value =~ /\A (\d {4})-(\d {2})-(\d {2})[T ](\d {2}):(\d {2}):(\d {2})(?:\. (\d +))?(Z|\+ 00:00|\+ 0000)?\z /
258258 year , month , day , hour , min , sec , frac = $1. to_i , $2. to_i , $3. to_i , $4. to_i , $5. to_i , $6. to_i , $7
259259 tz_suffix = $8
260-
260+
261261 # Validate date/time ranges
262262 return nil if month < 1 || month > 12
263263 return nil if day < 1 || day > 31
264264 return nil if hour > 23 || min > 59 || sec > 59
265-
265+
266266 # Only accept UTC timestamps
267- return nil unless tz_suffix && ( tz_suffix == 'Z' || tz_suffix == ' +00:00' || tz_suffix == ' +0000' )
268-
267+ return nil unless tz_suffix && ( tz_suffix == "Z" || tz_suffix == " +00:00" || tz_suffix == " +0000" )
268+
269269 # Convert to Unix timestamp manually to avoid mocked Time.new
270270 # This is a simplified calculation that works for valid dates
271271 begin
@@ -274,21 +274,21 @@ def self.parse_iso8601_timestamp(timestamp_value)
274274 days_since_epoch = Date . new ( year , month , day ) . mjd - Date . new ( 1970 , 1 , 1 ) . mjd
275275 seconds_in_day = hour * 3600 + min * 60 + sec
276276 unix_timestamp = days_since_epoch * 86400 + seconds_in_day
277-
277+
278278 # Handle fractional seconds
279279 if frac
280280 fractional = ( "0.#{ frac } " . to_f )
281281 unix_timestamp += fractional
282282 end
283-
283+
284284 # Use Time.at which should work even in mocked environment
285285 time = Time . at ( unix_timestamp )
286286 return time . utc
287287 rescue StandardError
288288 return nil
289289 end
290290 end
291-
291+
292292 nil
293293 end
294294
0 commit comments