You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Joerg Hoh (Jira)" <ji...@apache.org> on 2022/08/19 08:45:00 UTC

[jira] (SLING-11546) ValueMap.get("calendar", String.class) conversion loses timezone information

    [ https://issues.apache.org/jira/browse/SLING-11546 ]


    Joerg Hoh deleted comment on SLING-11546:
    -----------------------------------

was (Author: joerghoh):
Hi [~JelleBouwmans], I drafted a simple testcase in which I try to reproduce the behavior you described:
-
https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/35

The value fetched from the value map is {{2022-08-19T18:02:37.000+02:00}} and does contain a timezone information. Can you please provide more information (or even better: a testcase on your own) which illustrates the problem?-

---
Edit: I just see that you reference just the ValueMap, and not the JcrValueMap. But can you come up anyway with a failing testcase?


> ValueMap.get("calendar", String.class) conversion loses timezone information
> ----------------------------------------------------------------------------
>
>                 Key: SLING-11546
>                 URL: https://issues.apache.org/jira/browse/SLING-11546
>             Project: Sling
>          Issue Type: Bug
>          Components: API, ResourceResolver
>    Affects Versions: API 2.21.0, Resource Resolver 1.6.16
>            Reporter: Jelle Bouwmans
>            Priority: Major
>         Attachments: image-2022-08-19-10-41-27-129.png
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> When doing a ValueMap.get("calendar", String.class) conversion, before SLING-8116, 
> ISO8601.format() was used. Now, Calendar.toInstant().toString() is used. This gives a different result, because the ISO8601 gives the correct timezone, but toInstant() gives the Zulu time.
> toInstant() does the following:
> {quote}public final Instant toInstant() \{ return Instant.ofEpochMilli(getTimeInMillis()); }
> {quote}
> Timezones and offsets are completely ignored.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)