You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+12-10
Original file line number
Diff line number
Diff line change
@@ -978,6 +978,7 @@ The following rules are used during the conversion:
978
978
| `null` or `undefined` | `time.ZonedDateTime.now()` | `time.toZDT();` |
979
979
| `time.ZonedDateTime` | passed through unmodified | |
980
980
| `java.time.ZonedDateTime` | converted to the `time.ZonedDateTime` equivalent | |
981
+
| `time.Instant`, `java.time.Instant` | converted to the `time.ZonedDateTime` equivalent using `SYSTEM` as the timezone | `time.toZDT(time.toInstant(500));` (epoch milli 500 to ZDT) |
981
982
| JavaScript native `Date` | converted to the `time.ZonedDateTime` equivalent using `SYSTEM` as the timezone | |
982
983
| `number`, `bingint`, `java.lang.Number`, `DecimalType` | rounded to the nearest integer and added to `now` as milliseconds | `time.toZDT(1000);` |
983
984
| [`Quantity`](#quantity) or `QuantityType` | if the unit is time-compatible, added to `now` | `time.toZDT(item.getItem('MyTimeItem').rawState);`, `time.toZDT(Quantity('10 min'));` |
| `null` or `undefined` | `time.Instant.now()` | `time.toInstant();` |
1106
-
| `time.Instant` | passed through unmodified | |
1107
-
| `java.time.Instant` | converted to the `time.Instant` equivalent | |
1108
-
| `java.time.ZonedDateTime` | converted to the `time.Instant` equivalent | |
1109
-
| JavaScript native `Date` | converted to the `time.Instant` equivalent | |
1110
-
| `items.Item` or `org.openhab.core.types.Item` | if the state is supported (see the `*Type` rules in this table), the state is converted | `time.toInstant(items.getItem('MyItem'));` |
| `null` or `undefined` | `time.Instant.now()` | `time.toInstant();` |
1107
+
| `time.Instant` | passed through unmodified | |
1108
+
| `java.time.Instant` | converted to the `time.Instant` equivalent | |
1109
+
| `number`, `bingint`, `java.lang.Number`, `DecimalType` | handled as epoch milliseconds and converted to the `time.Instant` equivalent | `time.toInstant(500);` |
1110
+
| `java.time.ZonedDateTime` | converted to the `time.Instant` equivalent | |
1111
+
| JavaScript native `Date` | converted to the `time.Instant` equivalent | |
1112
+
| `items.Item` or `org.openhab.core.types.Item` | if the state is supported (see the `*Type` rules in this table), the state is converted | `time.toInstant(items.getItem('MyItem'));` |
Copy file name to clipboardexpand all lines: src/time.js
+23
Original file line number
Diff line number
Diff line change
@@ -246,6 +246,7 @@ function javaZDTToJsZDT (zdt) {
246
246
* - null, undefined: time.ZonedDateTime.now()
247
247
* - time.ZonedDateTime: unmodified
248
248
* - Java ZonedDateTime, DateTimeType: converted to time.ZonedDateTime equivalent
249
+
* - time.Instant, Java Instant: converted to time.ZonedDateTime equivalent
249
250
* - JavaScript native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date Date}: converted to a `time.ZonedDateTime` using configured timezone
250
251
* - number, bigint, Java Number, DecimalType: rounded and added to `time.ZonedDateTime.now()` as milliseconds
251
252
* - {@link Quantity} & QuantityType: if the unit is time-compatible, added to `time.ZonedDateTime.now()`
Copy file name to clipboardexpand all lines: types/time.d.ts
+2
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,7 @@ declare function javaZDTToJsZDT(zdt: JavaZonedDateTime): time.ZonedDateTime;
99
99
* - null, undefined: time.ZonedDateTime.now()
100
100
* - time.ZonedDateTime: unmodified
101
101
* - Java ZonedDateTime, DateTimeType: converted to time.ZonedDateTime equivalent
102
+
* - time.Instant, Java Instant: converted to time.ZonedDateTime equivalent
102
103
* - JavaScript native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date Date}: converted to a `time.ZonedDateTime` using configured timezone
103
104
* - number, bigint, Java Number, DecimalType: rounded and added to `time.ZonedDateTime.now()` as milliseconds
104
105
* - {@link Quantity} & QuantityType: if the unit is time-compatible, added to `time.ZonedDateTime.now()`
@@ -124,6 +125,7 @@ declare function toZDT(when?: any): time.ZonedDateTime;
124
125
* - time.ZonedDateTime: converted to the time.Instant equivalent
125
126
* - Java Instant, DateTimeType: converted to time.Instant equivalent
126
127
* - JavaScript native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date Date}: converted to a `time.Instant`
128
+
* - number, bigint, Java Number, DecimalType: assumed to be epoch milliseconds and converted to a `time.Instant`
127
129
* - Item: converts the state of the Item based on the *Type rules described here
0 commit comments