Documentation ¶
Overview ¶
package edtf provides method for parsing Extended DateTime Format (EDTF) date strings. It is compliant with Level 0, Level 1 and Level 2 of the EDTF specification (2019).
Index ¶
- Constants
- func Invalid(label string, edtf_str string) error
- func IsDeprecated(str string) bool
- func IsInvalid(e error) bool
- func IsNotImplemented(e error) bool
- func IsNotSet(e error) bool
- func IsOpen(s string) bool
- func IsUnknown(s string) bool
- func IsUnrecognized(e error) bool
- func IsUnspecified(s string) bool
- func IsUnsupported(e error) bool
- func NotImplemented(label string, edtf_str string) error
- func NotSet() error
- func ReplaceDeprecated(old string) (string, error)
- func Unrecognized(label string, edtf_str string) error
- func Unsupported(label string, edtf_str string) error
- type Date
- type DateRange
- type DateSpan
- type EDTFDate
- type InvalidError
- type NotImplementedError
- type NotSetError
- type Precision
- type Timestamp
- type UnrecognizedError
- type UnsupportedError
- type YMD
Constants ¶
const APPROXIMATE string = "~"
const HMS_LOWER string = "00:00:00"
const HMS_UPPER string = "23:59:59"
const MAX_YEARS int = 9999 // This is a Golang thing
const NEGATIVE string = "-"
const OPEN string = ".."
const OPEN_2012 string = "open"
const UNCERTAIN string = "?"
const UNCERTAIN_AND_APPROXIMATE string = "%"
const UNKNOWN string = UNSPECIFIED // this code was incorrectly referring to "unspecified" as "unknown"
const UNKNOWN_2012 string = UNSPECIFIED_2012
const UNSPECIFIED string = ""
const UNSPECIFIED_2012 string = "uuuu"
Variables ¶
This section is empty.
Functions ¶
func IsDeprecated ¶ added in v1.0.0
IsDeprecated returns a boolean flag indicating whether 'str' is considered a deprecated EDTF value.
func IsNotImplemented ¶
func IsOpen ¶ added in v0.3.0
Return a boolean value indicating whether a string is considered to be an "open" EDTF date.
func IsUnknown ¶ added in v0.3.0
Return a boolean value indicating whether a string is considered to be an "unknown" EDTF date.
func IsUnrecognized ¶ added in v0.2.0
func IsUnspecified ¶ added in v0.3.0
Return a boolean value indicating whether a string is considered to be an "unspecified" EDTF date.
func IsUnsupported ¶
func NotImplemented ¶
func ReplaceDeprecated ¶ added in v1.0.0
ReplaceDeprecated returns the current value for 'old'.
func Unrecognized ¶ added in v0.2.0
func Unsupported ¶
Types ¶
type Date ¶
type Date struct { DateTime string `json:"datetime,omitempty"` Timestamp *Timestamp `json:"timestamp,omitempty"` YMD *YMD `json:"ymd"` Uncertain Precision `json:"uncertain,omitempty"` Approximate Precision `json:"approximate,omitempty"` Unspecified Precision `json:"unspecified,omitempty"` Precision Precision `json:"precision,omitempty"` Open bool `json:"open,omitempty"` Unknown bool `json:"unknown,omitempty"` Inclusivity Precision `json:"inclusivity,omitempty"` }
type DateRange ¶
type EDTFDate ¶
type EDTFDate struct { Start *DateRange `json:"start"` End *DateRange `json:"end"` EDTF string `json:"edtf"` Level int `json:"level"` Feature string `json:"feature"` }
func (*EDTFDate) After ¶ added in v0.3.0
After reports whether the EDTFDate instance `d` is after `u`.
type InvalidError ¶
type InvalidError struct {
// contains filtered or unexported fields
}
func (*InvalidError) Error ¶
func (e *InvalidError) Error() string
type NotImplementedError ¶
type NotImplementedError struct {
// contains filtered or unexported fields
}
func (*NotImplementedError) Error ¶
func (e *NotImplementedError) Error() string
type NotSetError ¶ added in v0.2.0
type NotSetError struct { }
func (*NotSetError) Error ¶ added in v0.2.0
func (e *NotSetError) Error() string
type Timestamp ¶ added in v0.2.0
type Timestamp struct {
// contains filtered or unexported fields
}
func NewTimestampWithTime ¶ added in v0.2.0
func (Timestamp) MarshalJSON ¶ added in v0.2.0
func (*Timestamp) UnmarshalJSON ¶ added in v0.2.0
type UnrecognizedError ¶ added in v0.2.0
type UnrecognizedError struct {
// contains filtered or unexported fields
}
func (*UnrecognizedError) Error ¶ added in v0.2.0
func (e *UnrecognizedError) Error() string
type UnsupportedError ¶
type UnsupportedError struct {
// contains filtered or unexported fields
}
func (*UnsupportedError) Error ¶
func (e *UnsupportedError) Error() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
package calendar provides common date and calendar methods.
|
package calendar provides common date and calendar methods. |
cmd
|
|
matches
matches is a command-line tool to read one or more EDTF strings and emit the EDTF level and feature name they match.
|
matches is a command-line tool to read one or more EDTF strings and emit the EDTF level and feature name they match. |
parse
parse is a command-line tool to read one or more EDTF strings and return a list of JSON-encode edtf.EDTFDate objects.
|
parse is a command-line tool to read one or more EDTF strings and return a list of JSON-encode edtf.EDTFDate objects. |
package cmp provides methods for comparing EDTF dates (typically string representations)
|
package cmp provides methods for comparing EDTF dates (typically string representations) |
package common provide common methods across EDTF level definitions.
|
package common provide common methods across EDTF level definitions. |
package parser provides methods for parsing and validating EDTF strings.
|
package parser provides methods for parsing and validating EDTF strings. |
package unix provides methods for derving Unix timestamps from EDTF strings.
|
package unix provides methods for derving Unix timestamps from EDTF strings. |