openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

[time] Add `isBetweenDates` & `isBetweenDateTimes` polyfills to `ZonedDateTime` #203

Closed florian-h05 closed 1 year ago

florian-h05 commented 1 year ago

Required for https://github.com/openhab/openhab-webui/issues/1597.

This extends our polyfills for time.ZonedDateTime with isBetweenDates and isBetweenDateTimes to complete isBetweenTimes.

@digitaldan Please especially review https://github.com/openhab/openhab-js/commit/f2d6982be3fa5d21d0e6d3943ced62920db4d9f8, the rest is just some reordering to allow some unit tests for toZDT. @rkoshak I would also take a review of you, since you originally authored most parts or the time namespace.

The new methods and all polyfills in general are now testes by the unit tests.

rkoshak commented 1 year ago

LGTM. I'm not sure I understand the polyfills part and I need to get smart on the unit tests for my own good. But the actual functions look like I would have coded them. :-D

florian-h05 commented 1 year ago

Thanks, I will merge then :+1:

florian-h05 commented 1 year ago

@rkoshak With this, Stefan and I are nearly finished with porting the existing Blocks. The only ones that are left are two datetimeoffset Blocks and the persistence blocks, mainly because we were missing functionality on the time namespace.