diff --git a/core/modules/filters/sameday.js b/core/modules/filters/sameday.js index 1a4571b02..478f56c90 100644 --- a/core/modules/filters/sameday.js +++ b/core/modules/filters/sameday.js @@ -17,14 +17,15 @@ Export our filter function */ exports.sameday = function(source,operator,options) { var results = [], + fieldName = operator.suffix || "modified", targetDate = (new Date($tw.utils.parseDate(operator.operand))).setHours(0,0,0,0); // Function to convert a date/time to a date integer var isSameDay = function(dateField) { return (new Date(dateField)).setHours(0,0,0,0) === targetDate; }; source(function(tiddler,title) { - if(tiddler && tiddler.fields.modified) { - if(isSameDay(tiddler.fields.modified)) { + if(tiddler && tiddler.fields[fieldName]) { + if(isSameDay(tiddler.fields[fieldName])) { results.push(title); } } diff --git a/editions/tw5.com/tiddlers/filters/FilterOperator sameday.tid b/editions/tw5.com/tiddlers/filters/FilterOperator sameday.tid index b4f9a60f1..ba9249795 100644 --- a/editions/tw5.com/tiddlers/filters/FilterOperator sameday.tid +++ b/editions/tw5.com/tiddlers/filters/FilterOperator sameday.tid @@ -4,11 +4,12 @@ tags: filters title: FilterOperator: sameday type: text/vnd.tiddlywiki -The ''sameday'' filter operator filters the current list to leave only those tiddlers whose `modified` field is on the same day as the date provided as the operand. +The ''sameday'' filter operator filters the current list to leave only those tiddlers whose `modified` field is on the same day as the date provided as the operand. The optional suffix allows a different field to be specified. For example: |!Filter String |!Description | |`[sameday[20140410]]` |Returns a list of the tiddlers modified on the 10th April 2014 | +|`[sameday:created[20140410]]` |Returns a list of the tiddlers created on the 10th April 2014 | See [[FilterOperator: eachday]] for an example.