2013-05-27 16:59:33 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/filters/sameday.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: filteroperator
|
|
|
|
|
|
|
|
Filter operator that selects tiddlers with a modified date field on the same day as the provided value.
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/*
|
|
|
|
Export our filter function
|
|
|
|
*/
|
|
|
|
exports.sameday = function(source,operator,options) {
|
2013-09-21 09:08:16 +00:00
|
|
|
var results = [],
|
2014-04-10 19:19:10 +00:00
|
|
|
fieldName = operator.suffix || "modified",
|
2014-04-03 19:49:16 +00:00
|
|
|
targetDate = (new Date($tw.utils.parseDate(operator.operand))).setHours(0,0,0,0);
|
|
|
|
// Function to convert a date/time to a date integer
|
|
|
|
source(function(tiddler,title) {
|
2017-02-21 08:31:05 +00:00
|
|
|
if(tiddler) {
|
|
|
|
if(tiddler.getFieldDay(fieldName) === targetDate) {
|
2013-05-27 16:59:33 +00:00
|
|
|
results.push(title);
|
|
|
|
}
|
|
|
|
}
|
2014-04-03 19:49:16 +00:00
|
|
|
});
|
2013-05-27 16:59:33 +00:00
|
|
|
return results;
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|