mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 20:10:03 +00:00
Merge pull request #1492 from aelocson/eachday-modified
Default eachday to the modified field
This commit is contained in:
commit
956cc47cc2
@ -17,15 +17,16 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.eachday = function(source,operator,options) {
|
exports.eachday = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [],
|
||||||
values = [];
|
values = [],
|
||||||
|
fieldName = operator.operand || "modified";
|
||||||
// Function to convert a date/time to a date integer
|
// Function to convert a date/time to a date integer
|
||||||
var toDate = function(value) {
|
var toDate = function(value) {
|
||||||
value = (new Date(value)).setHours(0,0,0,0);
|
value = (new Date(value)).setHours(0,0,0,0);
|
||||||
return value+0;
|
return value+0;
|
||||||
};
|
};
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler && tiddler.fields[operator.operand]) {
|
if(tiddler && tiddler.fields[fieldName]) {
|
||||||
var value = toDate(tiddler.fields[operator.operand]);
|
var value = toDate(tiddler.fields[fieldName]);
|
||||||
if(values.indexOf(value) === -1) {
|
if(values.indexOf(value) === -1) {
|
||||||
values.push(value);
|
values.push(value);
|
||||||
results.push(title);
|
results.push(title);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
created: 20140410103123179
|
created: 20140410103123179
|
||||||
modified: 20150203184456000
|
modified: 20150210161620000
|
||||||
tags: [[Filter Operators]] [[Group Operators]] [[Date Operators]]
|
tags: [[Filter Operators]] [[Group Operators]] [[Date Operators]]
|
||||||
title: eachday Operator
|
title: eachday Operator
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
caption: eachday
|
caption: eachday
|
||||||
op-purpose: select one of each group of input titles by date
|
op-purpose: select one of each group of input titles by date
|
||||||
op-input: a [[selection of titles|Title Selection]]
|
op-input: a [[selection of titles|Title Selection]]
|
||||||
op-parameter: the name of a [[date field|Date Fields]]
|
op-parameter: the name of a [[date field|Date Fields]], defaulting to <<.field modified>>
|
||||||
op-parameter-name: F
|
op-parameter-name: F
|
||||||
op-output: a selection containing the first input title encountered for each distinct value (ignoring times of day) of field <<.place F>>
|
op-output: a selection containing the first input title encountered for each distinct value (ignoring times of day) of field <<.place F>>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user