Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
fix: use UTC timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
miiila committed Jun 14, 2017
1 parent 921e157 commit 17ef8cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
- `PAGERDUTY_READ_ONLY_TOKEN` is used for reading schedules and checking the overlaps.
- `SCHEDULES` array can contain one or more `SCHEDULE` items to check
- every `SCHEDULE` should have a `NOTIFICATIONS` to create incident or send message if overlap is found
- `SCHEDULE` can contain a `EXCLUSION_DAYS` key, which specifies days (3 letter abb.) in form of object with optional `start` and `end` time (`hh:mm` format). If `start` or `end` is omitted, whole day is considered excluded.
Example below represents current weekend on-call setup. All datetimes are translated to UTC, so feel free to use a local time.
- `SCHEDULE` can contain a `EXCLUSION_DAYS` key, which specifies days (3 letter abb.) in form of object with optional `start` and `end` time (`hh:mm` format **UTC TIMEZONE**).If `start` or `end` is omitted, whole day is considered excluded.
Example below represents current weekend on-call setup.

Currently, we only support Slack (`SLACK` with `SLACK_WEBHOOK_URL` and `CHANNEL`) or shorthanded `SLACK_WEBHOOK_URL` and PagerDuty (`PAGERDUTY_TOKEN`) notifications.

Expand All @@ -40,7 +40,7 @@ Currently, we only support Slack (`SLACK` with `SLACK_WEBHOOK_URL` and `CHANNEL`
"PAGERDUTY_TOKEN": "22222222222222222222",
"SLACK_WEBHOOK_URL": "http://acme.slack.com/11111",
},
"EXCLUSION_DAYS": {"Fri": {"start": "16:00", "end": "23:59"}, "Sat": {}, "Sun": {"start": "00:00", "end": "16:00"}}
"EXCLUSION_DAYS": {"Fri": {"start": "14:00", "end": "23:59"}, "Sat": {}, "Sun": {"start": "00:00", "end": "14:00"}}
}]
}
```
Expand All @@ -60,4 +60,4 @@ For debugging you can use `debug` package included in the library:

`DEBUG=pagerduty-overrides* ./bin/pdoverrides check -c config.json`

Alternatively, you can include the `DEBUG` variable in the `config.json` file (esp. for debugging on AWS Lambda).
Alternatively, you can include the `DEBUG` variable in the `config.json` file (esp. for debugging on AWS Lambda).
8 changes: 4 additions & 4 deletions src/pagerduty.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ processSchedules = (allSchedules, days = [], cb) ->
exclusionStartTime = days[day].start.split(':')
exclusionEndTime = days[day].end.split(':')
exclusionStartDate = new Date(myStart)
exclusionStartDate.setHours(exclusionStartTime[0])
exclusionStartDate.setMinutes(exclusionStartTime[1])
exclusionStartDate.setUTCHours(exclusionStartTime[0])
exclusionStartDate.setUTCMinutes(exclusionStartTime[1])
exclusionEndDate = new Date(myStart)
exclusionEndDate.setHours(exclusionEndTime[0])
exclusionEndDate.setMinutes(exclusionEndTime[1])
exclusionEndDate.setUTCHours(exclusionEndTime[0])
exclusionEndDate.setUTCMinutes(exclusionEndTime[1])


if exclusionStartDate <= startDate < exclusionEndDate
Expand Down

0 comments on commit 17ef8cf

Please sign in to comment.