-
Notifications
You must be signed in to change notification settings - Fork 520
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
Adding datetime type #1206
Comments
or the queries do not return dates (as now) and the values always needs to be converted explictly. Using date filter |
I prefer that |
What about :
@jcamiel ? |
I the cookie "Expires" query returns only a Date, you can still have the string value: Either use a header query:
Or use a filter on cookie query:
I prefer the query to return only one type, instead of the query type being dependent on the predicate value. |
relating to the naming of the datetime filters, I would tend to prefer the second form to be consistent with we could also have a more generic filter |
Example with format
|
"Final" syntax:
|
The |
Add a datetime type to the possible values (returned by a query or filter).
One of the motivations is using reusable filters such as
daysFromNow
,year
, ...format/parse
filters will have to be used to convert Date to String/String to Date.The datetime format can be specified explicitely (https://docs.rs/chrono/latest/chrono/format/strftime/)
formatDate "%y/%m/%d"
:: date -> strparseDate "%y/%m/%d"
:: str -> dateExample
The query
cookie "SESSION_ID[Expires]"
could return a datetime value.cookie "SESSION_ID[Expires]" formatDate "%y/%m/%d %H:%M:%S" == "2021/01/13 22:23:01"
cookie "SESSION_ID[Expires]" formatDate "%y" == "2021"
The
header
query always returns a String, thus, its value could be converted explicitly.header "Expires" parseDate "%a, %d %b %H/%M/%S"
We could also add specific parse methods:
header "Expires" parseDateRFC822 year == 2022
Similarly with formatting
cookie "SESSION_ID[Expires]" formatDateRFC822 == "Tue, 1 Jul 2003 10:52:37 +0200"
For the
==
predicate,we could maybe accept
date_value == string_value
where the string_value is parsed automatically/implicitly as a date (tries common date format)
That will enable to keep the existing assert
cookie "SESSION_ID[Expires]" == "Wed, 13 Jan 2021 22:23:01 GMT"
The text was updated successfully, but these errors were encountered: