about summary refs log tree commit diff
path: root/absl/time
diff options
context:
space:
mode:
Diffstat (limited to 'absl/time')
-rw-r--r--absl/time/civil_time.h4
-rw-r--r--absl/time/civil_time_test.cc2
2 files changed, 3 insertions, 3 deletions
diff --git a/absl/time/civil_time.h b/absl/time/civil_time.h
index 2dfcbd27fef6..6bb7eec74157 100644
--- a/absl/time/civil_time.h
+++ b/absl/time/civil_time.h
@@ -407,9 +407,9 @@ inline Weekday GetWeekday(CivilDay cd) {
 //
 //   absl::CivilDay d = ...
 //   // Gets the following Thursday if d is not already Thursday
-//   absl::CivilDay thurs1 = absl::PrevWeekday(d, absl::Weekday::thursday) + 7;
+//   absl::CivilDay thurs1 = absl::NextWeekday(d - 1, absl::Weekday::thursday);
 //   // Gets the previous Thursday if d is not already Thursday
-//   absl::CivilDay thurs2 = absl::NextWeekday(d, absl::Weekday::thursday) - 7;
+//   absl::CivilDay thurs2 = absl::PrevWeekday(d + 1, absl::Weekday::thursday);
 //
 inline CivilDay NextWeekday(CivilDay cd, Weekday wd) {
   return CivilDay(time_internal::cctz::next_weekday(cd, wd));
diff --git a/absl/time/civil_time_test.cc b/absl/time/civil_time_test.cc
index b8d57135aa13..070f0d573823 100644
--- a/absl/time/civil_time_test.cc
+++ b/absl/time/civil_time_test.cc
@@ -1028,7 +1028,7 @@ TEST(CivilTime, LeapYears) {
 TEST(CivilTime, FirstThursdayInMonth) {
   const absl::CivilDay nov1(2014, 11, 1);
   const absl::CivilDay thursday =
-      absl::PrevWeekday(nov1, absl::Weekday::thursday) + 7;
+      absl::NextWeekday(nov1 - 1, absl::Weekday::thursday);
   EXPECT_EQ("2014-11-06", absl::FormatCivilTime(thursday));
 
   // Bonus: Date of Thanksgiving in the United States