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
DateTime contains time zone information. It might either be an offset
in seconds (that corresponds to ±HH:MM) or the time zone id
(like 'Europe/London'). Previously driver exposed DateTime as two
different types: `DateTimeWithZoneOffset` and `DateTimeWithZoneId`.
This commit combines them into a single type:
```
class DateTime {
year: Integer|number,
month: Integer|number,
day: Integer|number,
hour: Integer|number,
minute: Integer|number,
second: Integer|number,
nanosecond: Integer|number,
timeZoneOffsetSeconds: Integer|number,
timeZoneId: string
}
```
where either `timeZoneOffsetSeconds` or `timeZoneId` is defined. Such
single type better corresponds to the Cypher DateTime type and feels
more idiomatic to JavaScript. Shape of objects (set of their properties)
feels more important than the class/type.
Also renamed `Time.offsetSeconds` to `Time.timeZoneOffsetSeconds` to
better represent the meaning of the property.
@@ -226,93 +226,54 @@ export function isLocalDateTime(obj) {
226
226
227
227
/**
228
228
* Represents an instant capturing the date, the time and the timezone identifier.
229
-
* Created <code>DateTimeWithZoneOffset</code> objects are frozen with {@link Object#freeze()} in constructor and thus immutable.
229
+
* Created <code>DateTime</code> objects are frozen with {@link Object#freeze()} in constructor and thus immutable.
230
230
*/
231
-
exportclassDateTimeWithZoneOffset{
231
+
exportclassDateTime{
232
232
233
233
/**
234
234
* @constructor
235
-
* @param {Integer|number} year the year for the new local date.
236
-
* @param {Integer|number} month the month for the new local date.
237
-
* @param {Integer|number} day the day for the new local date.
238
-
* @param {Integer|number} hour the hour for the new local time.
239
-
* @param {Integer|number} minute the minute for the new local time.
240
-
* @param {Integer|number} second the second for the new local time.
241
-
* @param {Integer|number} nanosecond the nanosecond for the new local time.
242
-
* @param {Integer|number} offsetSeconds the timezone offset in seconds for the new timezone-aware date-time.
235
+
* @param {Integer|number} year the year for the new date-time.
236
+
* @param {Integer|number} month the month for the new date-time.
237
+
* @param {Integer|number} day the day for the new date-time.
238
+
* @param {Integer|number} hour the hour for the new date-time.
239
+
* @param {Integer|number} minute the minute for the new date-time.
240
+
* @param {Integer|number} second the second for the new date-time.
241
+
* @param {Integer|number} nanosecond the nanosecond for the new date-time.
242
+
* @param {Integer|number|null} timeZoneOffsetSeconds the total time zone offset in seconds for the new date-time. Either this argument or <code>timeZoneId</code> should be defined.
243
+
* @param {string|null} timeZoneId the time zone id for the new date-time. Either this argument or <code>timeZoneOffsetSeconds</code> should be defined.
thrownewError(`Unable to create DateTime with both time zone offset and id. Please specify either of them. Given offset: ${timeZoneOffsetSeconds} and id: ${timeZoneId}`);
297
+
}else{
298
+
thrownewError(`Unable to create DateTime without either time zone offset or id. Please specify either of them. Given offset: ${timeZoneOffsetSeconds} and id: ${timeZoneId}`);
0 commit comments