seperated pdf-generate endpoint + added new helper in Time
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user