From aecf74102692f4792f6925e6ecc7c49e3663d1cd Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Wed, 6 Dec 2023 16:18:07 -0800 Subject: [PATCH] Work around DateTime.jd fractional second bug on JRuby in named_timezones extension This switches the code to use DateTime.civil, which does not have the same bug. --- CHANGELOG | 2 ++ lib/sequel/extensions/named_timezones.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index d006902d0d..ad325616ca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ === master +* Work around DateTime.jd fractional second bug on JRuby in named_timezones extension (jeremyevans) + * Support fractional times and timestamps on SQLAnywhere (jeremyevans) * Make round_timestamps extension use Dataset#sqltime_precision for rounding Sequel::SQLTime values (jeremyevans) diff --git a/lib/sequel/extensions/named_timezones.rb b/lib/sequel/extensions/named_timezones.rb index f5e2d0cdad..9f4467dd2e 100644 --- a/lib/sequel/extensions/named_timezones.rb +++ b/lib/sequel/extensions/named_timezones.rb @@ -136,7 +136,7 @@ def convert_output_datetime_other(v, output_timezone) v = output_timezone.utc_to_local(v.new_offset(0)) # Force DateTime output instead of TZInfo::DateTimeWithOffset - DateTime.jd(v.jd, v.hour, v.minute, v.second + v.sec_fraction, v.offset, v.start) + DateTime.civil(v.year, v.month, v.day, v.hour, v.minute, v.second + v.sec_fraction, v.offset, v.start) end # :nodoc: # :nocov: