mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
added XSDTime datatype
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user