Documentation
¶
Index ¶
- Constants
- type PrecisionDate
- func (p PrecisionDate) Century() int
- func (p PrecisionDate) CenturyAbs() int
- func (p PrecisionDate) FormatForLocale(locale string) string
- func (p PrecisionDate) IsPrecisionCentury() bool
- func (p PrecisionDate) IsPrecisionDay() bool
- func (p PrecisionDate) IsPrecisionDecade() bool
- func (p PrecisionDate) IsPrecisionMonth() bool
- func (p PrecisionDate) IsPrecisionYear() bool
Constants ¶
const ( PrecisionCentury = 7 PrecisionDecade = 8 PrecisionYear = 9 PrecisionMonth = 10 PrecisionDay = 11 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrecisionDate ¶
PrecisionDate implement a format for partially-known dates following Wikidata format. Some dates for relevant people are not fully known, for example, for Seneca, full birth and death dates are unknown, only the years. https://www.wikidata.org/wiki/Help:Dates
func NewPrecisionDate ¶
func NewPrecisionDate(ISOdate string, precision float64) PrecisionDate
NewPrecisionDate parses a ISO 8601 formatted string and parses it into a PrecisionDate. As Wikidata dates come in different precision levels, we need to know what's the precision a date is using before parsing it, because dates in levels under day precision come with zero values for months or days, for example 2006-00-00. As this is not a valid ISO 8601, we need to convert it to a valid string beforehand.
func (PrecisionDate) Century ¶
func (p PrecisionDate) Century() int
func (PrecisionDate) CenturyAbs ¶
func (p PrecisionDate) CenturyAbs() int
func (PrecisionDate) FormatForLocale ¶ added in v4.9.0
func (p PrecisionDate) FormatForLocale(locale string) string
FormatForLocale returns an ISO format string for day precision dates, adapting to locale conventions.
func (PrecisionDate) IsPrecisionCentury ¶
func (p PrecisionDate) IsPrecisionCentury() bool
func (PrecisionDate) IsPrecisionDay ¶
func (p PrecisionDate) IsPrecisionDay() bool
func (PrecisionDate) IsPrecisionDecade ¶
func (p PrecisionDate) IsPrecisionDecade() bool
func (PrecisionDate) IsPrecisionMonth ¶
func (p PrecisionDate) IsPrecisionMonth() bool
func (PrecisionDate) IsPrecisionYear ¶
func (p PrecisionDate) IsPrecisionYear() bool