[ 
http://jira.magnolia.info/browse/MAGNOLIA-2377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Olivier Marti resolved MAGNOLIA-2377.
-------------------------------------

    Resolution: Fixed

Ok found two ways how it's working:

Calendar orig = (Calendar) activeNode.getNodeData("date").getDate().clone();

or

Calendar orig = new GregorianCalendar();
orig.setTime(activeNode.getNodeData("date").getDate().getTime());

> Issue with getDate()
> --------------------
>
>                 Key: MAGNOLIA-2377
>                 URL: http://jira.magnolia.info/browse/MAGNOLIA-2377
>             Project: Magnolia
>          Issue Type: Bug
>          Components: templating
>    Affects Versions: 3.5.4
>            Reporter: Olivier Marti
>            Assignee: Philipp Bracher
>
> It seems that for a Value in the repository of the value "Date" only one copy 
> is existing in the memory, where all queries to it are referencing.
> This is bad, in cases I want to manipulate the date (like compare today with 
> a timespan from two weeks before till the actual value in the node).
> That's what my code looks like:
> Content activeNode= Resource.getLocalContentNode();
> Calendar orig = activeNode.getNodeData("date").getDate();
> System.out.println("orig: " + orig.getTime());
> Calendar moduleDate = activeNode.getNodeData("date").getDate();
> moduleDate.add(Calendar.DATE,-14);
> System.out.println("modified: " + moduleDate.getTime());
> Calendar reloaded = activeNode.getNodeData("date").getDate();
> System.out.println("reloaded: " + reloaded.getTime());
> Result: 
> orig: Wed Oct 15 14:30:00 CEST 2008
> modified: Wed Oct 01 14:30:00 CEST 2008
> reloaded: Wed Oct 01 14:30:00 CEST 2008

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia.info/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------

Reply via email to