A lot sof small qualtiy of life upgrades

This commit is contained in:
Simon Martens
2025-09-16 17:02:58 +02:00
parent 3ebfcd410f
commit ca51a6317b
17 changed files with 2109 additions and 1407 deletions

View File

@@ -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))
}