MOBILE-182: Pin DateFormatter locale to fix dateTimeUtc on InAppShowFailure#706
Open
Vailence wants to merge 4 commits into
Open
MOBILE-182: Pin DateFormatter locale to fix dateTimeUtc on InAppShowFailure#706Vailence wants to merge 4 commits into
Vailence wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an iOS locale-dependent DateFormatter issue that could generate invalid dateTimeUtc strings (12-hour format leaking into a fixed UTC contract), and consolidates ISO-8601 date parsing/formatting into MindboxLogger as the single source of truth.
Changes:
- Pinned
Locale(identifier: "en_US_POSIX")for all relevantDateFormatterusage inMindboxLoggerand corrected a 12-hour (hh) format to 24-hour (HH) where appropriate. - Unified ISO-8601 parsing by routing
DateTimedecoding throughString.toDate(withFormat:)with a new.utcWithMillisfallback, and removed the duplicateMindbox/Extensions/Date+Extensions.swift. - Strengthened regression coverage with a new Swift Testing suite (
DateFormatTests) and stricter shape assertions inInappShowFailureManagerTests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| MindboxTests/MindboxLogger/DateFormatTests.swift | Adds Swift Testing coverage for UTC/API literals, millis parsing, and a regression guard against 12h-format leakage. |
| MindboxTests/InApp/Tests/InappShowFailureManagerTests.swift | Updates parsing to shared formatter utilities and asserts the outbound dateTimeUtc contract shape. |
| MindboxTests/Extensions/Tag+Extensions.swift | Adds a dateFormatting tag used by the new test suite. |
| MindboxLogger/Shared/Extensions/String+Extensions.swift | Adds .utcWithMillis and pins POSIX locale for parsing via toDate(withFormat:). |
| MindboxLogger/Shared/Extensions/Date+Extension.swift | Pins POSIX locale for formatting and fixes a 12h (hh) formatter to 24h (HH). |
| Mindbox/Model/Common/MBDate.swift | Switches DateTime decoding to unified logger parsing with millis fallback. |
| Mindbox/InAppMessages/Presentation/Views/WebView/Debug/MindboxWebViewFacade.swift | Switches first-init timestamp serialization to toString(withFormat: .utc). |
| Mindbox/Extensions/Date+Extensions.swift | Removes duplicated ISO-8601 parsing/formatting implementation. |
| Mindbox.xcodeproj/project.pbxproj | Updates Xcode project references (adds new tests, removes deleted date extension file). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
У тебя коммиты с номером задачи и названием ветки разъехались. Надо бы поправить |
justSmK
reviewed
May 21, 2026
| A153E04129BB0A8B003C34D4 /* InAppConfigurationWithOperations.json in Resources */ = {isa = PBXBuildFile; fileRef = A153E04029BB0A8B003C34D4 /* InAppConfigurationWithOperations.json */; }; | ||
| A154E304299C189300F8F074 /* MBLoggerCoreDataManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E303299C189300F8F074 /* MBLoggerCoreDataManagerTests.swift */; }; | ||
| A154E32E299E0D8900F8F074 /* SDKLogManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E32D299E0D8900F8F074 /* SDKLogManagerTests.swift */; }; | ||
| F3DA7E001A2B3C4D5E6F7001 /* DateFormatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3DA7E001A2B3C4D5E6F7002 /* DateFormatTests.swift */; }; |
Collaborator
There was a problem hiding this comment.
Опасный инкремент на +1 просто
justSmK
approved these changes
May 21, 2026
6cc7d2c to
00db4dd
Compare
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.
Ticket: https://tracker.yandex.ru/MOBILE-182
Summary
InappShowFailureManagerсериализуетdateTimeUtcчерезDate.toString(withFormat: .utc). БезLocale(identifier: "en_US_POSIX")форматтер на устройствах с 12-часовой региональной настройкой подменяетHH:mm:ssнаh:mm:ss aи формирует невалидную для бэкенда строку. Запинили локаль на всех форматтерах вMindboxLoggerи схлопнули дублирующий ISO-8601 вMindbox/Extensions/Date+Extensions.swiftв один источник правды.Type of Change
Changes
Locale(identifier: "en_US_POSIX")на всехDateFormatterвMindboxLogger/Shared/Extensions/Date+Extension.swiftиString+Extensions.swifthh:mm:ss.SSSS→HH:mm:ss.SSSSвDate.dateFormatter(был 12-часовым)DateFormat.utcWithMillisдля парсинга миллисекундных payload'овMindbox/Extensions/Date+Extensions.swift;DateTime.decodeWithFormatиMindboxWebViewFacadeпереведены на унифицированныйString.toDate(withFormat:)/Date.toString(withFormat:)InappShowFailureManagerTestsлокальныйmakeUTCFormatter()заменён наString.toDate(withFormat: .utc)DateFormatTestsфиксирует литералы.utc/.api/.utcWithMillis, парс round-trip и явный регресс-гард на 12h-leaktestAddFailure_setsDateTimeUtcInsideMethod: длина 20, суффиксZ, нетAM/PM/пробелов, regex^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$— контракт исходящего поля привязан к литералу, а не только к round-trip через тот же парсерTesting