added XSDTime datatype

This commit is contained in:
Simon Martens
2024-12-22 20:40:58 +01:00
parent ff3ed74b5e
commit 0ad9e0122f
13 changed files with 552 additions and 268 deletions

View File

@@ -40,8 +40,8 @@ func (i Issue) Keys() []string {
res = append(res, date)
}
if len(date) > 4 {
res = append(res, i.Datum.When[0:4]+"-"+strconv.Itoa(i.Number.No))
if ref, err := i.Reference(); err == nil {
res = append(res, ref)
}
i.keys = res
@@ -49,6 +49,22 @@ func (i Issue) Keys() []string {
return res
}
// TODO: We could even cache this
func (i Issue) Year() (int, error) {
if date := i.Datum.Date(); date != nil {
return date.Year(), nil
}
return 0, InvalidDateError
}
func (i Issue) Reference() (string, error) {
if date := i.Datum.Date(); date != nil {
return strconv.Itoa(date.Year()) + "-" + strconv.Itoa(i.Number.No), nil
}
return "", InvalidDateError
}
func (i Issue) String() string {
return fmt.Sprintf("Number: %v, Datum: %v, Von: %d, Bis: %d, Additionals: %v, Identifier: %v, AnnotationNote: %v\n", i.Number, i.Datum, i.Von, i.Bis, i.Additionals, i.Identifier, i.AnnotationNote)
}