module CVESchema::CVE::Timestamp

Public Class Methods

parse(timestamp) click to toggle source

Parses a CVE timestamp (ISO 8601).

@param [String] timestamp

The raw timestamp String.

@return [DateTime]

The parsed ISO 8601 timestamp.

@see github.com/CVEProject/cve-schema/blob/master/schema/v4.0/DRAFT-JSON-file-format-v4.md#timestamps

# 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