mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 00:55:32 +00:00
A lot sof small qualtiy of life upgrades
This commit is contained in:
@@ -10,8 +10,10 @@ import (
|
||||
// An implementation of the xsd 1.1 datatypes:
|
||||
// date, gDay, gMonth, gMonthDay, gYear, gYearMonth.
|
||||
|
||||
type XSDDatetype int
|
||||
type Seperator byte
|
||||
type (
|
||||
XSDDatetype int
|
||||
Seperator byte
|
||||
)
|
||||
|
||||
const (
|
||||
DEFAULT_YEAR = 0
|
||||
@@ -39,6 +41,11 @@ const (
|
||||
GYearMonth
|
||||
)
|
||||
|
||||
var (
|
||||
MonthNameShort = []string{"Jan", "Feb", "März", "Apr", "Mai", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"}
|
||||
MonthName = []string{"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"}
|
||||
)
|
||||
|
||||
type XSDDate struct {
|
||||
base string
|
||||
|
||||
@@ -123,6 +130,20 @@ func (d XSDDate) String() string {
|
||||
return s
|
||||
}
|
||||
|
||||
func (d *XSDDate) MonthName() string {
|
||||
if d.Month == 0 {
|
||||
return ""
|
||||
}
|
||||
return MonthName[d.Month-1]
|
||||
}
|
||||
|
||||
func (d *XSDDate) MonthNameShort() string {
|
||||
if d.Month == 0 {
|
||||
return ""
|
||||
}
|
||||
return MonthNameShort[d.Month-1]
|
||||
}
|
||||
|
||||
func (d *XSDDate) UnmarshalText(text []byte) error {
|
||||
return d.Parse(string(text))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user