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
is this issue currently blocking your project? (yes/no): no
is this issue affecting a production system? (yes/no): yes
Context
node version: v14.5.0
module version with issue: 17.1.1
last module version without issue: Unknown
environment (e.g. node, browser, native): node
used with (e.g. hapi application, another framework, standalone, ...): aws-sdk
any other relevant information:
What are you trying to achieve or the steps to reproduce?
I'm validating an ISO string as seen in productive environment: 2019-01-22T07:16:46+01. While the regex from lib/common.js works fine, I still get a validation error when using isoDate().
// this fails:console.log(Joi.string().isoDate().validate("2019-01-22T07:16:46+01"));// but this works:console.log(Joi.string().isoDate().validate("2019-01-22T07:16:46+01:00"));
I could not get the original specification but found some examples:
Wikipedia: Positive UTC offsets describe a time zone east of UTC±00:00, where the civil time is ahead (or later) than UTC so the zone designator will look like "+02:00","+0200", or "+02".
Date and time with timeshift in hours (only)
Example 3
‘1985-04-12T23:20:30-04’ refers to the date 1985 April 12th time of day 23:20:30 with time shift of 4 hours behind UTC.
As I don't really have $200 to spend on the specification, I guess we'll trust wikipedia 🙂 Then we should probably pad it with zeros to make it compatible with javascript's level of support.
Joi (and JS) only really supports the extended version with separators. With only two digits, it might not conform to this version. Anyway, this is working as expected, given the disclaimer in the docs:
Be aware that this operation uses javascript Date object, which does not support the full ISO format, so a few formats might not pass when using convert.
Support plan
Context
What are you trying to achieve or the steps to reproduce?
I'm validating an ISO string as seen in productive environment:
2019-01-22T07:16:46+01
. While the regex from lib/common.js works fine, I still get a validation error when using isoDate().What was the result you got?
What result did you expect?
The text was updated successfully, but these errors were encountered: