module Xlsxrb::Ooxml::WorksheetWriter::TimeLike
Matches a value that claims to be a Time through is_a? without being one, such as ActiveSupport::TimeWithZone, which ‘when Time` does not match. The writers try it after their Time and Date branches, so other values never reach it. Such a value is written as the Time that to_time gives. @api private
Public Class Methods
(untyped value) → bool
Source
# File lib/xlsxrb/ooxml/worksheet_writer.rb, line 36 def self.===(value) = value.is_a?(Time)
(untyped value) → Time
Source
# File lib/xlsxrb/ooxml/worksheet_writer.rb, line 41 def self.to_time(value) seconds = value.sec + (value.respond_to?(:subsec) ? value.subsec : 0) Time.new(value.year, value.month, value.day, value.hour, value.min, seconds, value.utc_offset) end
A Time with the value’s year, month, day, hour, minute, second, and UTC offset, which keeps its wall clock.