Class: CBOR_DIAG::App_dt

Inherits:
Object show all
Defined in:
lib/cbor-diagnostic-app/dt.rb

Overview

Using Time#iso8601 creates the following bugs:

  • dt’1970-01-01T10:00:00’ is accepted and gives local time

  • dt’1970-01-01T10:00:00.0Z’ gives an integer instead of a float

Probably should copy over Time#xmlschema and fix that for us.

Class Method Summary collapse

Class Method Details

.decode(_, s) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/cbor-diagnostic-app/dt.rb', line 9

def self.decode(_, s)
  t = Time.iso8601(s)
  if t.subsec != 0
    t.to_f
  else
    t.to_i
  end
end