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 1
1
Unreleased Changes
2
2
------------------
3
3
4
+ * Issue - Ensure no UTC offset when deserializing ` iso8601 ` timestamp format values.
5
+
4
6
* Feature - Bump User Agent to version 2.1 to track business metrics. This changes the User Agent plugin order to be just before sending.
5
7
6
8
3.196.1 (2024-05-14)
Original file line number Diff line number Diff line change @@ -90,16 +90,16 @@ def deserialize_number(str)
90
90
end
91
91
end
92
92
93
- # @param [String, Integer ] value
93
+ # @param [String] value
94
94
# @return [Time]
95
95
def deserialize_time ( value )
96
96
case value
97
97
when nil then nil
98
- when /^\d +$/ then Time . at ( value . to_i )
98
+ when /^[ \d .] +$/ then Time . at ( value . to_f ) . utc
99
99
else
100
100
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
103
103
rescue ArgumentError
104
104
raise "unhandled timestamp format `#{ value } '"
105
105
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