added Gleitzeit + Kurzarbeit closes #23
All checks were successful
Tests / Run Go Tests (push) Successful in 33s
All checks were successful
Tests / Run Go Tests (push) Successful in 33s
This commit is contained in:
@@ -25,8 +25,12 @@ func GetKW(t time.Time) int {
|
||||
return kw
|
||||
}
|
||||
|
||||
// Converts duration to string
|
||||
func FormatDuration(d time.Duration) string {
|
||||
return FormatDurationFill(d, false)
|
||||
}
|
||||
|
||||
// Converts duration to string
|
||||
func FormatDurationFill(d time.Duration, fill bool) string {
|
||||
hours := int(d.Abs().Hours())
|
||||
minutes := int(d.Abs().Minutes()) % 60
|
||||
sign := ""
|
||||
@@ -41,6 +45,13 @@ func FormatDuration(d time.Duration) string {
|
||||
case minutes > 0:
|
||||
return fmt.Sprintf("%s%dmin", sign, minutes)
|
||||
default:
|
||||
if fill {
|
||||
return "0min"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func IsSameDate(a, b time.Time) bool {
|
||||
return a.Truncate(24 * time.Hour).Equal(b.Truncate(24 * time.Hour))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user