Skip to content

Commit

Permalink
fix: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
algebraic-dev committed Nov 8, 2024
1 parent cdf692b commit 0ddca8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/Std/Time/Date/PlainDate.lean
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def quarter (date : PlainDate) : Bounded.LE 1 4 :=
date.month.sub 1 |>.ediv 3 (by decide) |>.add 1

/--
Transforms a tuple of a `PlainDate` into a `Day.Ordinal.OfYear`.
Transforms a `PlainDate` into a `Day.Ordinal.OfYear`.
-/
def dayOfYear (date : PlainDate) : Day.Ordinal.OfYear date.year.isLeap :=
ValidDate.dayOfYear ⟨(date.month, date.day), date.valid⟩
Expand Down Expand Up @@ -298,7 +298,9 @@ def alignedWeekOfMonth (date : PlainDate) : Week.Ordinal.OfMonth :=
days |>.ediv 7 (by decide) |>.add 1

/--
Sets the date to the specified `desiredWeekday`.
Sets the date to the specified `desiredWeekday`. If the `desiredWeekday` is the same as the current weekday,
the original `date` is returned without modification. If the `desiredWeekday` is in the future, the
function adjusts the date forward to the next occurrence of that weekday.
-/
def withWeekday (date : PlainDate) (desiredWeekday : Weekday) : PlainDate :=
let weekday := date |>.weekday |>.toOrdinal
Expand All @@ -315,7 +317,7 @@ def withWeekday (date : PlainDate) (desiredWeekday : Weekday) : PlainDate :=
date.addDays (Day.Offset.ofInt offset.toInt)

/--
Calculates the starting Monday of the ISO week-based year for a given year.
Calculates the wekk of the year starting Monday for a given year.
-/
def weekOfYear (date : PlainDate) : Week.Ordinal :=
let y := date.year
Expand Down
2 changes: 1 addition & 1 deletion src/Std/Time/Zoned/DateTime.lean
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def weekOfMonth (date : DateTime tz) : Bounded.LE 1 5 :=

/--
Determines the week of the month for the given `DateTime`. The week of the month is calculated based
on the day of the month and the weekday. Each week starts on Sunday because the entire library is
on the day of the month and the weekday. Each week starts on Monday because the entire library is
based on the Gregorian Calendar.
-/
@[inline]
Expand Down

0 comments on commit 0ddca8c

Please sign in to comment.