[webkit-changes] [WebKit/WebKit] 0bb11f: input 'week' may display the wrong date when the f...

lilyspiniolas noreply at github.com
Tue Sep 10 11:06:15 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0bb11f0f467f2a3476f670ce1a913fcd5f204672
      https://github.com/WebKit/WebKit/commit/0bb11f0f467f2a3476f670ce1a913fcd5f204672
  Author: Lily Spiniolas <lily_spiniolas at apple.com>
  Date:   2024-09-10 (Tue, 10 Sep 2024)

  Changed paths:
    M Source/WebCore/en.lproj/Localizable.strings
    M Source/WebCore/platform/LocalizedStrings.cpp
    M Source/WebCore/platform/LocalizedStrings.h
    M Source/WebCore/platform/text/cocoa/LocaleCocoa.mm
    M Source/WebCore/platform/text/cocoa/LocalizedDateCache.mm
    M Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm

  Log Message:
  -----------
  input 'week' may display the wrong date when the first week or last week of a year is selected
https://bugs.webkit.org/show_bug.cgi?id=279276
rdar://132954506

Reviewed by Aditya Keerthi.

The 'week' input could show the wrong week number and/or year number depending on the first weekday of the selected year and the number of weeks in that year according to ISO-8601. A related issue could also cause the wrong week to appear as selected when reopening the calendar view after selecting a week depending on the user's locale, timezone, and the number of ISO-8601 weeks in that year.

The first issue was resolved by constructing a displayed string which directly uses DateComponents rather than using NSDateFormatter.

The second issue was resolved by updating the formatter used to calculate the initial value for input "week" to interpret the parsed date as having a time of 00:00 in the user's own timezone, preventing cases where timezone adjustments could cause the date to be interpreted as the day previous to the correct one.

* Source/WebCore/platform/text/cocoa/LocaleCocoa.mm:
(WebCore::LocaleCocoa::formatDateTime):
* Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker iso8601DateFormatterForCalendarView]):
(-[WKDateTimePicker setWeekPickerToInitialValue]):

Canonical link: https://commits.webkit.org/283427@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list