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
Check parameter types in spatial and temporal types
This commit adds type assertions for constructor parameters of all
spatial and temporal types. Assertions make it easier to detect
incorrect usage and packstream layer from serializing illegal structs.
* @param {string|null} timeZoneId the time zone id for the new date-time. Either this argument or <code>timeZoneOffsetSeconds</code> should be defined.
@@ -289,8 +292,10 @@ function verifyTimeZoneArguments(timeZoneOffsetSeconds, timeZoneId) {
289
292
constidDefined=timeZoneId&&timeZoneId!=='';
290
293
291
294
if(offsetDefined&&!idDefined){
295
+
assertNumberOrInteger(timeZoneOffsetSeconds,'Time zone offset in seconds');
292
296
return[timeZoneOffsetSeconds,null];
293
297
}elseif(!offsetDefined&&idDefined){
298
+
assertString(timeZoneId,'Time zone ID');
294
299
return[null,timeZoneId];
295
300
}elseif(offsetDefined&&idDefined){
296
301
thrownewError(`Unable to create DateTime with both time zone offset and id. Please specify either of them. Given offset: ${timeZoneOffsetSeconds} and id: ${timeZoneId}`);
0 commit comments