seperated pdf-generate endpoint + added new helper in Time

This commit is contained in:
2025-10-28 22:59:33 +01:00
parent 4bc5594dc5
commit cf5238f024
6 changed files with 104 additions and 7 deletions

View File

@@ -55,3 +55,16 @@ func FormatDurationFill(d time.Duration, fill bool) string {
func IsSameDate(a, b time.Time) bool {
return a.Truncate(24 * time.Hour).Equal(b.Truncate(24 * time.Hour))
}
func GetWorkingDays(startDate, endDate time.Time) int {
if endDate.Before(startDate) {
return 0
}
var count int = 0
for d := startDate.Truncate(24 * time.Hour); !d.After(endDate); d = d.Add(24 * time.Hour) {
if !IsWeekend(d) {
count++
}
}
return count
}