ISO8601

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrBadFormat is returned when parsing fails
	ErrBadFormat = errors.New("bad format string")

	// ErrNoMonth is raised when a month is in the format string
	ErrNoMonth = errors.New("no months allowed")

	// ErrZoneCharacters indicates an incorrect amount of characters was passed to ParseISOZone.
	ErrZoneCharacters = errors.New("ISO8601: Expected between 3 and 6 characters for zone information")

	// ErrInvalidZone indicates an invalid timezone per the standard that doesn't violate any specific
	// character parsing rules.
	ErrInvalidZone = errors.New("ISO8601: Specified zone is invalid")

	// ErrRemainingData indicates that there is extra data after a `Z` character.
	ErrRemainingData = errors.New("ISO8601: Unexepected remaining data after `Z`")

	// ErrNotString indicates that a non string type was passed to the UnmarshalJSON method of `Time`.
	ErrNotString = errors.New("ISO8601: Invalid json type (expected string)")

	// ErrPrecision indicates that there was too much precision (characters) given to parse
	// for the fraction of a second of the input time.
	ErrPrecision = errors.New("ISO8601: Too many characters in fraction of second precision")
)

Functions

func ParseDuration

func ParseDuration(durString string) (time.Duration, error)

时间段表示法 P1Y3M5DT6H7M30S

func ParseISOZone

func ParseISOZone(inp []byte) (*time.Location, error)

func ParseTimeDate

func ParseTimeDate(inp []byte) (time.Time, error)

日期和时间的组合表示法 2023-10-10T00:00:00+08:00 时间

func ParseTimeDateString

func ParseTimeDateString(timedateString string) (time.Time, error)

Types

type RangeError

type RangeError struct {
	Value   string
	Element string
	Min     int
	Max     int
	Given   int
}

RangeError indicates that a value is not in an expected range.

func (*RangeError) Error

func (e *RangeError) Error() string

type UnexpectedCharacterError

type UnexpectedCharacterError struct {
	Character byte
}

UnexpectedCharacterError indicates the parser scanned a character that was not expected at that time.

func (*UnexpectedCharacterError) Error

func (e *UnexpectedCharacterError) Error() string

Jump to

Keyboard shortcuts

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