Uploaded image for project: 'Apache Fineract'
  1. Apache Fineract
  2. FINERACT-926

java.util.Date returned in ISO-8601 instant format ("2011-12-03T10:15:30Z") instead of as "May 3, 2020 10:51:19 PM"

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.0
    • Component/s: None
    • Labels:
      None

      Description

      Fineract, in its apiLive.htm doc (also e.g. here), specifies that, quote:

      Dates are returned in GET requests as an array e.g. [ 2007, 4, 11]. However, the API accepts them as strings in POST and PUT requests. (...)

      This appears to be the case for org.joda.time.LocalDate instances (see org.apache.fineract.infrastructure.core.api.JodaLocalDateAdapter), and org.joda.time.DateTime are turned into nubmers of miliseconds in JSON returned by the API, and org.joda.time.MonthDay into an array of monthOfYear and dayOfMonth.

      For any java.util.Date instances, the situation appears to be less clear. While working on FINERACT-922 and wanting to interpret e.g. a jobRunStartTime or jobRunEndTime, which are java.util.Date instances in JobDetailHistoryData, I've noticed that they are currently returned as e.g. "May 3, 2020 10:51:19 PM". This format misses the timezone, and doesn't seem to be documented nor fixed in the code anywhere - it's some default by GSON? Possibly Locale dependant? Those are always fun.

      For better reproducibility, I propose that we we fix the format of such fields. Unless we need to stay backwards compatible (do we?), the "convention" in JSON seems to be to use the ISO-8601 format. I think it's the "instant format", e.g. 2011-12-03T10:15:30Z (normed to GMT), but I'm not 100% sure.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vorburger Michael Vorburger
                Reporter:
                vorburger Michael Vorburger
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: