Filtering a formatted date column of a Kendo Grid

Viewed 3975

I have this DateTime column in my grid:

column.Bound(c => c.PaymentMonth).ClientTemplate("#= PaymentMonthString #")
            .Filterable(filterable => filterable
            .Operators(op => op.ForDate(d => d.Clear().IsEqualTo("Equals")))
            .Extra(false).UI("dateFilter"));

The PaymentMonthString is a read-only string property that returns the PaymentMonth in "MMMM yyyy" format.

Here's the dateFilter function for the custom filter UI:

<script>
    function dateFilter(e) {
        e.kendoDatePicker({
            format: "MMMM yyyy",
            depth: "year",
            start: "year"
        });
    }
</script>

But, the filter never works, because when you select a date from the filter menu, the current day is used by default as the day part of the date. For example, if you choose March 2016 on 3/14/2016, the date will be 3/14/2016. But, when I filter on a "MMMM yyyy" column, I don't care about the day. All the dates in March 2016 should be included. How do I make that work?

1 Answers
Related