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.
Functions
Section titled “Functions”| 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 |
Options
Section titled “Options”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.
Errors
Section titled “Errors”date, range (outside the covered years, or from after to), options (an invalid weekend day, or every day of the week as weekend).
Example
Section titled “Example”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) }}import * as workday from "nusaindex/workday";
const open = workday.isWorkday("2026-08-17");if (open.ok) { console.log(open.value);}
const due = workday.add("2026-08-14", 3);if (due.ok) { console.log(due.value);}
const days = workday.count("2026-08-01", "2026-08-31");if (days.ok) { console.log(days.value);}
const sixDay = { weekend: [0], collectiveLeaveIsWorkday: true };const sixDayCount = workday.count("2026-08-01", "2026-08-31", sixDay);if (sixDayCount.ok) { console.log(sixDayCount.value);}false2026-08-201924© 2026 Haikal Mumtaz