File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 11Unreleased Changes
22------------------
33
4+ * Issue - Ensure no UTC offset when deserializing ` iso8601 ` timestamp format values.
5+
46* Feature - Bump User Agent to version 2.1 to track business metrics. This changes the User Agent plugin order to be just before sending.
57
683.196.1 (2024-05-14)
Original file line number Diff line number Diff line change @@ -90,16 +90,16 @@ def deserialize_number(str)
9090 end
9191 end
9292
93- # @param [String, Integer ] value
93+ # @param [String] value
9494 # @return [Time]
9595 def deserialize_time ( value )
9696 case value
9797 when nil then nil
98- when /^\d +$/ then Time . at ( value . to_i )
98+ when /^[ \d .] +$/ then Time . at ( value . to_f ) . utc
9999 else
100100 begin
101- fractional_time = Time . parse ( value ) . utc . to_f
102- Time . at ( fractional_time )
101+ fractional_time = Time . parse ( value ) . to_f
102+ Time . at ( fractional_time ) . utc
103103 rescue ArgumentError
104104 raise "unhandled timestamp format `#{ value } '"
105105 end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require_relative '../spec_helper'
4+
5+ module Aws
6+ describe Util do
7+ describe '.deserialize_time' do
8+ let ( :time ) { Time . at ( 946_845_296.123 ) }
9+
10+ it 'correctly parses when given value is nil' do
11+ expect ( Util . deserialize_time ( nil ) ) . to be_nil
12+ end
13+
14+ it 'correctly parses when given value is a numeric string' do
15+ value = time . to_f . to_s
16+ expect ( Util . deserialize_time ( value ) ) . to eq ( time . utc )
17+ end
18+
19+ it 'correctly parses when given value is a string' do
20+ value = time . strftime '%Y-%m-%d %H:%M:%S.%N %z' # preserves frac secs
21+ expect ( Util . deserialize_time ( value ) ) . to eq ( time . utc )
22+ end
23+ end
24+ end
25+ end
You can’t perform that action at this time.
0 commit comments