Module: CVESchema::CVE::Timestamp

Defined in:
lib/cve_schema/cve/timestamp.rb

Class Method Summary collapse

Class Method Details

.parse(timestamp) ⇒ DateTime

Parses a CVE timestamp (ISO 8601).

Parameters:

  • timestamp (String)

    The raw timestamp String.

Returns:

  • (DateTime)

    The parsed ISO 8601 timestamp.

See Also:



18
19
20
21
22
# File 'lib/cve_schema/cve/timestamp.rb', line 18

def self.parse(timestamp)
  DateTime.iso8601(timestamp)
rescue Date::Error
  raise InvalidJSON.new("invalid ISO-8601 timestamp: #{timestamp.inspect}")
end