Skip to content

Add a test to show a bug on the date-time format constraint checker #229

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

Conversation

mathroc
Copy link
Contributor

@mathroc mathroc commented Feb 4, 2016

it was supposed to be solved in #207 like that:

// handles the case where a non-6 digit microsecond datetime is passed
// which will fail the above string comparison because the passed
// $datetime may be '2000-05-01T12:12:12.123Z' but format() will return
// '2000-05-01T12:12:12.123000Z'
if ((strpos('u', $format) !== -1) && (intval($dt->format('u')) > 0)) {
    return true;
}

(see https://github.com/justinrainbow/json-schema/pull/207/files#diff-94f691bae259df522f96670badc55b60R141)

but I'm not sure this is valid and I don't know how to solve it correctly easily. So for now this PR just shows the bug, I'll try to solve it later. if anyone have a suggestion, I'm all ears

maybe like mentioned on #145 ?

@vaeryn-uk
Copy link
Contributor

Ah, sorry. I hadn't realised that a PR was open for this already. I've created a fix if it's of any use: #234.

Not overly happy with the solution, but couldn't come up with anything better.

@bighappyface
Copy link
Collaborator

Closed with #238

Please re-open if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants