We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36551
    • 416 Posts
    I've got resources with two different TVs: event-date and event-end-date. Single day events use only the event-date TV, while multi-day events use both fields.

    I've been using this to filter for future dates.
    [[!getResources? 
    ...
    &tvFilters=`event-date>=[[curDate]]` 
    ]]

    This works, however, the multi-day events drop off the list before the end date.

    So I tried adding an OR filter like this:
    &tvFilters=`event-date>=[[curDate]]||event-end-date>=[[curDate]]` 

    This produces the same result as the previous filter.

    As test, I tried filtering on the event-end-date just to confirm the field was valid.
    [[!getResources? 
    ...
    &tvFilters=`event-end-date>=[[curDate]]`
    ]]

    This produced a list of only those events with a value in event-end-date.

    PS. I tried use @where with no luck. I got either all resources or none. Not sure if this even works with TVs.

    So why doesn't this work?
    &tvFilters=`event-date>=[[curDate]]||event-end-date>=[[curDate]]` 

      • 3749
      • 24,544 Posts
      I don't see any reason why that wouldn't work, but if you give the one-day events an end date (the same as the event-date), you could try this (untested):

      &tvFilters=`event-date>=[[curDate]],event-end-date<=[[curDate]]`


        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 36551
        • 416 Posts
        Hey Bob, thanks

        I was hoping to avoid that because of the number of events that would have to be edited, multi-day events are the exception, and since the client is adding events, it's likely they will forget to include this on every entry.

        Perhaps tomorrow a fresh set of eyes will help.
          • 3749
          • 24,544 Posts
          A utility snippet could set the end dates on the existing single-day events, but you might try the technique on a few to see if it works.

          When you look in the DB, are the dates set as human-readable strings or just a big number (unix timestamp)?

          Do you need getResources? A custom snippet could pull out those resources and use the same tpl Chunk to display them.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting