1

I have a set of events I want to query based on user-input date times. How do I achieve something like this?

{% set entries = craft.entries.section('events').minScheduleDate('>=', 'now').maxScheduleDate('<=', 'now') %}

Where maxScheduleDate is a field for user to input date?

1

I believe this link solves your issue. https://docs.craftcms.com/v3/date-time-fields.html#settings

| improve this answer | |
  • What if the field isn't a datetime field? – Davina Leong Jul 12 '19 at 8:22
  • As long as it is not an element field like matrix, category, asset, entry. You can apply something similar to it. – Parry Huang Jul 12 '19 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.