[Transform Rules] Introduce time usage in Expression Rules

Good morning,

I am writing to you about a feature that would be very useful to us.
We would like to use the transform rules but we need, in addition to the comparison operators, also arithmetic operators (sum, product, subtraction, modulus…).
We would need this to do calculations on http.request.timestamp.sec.
If this is not possible then I would recommend adding methods to extract information (date methods) from http.request.timestamp.sec so you can see:

  • Time zone
  • Get the hour of the request
  • Get the minutes of the request
  • Get the seconds of the request
    Let us know if it would be interesting and you plan to include it in your backlog.
    If it is already possible to implement this functionality (without implementing a Cloudflare worker but only with expressions) please let us know.

Best regards

1 Like

Could you share the use case?

We want to create a dynamic caching based on time.
For instance:

  • max-age=28800 if http.request.timestamp.sec is between 8PM and 6AM
  • otherwise max-age=3600

All this only and exclusively with expressions