schema icon indicating copy to clipboard operation
schema copied to clipboard

Add DateTime and DateTimeRange expectations

Open repli2dev opened this issue 3 years ago • 2 comments

It would be handy to provide expectations for datetime too, typically validation & parsing in given format. Apart from format typically we use min and max validations as well as cross validations for intervals between two or more provided values.

repli2dev avatar Dec 15 '20 16:12 repli2dev

It would probably be better to make a separate class for this, like https://github.com/redbitcz/subreg-api-php/blob/60f377ac68f3c1871b926eca336f5eb8d3368455/src/Schema/DateTime.php

dg avatar Dec 15 '20 21:12 dg

I like the idea for both Date and DateTime. At the moment we are using assert to validate Date/DateTime, then we still have to use Date/DateTime to make some comparisons and so on. This example from subreg-api-php is cool, it returns Date/DateTime object. @dg could you please implement it?

deba12 avatar May 25 '21 14:05 deba12