Browse Source

LibWeb: Use date constants

Make the code DRY (Don't Repeat Yourself) by using the `AK`-provided
month name constants instead of copying them.
Lenny Maiorani 3 years ago
parent
commit
148f8169a4
1 changed files with 2 additions and 3 deletions
  1. 2 3
      Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp

+ 2 - 3
Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp

@@ -5,6 +5,7 @@
  */
  */
 
 
 #include "ParsedCookie.h"
 #include "ParsedCookie.h"
+#include <AK/DateConstants.h>
 #include <AK/Function.h>
 #include <AK/Function.h>
 #include <AK/StdLibExtras.h>
 #include <AK/StdLibExtras.h>
 #include <AK/Vector.h>
 #include <AK/Vector.h>
@@ -263,10 +264,8 @@ Optional<Core::DateTime> parse_date_time(StringView date_string)
     };
     };
 
 
     auto parse_month = [&](StringView token) {
     auto parse_month = [&](StringView token) {
-        static const char* months[] { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" };
-
         for (unsigned i = 0; i < 12; ++i) {
         for (unsigned i = 0; i < 12; ++i) {
-            if (token.equals_ignoring_case(months[i])) {
+            if (token.equals_ignoring_case(short_month_names[i])) {
                 month = i + 1;
                 month = i + 1;
                 return true;
                 return true;
             }
             }