Search code examples
manatee.trello

Trello Manatee - How to filter cards in a list by Date (since and before)


I want to fetch cards by date, for example:

list.Cards.Filter(CardFilter.Closed).Since("someDate").toList()

but there is no extension for cards like actions.


Solution

  • There is a Filter () overload that takes start and end dates.

    Edit 1

    This is wrong. I was thinking action collections. I'll check the API and come back.

    Edit 2

    As per the Trello docs there is no "get cards by date" function. However, there are a couple ways to do this:

    • By creation date

      list.Cards.Filter(CardFilter.Closed) .Where(c => c.CreationDate >= someDate);

    • By last modified date

      list.Cards.Filter(CardFilter.Closed) .Where(c => c.LastActivity >= someDate);

    Also, remember that you can get cards for lists (as you're doing and above) as well as all of the cards for an entire board.

    Edit 3

    Manatee.Trello v1.16.0 provides this functionality as a new overload of the Filter() extension method on the ReadOnlyCardCollection object. You can use it like this:

    list.Cards.Filter(new DateTime(2017,1,1), null);
    

    to get all cards in a list that were created after 1 Jan 2017. The other parameter is an end date.