Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6083

TimeCategory days ago toString inconsistent

    XMLWordPrintableJSON

Details

    Description

      I ran accross this issue when working with MongoDB on Grails.
      For what reason is the output of the following lines different from each other?

      use(groovy.time.TimeCategory) {
      println 3.days.ago
      println 3.days.ago + 0.seconds
      }

      I'd expect to get the same long string "Tue Apr 02 00:00:00 UTC 2013" but the first one yields "2013-04-02"

      This leads to inconsistencies (e. g. for the first one, MongoDB doesn't understand it's a date)

      My suspicion is that this is somehow related to a toString implementation based on cdate rather than fasttime. I might be wrong.

      You can confirm this on http://groovyconsole.appspot.com/

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              fabiangebert Fabian Gebert
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: