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?


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

  • What if the field isn't a datetime field? 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. 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.