Skip to content

Commit 48e1b0f

Browse files
committed
Fix timestamp failures
1 parent 3854661 commit 48e1b0f

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

gems/smithy-schema/lib/smithy-schema/time_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Schema
55
# A module that provides helper methods to convert Time objects
66
# based on the given TimestampFormat trait.
77
# @api private
8+
# TODO: need to handle fractional secs
89
module TimeHelper
910
class << self
1011
# @param [Time] time

gems/smithy-schema/spec/smithy-schema/time_helper_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ module Smithy
77
module Schema
88
describe TimeHelper do
99
describe '#time' do
10-
let(:time) { Time.new(2002, 10, 31) }
10+
let(:time) { Time.utc(2002, 10, 31) }
1111

1212
it 'returns as http-date format' do
13-
expect(subject.time(time, 'http-date')).to eq('2002-10-31T08:00:00Z')
13+
expect(subject.time(time, 'http-date')).to eq('2002-10-31T00:00:00Z')
1414
end
1515

1616
it 'returns as date-time format' do
17-
expect(subject.time(time, 'date-time')).to eq('Thu, 31 Oct 2002 08:00:00 GMT')
17+
expect(subject.time(time, 'date-time')).to eq('Thu, 31 Oct 2002 00:00:00 GMT')
1818
end
1919

2020
it 'returns as epoch-seconds format' do
21-
expect(subject.time(time, 'epoch-seconds')).to eq(1_036_051_200)
21+
expect(subject.time(time, 'epoch-seconds')).to eq(1_036_022_400)
2222
end
2323

2424
it 'raises when given time is invalid ' do

0 commit comments

Comments
 (0)