Hi, Ok :) thanks alot...but,
I'm a novice you know. How do I use it in a tiddler? I've saved the macro/script as a new tiddler with the name AgeMacro and tagged it systemConfig (don't know if it has to). Can you give an example? Thanks again :) //Tobbe On 23 Okt, 14:41, rakugo <[email protected]> wrote: > Lucky for you I've been working on that for my family tree vertical. > Unfortunately only giving amount of months and years (not days). > The code is below - hope this is a good starting point. > Jon. > > config.macros.age ={ > handler: function(place, macroName, params, wikifier, paramString, > tiddler){ > var d1 = tiddler.fields["dob"]; > var d2= tiddler.fields["dod"]; > if(!d2){ > d2 = new Date().convertToLocalYYYYMMDDHHMM(); > } > var y1 = parseInt(d1.substr(0,4)); > var y2 = parseInt(d2.substr(0,4)); > > var m1 = parseInt(d1.substr(4,2)); > var m2 = parseInt(d2.substr(4,2)); > > var day1 = parseInt(d1.substr(6,2)); > var day2 = parseInt(d2.substr(6,2)); > > var ageY = y2-y1; > var ageM = m2 - m1; > if(m2 > m1){ > ageM = m2 - m1; > } > else if(m2 < m1){ > ageM = 12 -(m1- m2); > ageY -=1; > } > > var html =ageY + "years"; > if(ageM != 0){ > html+=" and "+ ageM+" months"; > } > jQuery(place).html(html); > > } > > }; > > On Oct 23, 12:38 pm, Tobbe <[email protected]> wrote: > > > Hi, > > > I'm searching for a method to view a persons age in a tiddler. Let's > > say the person whas bord 20 apr 1645 and died 30 nov 1715. How old is > > that person in years, month and days? Even if the person is still > > alive today it should show the persons present age. > > > TIA. > > > //Tobbe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en -~----------~----~----~----~------~----~------~--~---

