This message was deleted.
# give-feedback
w
This message was deleted.
e
I asked for something in this regard here. I also would love to have more powerful date comparison strategies not tied to simple string comparison.
👍 1
f
I think a syntax like this would make sense to add:
Copy code
{
  "created_at": {
    "$gt": {
      "$dateSubtract": {
        "startDate": "$$NOW",
        "unit": "day",
        "amount": 7
      }
    }
  }
}
We would have a nice UI on top of that, but that's what I'm thinking for the underlying JSON. This would require SDK changes to support, so have to be a little careful about versioning and how we roll this out.
👍 1
💯 1
e
Cool, as close to the MongoDB $dateAdd and $dateSubtract syntax that we can stay in GrowthBook, easier to understand and use properly.
b
https://growthbookusers.slack.com/archives/C01T6Q0TEG3/p1663167471142039?thread_ts=1663166502.869459&cid=C01T6Q0TEG3 total honesty, this feels a little overengineered to me - matching with the mongo style is a great idea, but do you really want to take it this far? If you need to add something mongo doesn't have, how would you do it? But from an end-user perspective, assuming the UI is easy to use, sounds great 👌
f
@busy-horse-73824 That's fair. Another direction we could go is to automatically create a matching relative attribute for any date string attributes:
Copy code
attributes: {
  created_at: "2022-09-01T01:23:45Z"
}
The default behavior would stay the same:
Copy code
{
  "created_at": {
    "$gt": "2022-01-01"
  }
}
But, you could opt in to referencing a relative time instead (now - date in seconds)
Copy code
{
  "created_at.relative": {
    "$gt": -604800
  }
}
b
Ah yeah that could work well too. Personally it doesn't matter to me how it works under the hood - it'd be excellent to have regardless of how it's done
d
Is this functionality available now? (either in JSON or via the UI)
f
It is not supported yet. The workaround is still to add two different attributes in the SDK, one with an absolute date and another with the relative time (now - date). I added a GitHub issue to add built-in support for this to make this use case easier - https://github.com/growthbook/growthbook/issues/685
147 Views