mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-28 16:55:32 +00:00
40 lines
885 B
Go
40 lines
885 B
Go
package xmlmodels
|
|
|
|
import xmlparsing "github.com/Theodor-Springmann-Stiftung/lenz-web/xml"
|
|
|
|
type RefElement struct {
|
|
Reference int `xml:"ref,attr"`
|
|
Text string `xml:",chardata"`
|
|
Cert string `xml:"cert,attr"`
|
|
}
|
|
|
|
type Date struct {
|
|
When xmlparsing.XSDDate `xml:"when,attr"`
|
|
NotBefore xmlparsing.XSDDate `xml:"notBefore,attr"`
|
|
NotAfter xmlparsing.XSDDate `xml:"notAfter,attr"`
|
|
From xmlparsing.XSDDate `xml:"from,attr"`
|
|
To xmlparsing.XSDDate `xml:"to,attr"`
|
|
Cert string `xml:"cert,attr"`
|
|
Text string `xml:",chardata"`
|
|
}
|
|
|
|
func (d *Date) Sort() *xmlparsing.XSDDate {
|
|
if d.NotBefore.Validate() {
|
|
return &d.NotBefore
|
|
}
|
|
if d.From.Validate() {
|
|
return &d.From
|
|
}
|
|
if d.When.Validate() {
|
|
return &d.When
|
|
}
|
|
if d.To.Validate() {
|
|
return &d.To
|
|
}
|
|
if d.NotAfter.Validate() {
|
|
return &d.NotAfter
|
|
}
|
|
|
|
return nil
|
|
}
|