[tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread cmari
Hi Andreas,
See this thread:
https://groups.google.com/forum/?hl=en#!searchin/tiddlywiki/datetime/tiddlywiki/Ez2OwDXBwk8/t0ZKXYjmKJ4J

which refers to Stephan's dateTimeMacro here:
http://tiddlystuff.tiddlyspot.com/

Works really well for me!
cmari

On Monday, November 24, 2014 8:46:05 AM UTC-8, Andreas wrote:

 Hi there,

 I have a field in a tiddler which holds a date (t_duedate: 2014-11-27).
 What I now want to do is to add seven days to this date by simply pressing 
 a button.

 How can I add a value to a field?
 Is there a solution for adding days?

 Hope you can help,
 Andreas


-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread Andreas
Hi cmari,

the dateTime module could be what I was searching for - thanks for this.

The usage is described like this:
The variable tag hold the current date.
$set name=tag value=dateTime DD-MMM

One question I still have:
How do I get the resulting date from the variable tag into my field 
t_duedate?
(Sorry if this question is to stupid...)

Andreas

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread Tobias Beer
Hi Andreas,
 

 I have a field in a tiddler which holds a date (t_duedate: 2014-11-27).
 What I now want to do is to add seven days to this date by simply pressing 
 a button.

 How can I add a value to a field?
 Is there a solution for adding days?


I think, eventually, this requires two things...

   - a core awareness of field-types that can be defined somewhere
   - utility widgets that allow to leverage that information and display 
   relevant controls

For example, another usecase — although not nearly as challenging — would 
be to have a boolean field set via checkbox, even in the default field 
editor that has been made type-aware.

Apart form doing basic date manipulation as you want, another meaningful 
addition for editing dates would be a date picker.

Yet another field may provide you with the option to select from a number 
of predefined defaults, etc... etc...

Best wishes, Tobias.

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread Jeremy Ruston
Hi Tobias


- a core awareness of field-types that can be defined somewhere

 Fields already have a type - look at the tiddler object definition in
boot.js.

But in practice I think that was a poor decision, and it makes more sense
for all fields to be strings and to be parsed to the required data type as
needed.  Otherwise there are problems when different plugins want to
specify a different type for the same field.

Best wishes

Jeremy.


For example, another usecase — although not nearly as challenging — would
 be to have a boolean field set via checkbox, even in the default field
 editor that has been made type-aware.






 Apart form doing basic date manipulation as you want, another meaningful
 addition for editing dates would be a date picker.

 Yet another field may provide you with the option to select from a number
 of predefined defaults, etc... etc...

 Best wishes, Tobias.

 --
 You received this message because you are subscribed to the Google Groups
 TiddlyWiki group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to tiddlywiki+unsubscr...@googlegroups.com.
 To post to this group, send email to tiddlywiki@googlegroups.com.
 Visit this group at http://groups.google.com/group/tiddlywiki.
 For more options, visit https://groups.google.com/d/optout.




-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread Tobias Beer
Hi Andreas,
 

 But in practice I think that was a poor decision, and it makes more sense 
 for all fields to be strings and to be parsed to the required data type as 
 needed.  Otherwise there are problems when different plugins want to 
 specify a different type for the same field.


Actually, perhaps not. If I had a widget and tell it to please use field 
foo as date so I can pick a day or do some other mathemagics, there really 
is no need to have some global type declaration, especially for user 
created fields.

As for Andreas' request for certain control buttons, some pointer may be 
found as to the computational magic from *dateChooserPlugin* in MPTW 
http://mgsd.tiddlyspot.com/demo3.html#%5B%5BOkay%20to%20donate%20blood%20again%5D%5D%20dateChooserPlugin%20TitleButtons
.

Best wishes, Tobias.

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread Tobias Beer


 Hi Andreas,


Err, the last one was addressing Jeremy. ^^

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread Stephan Hradek


Am Montag, 24. November 2014 18:07:38 UTC+1 schrieb Andreas:

 One question I still have:
 How do I get the resulting date from the variable tag into my field 
 t_duedate?
 (Sorry if this question is to stupid...)


There is no automatic way to do that. You need to either use a button 
and/or the action widget, or maybe, if you want to create a new tiddler, 
use something like my newtiddler widget. 

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread Danielo Rodríguez
Or you can write a widget that updates the tiddler on every refresh  Anyway 
he was asking about a button so the action widget should fit his use case. 
Sadly the set field widget is only available in TW5.1.5 prerelease

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] Button to add 1 or 7 days to a date

2014-11-24 Thread cmari
I'm sure others could do this far more efficiently, but in case it helps, 
here's a minimalist version of what I cobbled together using both the 
dateTime macro and Matabele's mangletags and setfield widgets 
(http://gwiz.tiddlyspot.com/#Widgets%20for%20Buttons:[[Widgets%20for%20Buttons]]).
 


In order to make this work, the tiddler needs to have three fields:
-repeattype (with a value of months or days, e.g., 1M, 2D, 7D, etc.)
-duedate (with a value formatted without hyphens, e.g., 20141124)
-due-date (with a value formatted with hyphens, e.g., 2014-11-24. This one 
isn't actually essential, but allows the date to be displayed in the 
tiddler.  Note that changes to this date don't affect the duedate, but 
clicking the update button will re-align this date with the duedate).
I couldn't figure out how to avoid the two date versions for my purposes, 
but at least you only need to set them up once.

The tiddler text (which can also be used in transclusion in any other 
tiddler that contains the three fields):

\define nextdeadline(duedate,repeattype)
dateTime -0MM-0DD $(duedate)$ $(repeattype)$
\end

\define nextunformatteddeadline(duedate,repeattype)
dateTime 0MM0DD $(duedate)$ $(repeattype)$
\end

\define updatefields1(to, add2,add4, add5)

$setfield set=$to$!!due-date setTo=$(add4)$ 
$setfield set=$to$!!duedate setTo=$(add5)$
$mangletags message=tm-set-field$button  message=tm-mangle-tags
update/$button/$mangletags/$setfield/$setfield
\end

\define updatefields2()
$macrocall $name=updatefields1 to={{!!title}}  add2=dateTime 
-0MM-0DD 
\end

$set name=duedate value={{!!duedate}}
$set name=repeattype value={{!!repeattype}}
$set name=add4 value=nextdeadline 
$set name=add5 value=nextunformatteddeadline 

$edit-text tiddler={{!!title}} field=due-date type=date tag=input/
$edit-text

$list filter=[all[current]]updatefields2/$list
/$set
/$set
/$set
/$set






cmari

On Monday, November 24, 2014 9:07:38 AM UTC-8, Andreas wrote:

 Hi cmari,

 the dateTime module could be what I was searching for - thanks for this.

 The usage is described like this:
 The variable tag hold the current date.
 $set name=tag value=dateTime DD-MMM

 One question I still have:
 How do I get the resulting date from the variable tag into my field 
 t_duedate?
 (Sorry if this question is to stupid...)

 Andreas



-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.