You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "patrickdalla (via GitHub)" <gi...@apache.org> on 2023/09/11 20:31:04 UTC

[GitHub] [tika] patrickdalla commented on pull request #1329: TIKA-4126

patrickdalla commented on PR #1329:
URL: https://github.com/apache/tika/pull/1329#issuecomment-1714535743

   "By the time someone passes DateUtils a Calendar, there's already a timezone on it" from tika-4126 ISSUE:
   
   Yes, but if you see the Calendar code, this timezone that was read from XMP metadata does not immediately triggers any method to shift the hour of day field. Neither this setTimezone method, nor the "date.setTimeZone(UTC);" method in line 92 of DateUtils formatDate method.
   
   What really triggers the field hour of day sync, is the first "calendar.get(Calendar.YEAR)" that is called in doFormatDate method (line 116). But when this is triggered, the timezone is set as UTC, ignoring the first setTimezone called when the XMP metadata was read.
   
   Just add "date.get(Calendar.DAY_OF_MONTH)" right before line 92 of DateUtils formatDate and it will force sync the XMP metadata timezone read, so, in subsequent calendar.get(Calendar.DAY_OF_MONTH) done at line 117, the shift of the hour of day (and other fields) will be correctly done.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org