Skip to content

Working days

2026-08-20

Skips 2 weekend days and 1 holiday: 17 Aug Independence Day.

Runs in your browser.

Working days skip weekends, national holidays, and (by default) collective leave from holiday. Use them for payroll cut-offs, SLAs and due dates.

Go TypeScript Returns
workday.IsWorkday(date, opts) workday.isWorkday(date, opts?) Whether date is a working day
workday.Add(date, days, opts) workday.add(date, days, opts?) The date days working days later (negative goes back)
workday.Count(from, to, opts) workday.count(from, to, opts?) Working days from from to to, inclusive
Go Options TypeScript Default
Weekend []time.Weekday weekend: number[] Saturday and Sunday
CollectiveLeaveIsWorkday collectiveLeaveIsWorkday false

TypeScript weekend days use 0 for Sunday to 6 for Saturday, like Date.getUTCDay(). A six-day work week is [0].

Calculations only work inside the years covered by holiday data, so a result is never silently wrong. A date outside that range fails with range.

date, range (outside the covered years, or from after to), options (an invalid weekend day, or every day of the week as weekend).

package main
import (
"fmt"
"time"
"github.com/haikalmumtaz233/nusaindex/workday"
)
func main() {
open, err := workday.IsWorkday("2026-08-17", workday.Options{})
if err == nil {
fmt.Println(open)
}
due, err := workday.Add("2026-08-14", 3, workday.Options{})
if err == nil {
fmt.Println(due)
}
days, err := workday.Count("2026-08-01", "2026-08-31", workday.Options{})
if err == nil {
fmt.Println(days)
}
sixDay := workday.Options{Weekend: []time.Weekday{time.Sunday}, CollectiveLeaveIsWorkday: true}
days, err = workday.Count("2026-08-01", "2026-08-31", sixDay)
if err == nil {
fmt.Println(days)
}
}
Output
false
2026-08-20
19
24