Sha256: 9e24b461d329c01ebdcfa240505e3b144f2291ba77729d1577832378eb2a4dd6
Contents?: true
Size: 739 Bytes
Versions: 2
Compression:
Stored size: 739 Bytes
Contents
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::DateTime.class_eval do def cast_value(value) return value unless value.is_a?(::String) case value when 'infinity' then ::Float::INFINITY when '-infinity' then -::Float::INFINITY # when / BC$/ # astronomical_year = format("%04d", -value[/^\d+/].to_i + 1) # super(value.sub(/ BC$/, "").sub(/^\d+/, astronomical_year)) # else # super else if value.end_with?(' BC') astronomical_year = format("%04d", -value[/^\d+/].to_i + 1) DateTime.parse("#{value}"[0...-3].sub(/^\d+/, astronomical_year)) else super end end end def apply_seconds_precision(value); value end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activerecord-jdbc-adapter-50.2-java | lib/arjdbc/postgresql/_bc_time_cast_patch.rb |
activerecord-jdbc-adapter-50.1-java | lib/arjdbc/postgresql/_bc_time_cast_patch.rb |