Finsihed xml model & small bugfixes

This commit is contained in:
Simon Martens
2025-03-05 18:56:34 +01:00
parent e19fd47c17
commit e839bbebe8
46 changed files with 8928 additions and 136 deletions

View File

@@ -1,11 +1,5 @@
package functions
import (
"strconv"
"github.com/Theodor-Springmann-Stiftung/lenz-web/helpers/xsdtime"
)
type Month struct {
Full string
Short string
@@ -54,50 +48,6 @@ var TRANSLD = []Weekday{
{"Sonntag", "So", 7},
}
func HRDateShort(date string) string {
xsdt, err := xsdtime.New(date)
if err != nil {
return ""
}
t := xsdt.Type()
if t == xsdtime.GYear {
return strconv.Itoa(xsdt.Year)
}
if t == xsdtime.GYearMonth {
return strconv.Itoa(xsdt.Month) + "." + strconv.Itoa(xsdt.Year)
}
if t == xsdtime.Date {
return strconv.Itoa(xsdt.Day) + "." + strconv.Itoa(xsdt.Month) + "." + strconv.Itoa(xsdt.Year)
}
return ""
}
func HRDateYear(date string) string {
xsdt, err := xsdtime.New(date)
if err != nil {
return ""
}
t := xsdt.Type()
if t == xsdtime.GYear {
return strconv.Itoa(xsdt.Year)
}
if t == xsdtime.GYearMonth {
return strconv.Itoa(xsdt.Year)
}
if t == xsdtime.Date {
return strconv.Itoa(xsdt.Year)
}
return ""
}
func MonthName(i int) Month {
if i > 12 || i < 1 {
return TRANSLM[0]