Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date-time bug #20

Open
tschmidtb51 opened this issue May 13, 2022 · 4 comments
Open

date-time bug #20

tschmidtb51 opened this issue May 13, 2022 · 4 comments
Assignees
Labels
bug Something isn't working service+dev This issue or pull request is (to be) handled by that group

Comments

@tschmidtb51
Copy link
Contributor

tschmidtb51 commented May 13, 2022

The same bug as secvisogram/secvisogram#216 (see ajv-validator/ajv-formats#55) applies here. We should use ajv-validator/ajv-formats#49 version 3.0.0 even if it is not stable yet.

@tschmidtb51 tschmidtb51 added the bug Something isn't working label May 13, 2022
@domachine
Copy link
Contributor

I'm a bit confused. I just upgraded the ajv-formats library and did a quick test using the nodejs repl with the following result:

> var Ajv = require('ajv')
undefined
> var ajv = new Ajv()
undefined
> require('ajv-formats')(ajv)
...
> ajv.validate({ type: 'string', format: 'date-time' }, '2020-01-01 20:00:00.000')
false
> ajv.validate({ type: 'string', format: 'date-time' }, '2020-01-01 20:00:00.000Z')
true
> ajv.validate({ type: 'string', format: 'date-time' }, '2020-01-01T20:00:00.000Z')
true

It seems that it still doesn't validate the date-time correctly.

@tschmidtb51
Copy link
Contributor Author

Me too... I thought it had been fixed with version 3: ajv-validator/ajv-formats#55

@tschmidtb51 tschmidtb51 added the service+dev This issue or pull request is (to be) handled by that group label Mar 24, 2023
@tschmidtb51
Copy link
Contributor Author

As discussed today.

@tschmidtb51
Copy link
Contributor Author

tschmidtb51 commented May 4, 2023

As described in ajv-validator/ajv-formats#55 the RFC 3339 requires by ABNF and description the use of T as a separator and the use of an timezone. The note

NOTE: ISO 8601 defines date and time separated by "T".
Applications using this syntax may choose, for the sake of
readability, to specify a full-date and full-time separated by
(say) a space character.

is not changing the ABNF but telling a potential representation in the GUI resp. pointing to ISO 8601. Therefore, the ajv-formats needs to be fixed.

The following examples are invalid:

'2020-01-01 20:00:00.000', '2020-01-01 20:00:00.000Z', '2023-05-04\t01:14:00+21:00', '2023-05-04\r01:14:10+16:20', '2023-05-04\n01:14:21+09:50', '2023-05-04\n01:14:21-04:31', '2023-05-04t01:14:21-04:31:00'

The following examples are fully valid:

'2020-01-01T20:00:00.000Z', '2020-01-01T20:00:00.000Z', '2023-05-04T01:14:00+21:00', '2023-05-04T01:14:10+16:20', '2023-05-04T01:14:21+09:50', '2023-05-04T01:14:21-04:31', '2023-05-04T01:14:21-23:59'

The following examples are valid but should not be produced by Secvisogram:

'2020-01-01t20:00:00.000Z', '2020-01-01T20:00:00.000z', '2023-05-04t01:14:00+21:00', '2023-05-04t01:14:10+16:20', '2023-05-04t01:14:21+09:50', '2023-05-04t01:14:21-04:31', '2023-05-04t01:14:21z'

Please provide an appropriate PR to ajv-formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working service+dev This issue or pull request is (to be) handled by that group
Projects
None yet
Development

No branches or pull requests

4 participants