Thanks Vincent, great.
How would you advise to add this to a xForm.
We would like to allow the user in EDIT mode to enter years, months and days (since
birth)
I would then specify a class with a number/integer
Attribute age, type Number/Integer
$doc.display(age) would give me a numeric field to enter in HTML
Should I use:
- Custom display using joda
- A piece of velocity in the sheet using joda
- a piece of Javascript showing to the user a set of controls
Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website<http://www.cdlsworld.org>
Facebook<https://www.facebook.com/gerritjan.koekkoek>
email<gerritjan(a)cdlsworld.org>
________________________________
From: users <users-bounces(a)xwiki.org> on behalf of Vincent Massol
<vincent(a)massol.net>
Sent: 14 November 2016 09:05:04
To: XWiki Users
Subject: Re: [xwiki-users] AGE and calculating date
Hi,
On 14 Nov 2016, at 08:56, Gerritjan Koekkoek
<gerritjan(a)cdlsworld.org> wrote:
Hi,
I think this might a velocity/java script or groovy question more as a xwiki question.
We want to record a age (Period of days/seconds since birth date).
What datatype would you recommend:
- String structured
- Numeric integer of Days or Seconds
I’d use a Number.
- Date/Time
We would like to be able to display the data as:
- Date notation
- Years, Months, Weeks
- Years, Months, Days
- Years, Months
Things to consider is that each month has different period lengths in days and that each
4 years we have different number of days in a year
Should/Can we do this server side (velocity)
What velocity tools or services can we use
I’d use Joda Time ($xwiki.jodatime).
See
http://extensions.xwiki.org/xwiki/bin/view/Extension/Joda+Time+Plugin
You should google jodatime to find out all its API (it’s quite rich).
Thanks
-Vincent
Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website<http://www.cdlsworld.org>
Facebook<https://www.facebook.com/gerritjan.koekkoek>
email<gerritjan(a)cdlsworld.org>
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users