Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-2420

DateConverter doesn't handle time zones outside -12 to +12 range properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0, 2.0.2, 2.0.3, 3.0.0 PDFBox
    • 1.8.13, 2.0.3, 3.0.0 PDFBox
    • Utilities
    • None

    Description

      DateConverter normalizes time zones in restrainTZoffset(...) to a value that is between -12:00 and +12:00. So a time zone like +13:00 gets normalized to -11:00. However, the date itself is not adapted accordingly. As a result, a time stamp like "2014-7-20T05:0:00+1300" gets changed to "2014-7-20T05:0:00-1100", which is actually 24 hours later! To compensate for the time zone change, 24 hours should have been subtracted from the date: "2014-7-19T05:0:00-1100".

      Personally, I'd prefer to leave the time zones untouched completely. Note that XML Schema defines time zones up to +/- 14:00 to be valid: http://www.w3.org/TR/xmlschema-2/#dateTime-timezones. For any time zones out of that range either generate an error or consider a garbage-in-garbage-out policy.

      Attachments

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              arjohn Arjohn Kampman
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: