Skip to content

Commit

Permalink
[time] Fix isBetweenTimes fails with time.toZDT not a function (#151
Browse files Browse the repository at this point in the history
)

* [time] Fix `isBetweenTimes` fails with `time.toZDT` not a function

Fixes #150.
Previous PR #137 changed the way how toZDT is defined, which broke
isBetweenTimes.

* Update CHANGELOG

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
  • Loading branch information
florian-h05 authored Aug 17, 2022
1 parent cec1cba commit 5be991d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

| Type | Namespace | Description | Reference | Breaking |
|-------------|-----------|--------------------------------------------------------------------------|------------------------------------------------|----------|
| Bugfix | `time` | `isBetweenTimes` fails with: TypeError: `time.toZDT` is not a function | https://github.com/openhab/openhab-js/pull/151 | No |

Also see the [Release Milestone](https://github.com/openhab/openhab-js/milestone/3).

Expand Down
4 changes: 2 additions & 2 deletions time.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ time.ZonedDateTime.prototype.toToday = function () {
* @returns {boolean} true if this is between start and end
*/
time.ZonedDateTime.prototype.isBetweenTimes = function (start, end) {
const startTime = time.toZDT(start).toLocalTime();
const endTime = time.toZDT(end).toLocalTime();
const startTime = toZDT(start).toLocalTime();
const endTime = toZDT(end).toLocalTime();
const currTime = this.toLocalTime();

// time range spans midnight
Expand Down

0 comments on commit 5be991d

Please sign in to comment.