unix

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2024 License: BSD-3-Clause Imports: 4 Imported by: 2

Documentation

Overview

package unix provides methods for derving Unix timestamps from EDTF strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DateRange

type DateRange struct {
	// Outer is a `DateSpan` instance which matches the lower value of a starting date range and the upper value of an ending date range.
	Outer *DateSpan
	// Outer is a `DateSpan` instance which matches the upper value of a starting date range and the lower value of an ending date range.
	Inner *DateSpan
}

DateRange is a struct containing inner and outer `DateSpan` instances for an EDTF date string.

func DeriveRanges

func DeriveRanges(edtf_str string) (bool, *DateRange, error)

DeriveRanges will parse 'edtf_str' and return a boolean flag signaling that it was possible to derive date ranges and, when possible, a `DateRange` instance containing Unix timestamps. For example some EDTF date strings like ".." (indicating an "open" or "ongoing" date) are valid EDTF but not suitable for deriving a date range.

type DateSpan

type DateSpan struct {
	// Start is the Unix timestamp for the starting date.
	Start int64
	// End is the Unix timestamp for the ending date.
	End int64
}

DateSpan is a struct containing Unix timestamps for a range of (two) dates. Dates before 1970-01-01 are represented as negative values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL