fix: [SDK-5284] parse IAM end_time as UTC instead of device timezone - #2755
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
nan-li
self-requested a review
September 18, 2026 21:36
Contributor
📊 Diff Coverage ReportDiff Coverage Report (Changed Lines Only)Gate: aggregate coverage on changed executable lines must be ≥ 80% (JaCoCo line data for lines touched in the diff). Changed Files Coverage
Overall (aggregate gate)3/3 touched executable lines covered (100.0% — requires ≥ 80%) |
nan-li
approved these changes
Sep 18, 2026
Merged
This was referenced Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Parse and format ISO-8601
Ztimestamps in UTC so scheduled In-App Messages stop expiring early (or late) on devices outside UTC.Details
Motivation
Fixes SDK-5284. A customer in JST (UTC+9) reported that In-App Messages with a schedule end time never displayed on Android, while iOS displayed them correctly.
The server sends IAM
end_timeas ISO-8601 with a literalZsuffix, for example2026-09-18T21:30:00.000Z.DateUtils.iso8601Format()used the patternyyyy-MM-dd'T'HH:mm:ss.SSS'Z'. The quoted'Z'is a literal character match, not a timezone specifier, soSimpleDateFormatparsed the wall-clock portion in the device's default timezone. On a JST device21:30Zbecame21:30 JST(12:30Z), nine hours early, soInAppMessage.isFinishedreturned true and the message was skipped.iOS sets its formatter to UTC and uses
XXXXX, which is why the same IAM displayed there.Scope
DateUtils.iso8601Format()now sets the formatter timezone to UTC. The pattern and wire format are unchanged.InAppMessageend time parsing andend_timeformatting intoJSONObject().CustomEventBackendServicealready applied UTC itself, so its payload is unchanged.Testing
Unit testing
Added
DateUtilsTestcovering both directions under anAsia/Tokyodefault timezone:2026-09-14T11:30:00.000Zyields the exact UTC instant2026-09-14T11:30:00.000ZThe parse test failed before the fix with a 9 hour offset and passes after. IAM module unit tests pass.
Manual testing
Switched my Mac and Android emulator timezones to Tokyo (UTC+9) and scheduled an IAM to stop showing about 10 minutes in the future. Validated that the IAM displays on both Android and iOS with this branch.
I also validated the original issue on
main: with the same setup, iOS displayed the IAM but Android skipped it. Logs onmainshowed the serverend_timeof2026-09-18T21:30:00.000Zbeing parsed asFri Sep 18 21:30:00 GMT+09:00 2026(already in the past). On this branch the same value parses asSat Sep 19 06:30:00 GMT+09:00 2026and the IAM displays.Environment: Android emulator (Pixel, Android 16 / API 36), OneSignal example app, iOS Simulator.
Affected code checklist
Checklist
Overview
Testing
Final pass