Note that there are some explanatory texts on larger screens.

plurals
  1. PONSPredicateEditorRowTemplate for date comparison
    primarykey
    data
    text
    <p>I'm building an <code>NSPredicateEditor</code>, and I want the ability to do advanced date comparison.</p> <p>I realize that I can build an <code>NSPredicateEditorRowTemplate</code> with a <code>rightExpressionType</code> of <code>NSDateAttributeType</code>, but the predicates I want to build need to be much more advanced than that.</p> <p>For example, I need to basic comparison like:</p> <ul> <li><code>dateKeypath &lt; aDate</code></li> <li><code>dateKeypath &lt;= aDate</code></li> <li><code>dateKeypath = aDate</code></li> <li><code>dateKeypath != aDate</code></li> <li><code>dateKeypath &gt; aDate</code></li> <li><code>dateKeypath &gt;= aDate</code></li> </ul> <p>These basic comparisons are quite easy to achieve, and I have these working. However, I also need to do comparisons like:</p> <ul> <li><code>dateKeypath isInTheLast n days</code> (or weeks, months, years)</li> <li><code>dateKeypath isNotInTheLast n days</code> (or weeks, months, years)</li> <li><code>dateKeypath between aDate and anotherDate</code></li> </ul> <p>How can I achieve these sorts of comparisons? I understand that I'll need to create a custom <code>NSPredicateEditorRowTemplate</code>, but I haven't found any clear documentation on how to achieve something like this.</p> <p><strong>EDIT</strong> Bonus points are available for also knowing how to make these comparisons a full date-time (year-month-day-hour-minute-second) comparison (as <code>NSDateAttributeType</code> only has year-month-day granularity).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload