commit | ebc74eb6b1513e283356deb48afba71076c81d6c | [log] [tgz] |
---|---|---|
author | Christoph Schwering <schwering@google.com> | Wed Mar 05 12:46:11 2025 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Mar 05 12:46:11 2025 |
tree | 84f29d6eca17499bd7098a3aa125d08a0b3e7cfd | |
parent | bf1e4fa76daee2073b3af1903ebb325abbbb2be6 [diff] |
[Autofill] Add IsValidDateForFormat(), fix DateInfo::GetInfo() This CL introduces IsValidDateForFormat(), which replaces and generalizes Date::is_valid() and Date::is_complete(): It's equivalent to is_valid() and is_complete() in the sense that IsValidDateForFormat(date, u"YYYY-MM-DD") == date.is_valid() && date.is_complete() It's a generalization in the sense that IsValidDateForFormat(Date{.year = 2025, .month = 12, .day = 0}, u"MM/YYYY") is true even though Date{.year = 2025, .month = 12, .day = 0}.is_complete() == false. Like Date::is_valid(), IsValidDateForFormat() is tolerant. For example, if the year isn't set, it assumes a leap year. As a result, DateInfo::GetDate() returns meaningful values during incremental calls of SetDate(): DateInfo date; date.SetInfo(u"16/2022", u"MM/YYYY"); date.GetInfo(u"MM/YYYY") == u"16/2022"; Bug: 396325496 Change-Id: I5129d34555536f2e9e69f00ba4a93cf6a26ed4d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6327193 Reviewed-by: Jan Keitel <jkeitel@google.com> Commit-Queue: Christoph Schwering <schwering@google.com> Cr-Commit-Position: refs/heads/main@{#1428252}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.