v0.0.576
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m26s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m26s
This commit is contained in:
parent
49bc52d63e
commit
a93b93a3cd
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.575"
|
const GoextVersion = "0.0.576"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2025-05-11T19:17:05+0200"
|
const GoextVersionTimestamp = "2025-05-18T14:26:24+0200"
|
||||||
|
@ -43,8 +43,8 @@ func FormatNaturalDurationEnglish(iv time.Duration) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if min := int64(iv.Minutes()); min < 180 {
|
if mins := int64(iv.Minutes()); mins < 180 {
|
||||||
return fmt.Sprintf("%d minutes ago", min)
|
return fmt.Sprintf("%d minutes ago", mins)
|
||||||
}
|
}
|
||||||
|
|
||||||
if hours := int64(iv.Hours()); hours < 72 {
|
if hours := int64(iv.Hours()); hours < 72 {
|
||||||
@ -66,3 +66,32 @@ func FormatNaturalDurationEnglish(iv time.Duration) string {
|
|||||||
years := int64(iv.Hours() / 24.0 / 7.0 / 365)
|
years := int64(iv.Hours() / 24.0 / 7.0 / 365)
|
||||||
return fmt.Sprintf("%d years ago", years)
|
return fmt.Sprintf("%d years ago", years)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FormatDurationGerman(iv time.Duration) string {
|
||||||
|
if sec := int64(iv.Seconds()); sec < 180 {
|
||||||
|
return fmt.Sprintf("%d s", sec)
|
||||||
|
}
|
||||||
|
|
||||||
|
if mins := int64(iv.Minutes()); mins < 180 {
|
||||||
|
return fmt.Sprintf("%d min", mins)
|
||||||
|
}
|
||||||
|
|
||||||
|
if hours := int64(iv.Hours()); hours < 72 {
|
||||||
|
return fmt.Sprintf("%d h", hours)
|
||||||
|
}
|
||||||
|
|
||||||
|
if days := int64(iv.Hours() / 24.0); days < 21 {
|
||||||
|
return fmt.Sprintf("%d Tage", days)
|
||||||
|
}
|
||||||
|
|
||||||
|
if weeks := int64(iv.Hours() / 24.0 / 7.0); weeks < 12 {
|
||||||
|
return fmt.Sprintf("%d Wochen", weeks)
|
||||||
|
}
|
||||||
|
|
||||||
|
if months := int64(iv.Hours() / 24.0 / 7.0 / 30); months < 36 {
|
||||||
|
return fmt.Sprintf("%d Monate", months)
|
||||||
|
}
|
||||||
|
|
||||||
|
years := int64(iv.Hours() / 24.0 / 7.0 / 365)
|
||||||
|
return fmt.Sprintf("%d Jahre", years)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user