Skip to content

Commit 7909c04

Browse files
authored
Add README for business time utilities
Added README.md for business time utilities that provide functions for adding working hours, calculating working minutes, finding next open time, and checking schedule inclusion.
1 parent 05b9e6a commit 7909c04

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Business time utilities (add, diff, next open, in schedule)
2+
3+
## What this solves
4+
Teams repeatedly reimplement the same business-time maths. This utility wraps `GlideSchedule` with four practical helpers so you can:
5+
- Add N working hours to a start date
6+
- Calculate working minutes between two dates
7+
- Find the next open time inside a schedule
8+
- Check if a specific time is inside the schedule window
9+
10+
All functions return simple objects that are easy to log, test, and consume in Flows or Rules.
11+
12+
## Where to use
13+
- Script Include in global or scoped app
14+
- Call from Business Rules, Flow Actions, or Background Scripts
15+
16+
## Functions
17+
- `addWorkingHours(scheduleSysId, hoursToAdd, startGdt, tz)`
18+
- `workingMinutesBetween(scheduleSysId, startGdt, endGdt, tz)`
19+
- `nextOpen(scheduleSysId, fromGdt, tz)`
20+
- `isInSchedule(scheduleSysId, whenGdt, tz)`
21+
22+
## Notes
23+
- The schedule determines both business hours and holidays.
24+
- `tz` is optional; if omitted, the schedule’s TZ or instance default applies.
25+
- All inputs accept either `GlideDateTime` or ISO strings (UTC-safe).
26+
27+
## References
28+
- GlideSchedule API
29+
https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/GlideSchedule/concept/c_GlideScheduleAPI.html
30+
- GlideDateTime API
31+
https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/GlideDateTime/concept/c_GlideDateTimeAPI.html

0 commit comments

Comments
 (0)