mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 09:05:30 +00:00
Akteure beginning
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package functions
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/helpers/xsdtime"
|
||||
)
|
||||
|
||||
type Month struct {
|
||||
Full string
|
||||
Short string
|
||||
@@ -48,6 +54,28 @@ 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 MonthName(i int) Month {
|
||||
if i > 12 || i < 1 {
|
||||
return TRANSLM[0]
|
||||
|
||||
1
functions/slices.go
Normal file
1
functions/slices.go
Normal file
@@ -0,0 +1 @@
|
||||
package functions
|
||||
8
functions/string.go
Normal file
8
functions/string.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package functions
|
||||
|
||||
func FirstLetter(s string) string {
|
||||
if len(s) == 0 {
|
||||
return ""
|
||||
}
|
||||
return string(s[:1])
|
||||
}
|
||||
Reference in New Issue
Block a user