Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-2377

Issue with getDate()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Workaround exists
    • Icon: Major Major
    • 4.0
    • 3.5.4
    • templating
    • None

      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

        Acceptance criteria

              gjoseph Magnolia International
              omarti Olivier Marti
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD