Documentation

Std.Time.Date.PlainDate

PlainDate represents a date in the Year-Month-Day (YMD) format. It encapsulates the year, month, and day components, with validation to ensure the date is valid.

  • The year component of the date. It is represented as an Offset type from Year.

  • The month component of the date. It is represented as an Ordinal type from Month.

  • The day component of the date. It is represented as an Ordinal type from Day.

  • valid : self.year.Valid self.month self.day

    Validates the date by ensuring that the year, month, and day form a correct and valid date.

Instances For
    theorem Std.Time.PlainDate.ext {x y : PlainDate} (year : x.year = y.year) (month : x.month = y.month) (day : x.day = y.day) :
    x = y
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[instance_reducible]
        Equations
        @[instance_reducible]
        Equations
        • One or more equations did not get rendered due to their size.
        @[inline]

        Creates a PlainDate by clipping the day to ensure validity. This function forces the date to be valid by adjusting the day to fit within the valid range to fit the given month and year.

        Equations
        Instances For
          @[instance_reducible]
          Equations
          @[inline]

          Creates a new PlainDate from year, month, and day components.

          Equations
          Instances For
            @[inline]

            Creates a PlainDate from a year and a day ordinal within that year.

            Equations
            Instances For

              Creates a PlainDate from the number of days since January 1st, 1970.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Returns the aligned week of the month for a PlainDate. Weeks are fixed 7-day slots starting from day 1: days 1–7 are week 1, days 8–14 are week 2, etc.

                Equations
                Instances For

                  Determines the quarter of the year for the given PlainDate.

                  Equations
                  Instances For

                    Transforms a PlainDate into a Day.Ordinal.OfYear.

                    Equations
                    Instances For
                      @[inline]

                      Determines the era of the given PlainDate based on its year.

                      Equations
                      Instances For
                        @[inline]

                        Checks if the PlainDate is in a leap year.

                        Equations
                        Instances For

                          Converts a PlainDate to the number of days since 1970-01-01T00:00:00.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[inline]

                            Adds a given number of days to a PlainDate.

                            Equations
                            Instances For
                              @[inline]

                              Subtracts a given number of days from a PlainDate.

                              Equations
                              Instances For
                                @[inline]

                                Adds a given number of weeks to a PlainDate.

                                Equations
                                Instances For
                                  @[inline]

                                  Subtracts a given number of weeks from a PlainDate.

                                  Equations
                                  Instances For

                                    Adds a given number of months to a PlainDate, clipping the day to the last valid day of the month.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      @[inline]

                                      Subtracts Month.Offset from a PlainDate, it clips the day to the last valid day of that month.

                                      Equations
                                      Instances For

                                        Creates a PlainDate by rolling over the extra days to the next month.

                                        Equations
                                        Instances For
                                          @[inline]

                                          Creates a new PlainDate by adjusting the year to the given year value. The month and day remain unchanged, and any invalid days for the new year will be handled according to the clip behavior.

                                          Equations
                                          Instances For
                                            @[inline]

                                            Creates a new PlainDate by adjusting the year to the given year value. The month and day are rolled over to the next valid month and day if necessary.

                                            Equations
                                            Instances For

                                              Adds a given number of months to a PlainDate, rolling over any excess days into the following month.

                                              Equations
                                              Instances For
                                                @[inline]

                                                Subtracts Month.Offset from a PlainDate, rolling over excess days as needed.

                                                Equations
                                                Instances For
                                                  @[inline]

                                                  Adds Year.Offset to a PlainDate, rolling over excess days to the next month, or next year.

                                                  Equations
                                                  Instances For
                                                    @[inline]

                                                    Subtracts Year.Offset from a PlainDate, rolling over excess days to the next month.

                                                    Equations
                                                    Instances For
                                                      @[inline]

                                                      Adds Year.Offset to a PlainDate, clipping the day to the last valid day of the month.

                                                      Equations
                                                      Instances For
                                                        @[inline]

                                                        Subtracts Year.Offset from a PlainDate, clipping the day to the last valid day of the month.

                                                        Equations
                                                        Instances For
                                                          @[inline]

                                                          Creates a new PlainDate by adjusting the day of the month to the given days value, with any out-of-range days clipped to the nearest valid date.

                                                          Equations
                                                          Instances For
                                                            @[inline]

                                                            Creates a new PlainDate by adjusting the day of the month to the given days value, with any out-of-range days rolled over to the next month or year as needed.

                                                            Equations
                                                            Instances For
                                                              @[inline]

                                                              Creates a new PlainDate by adjusting the month to the given month value. The day remains unchanged, and any invalid days for the new month will be handled according to the clip behavior.

                                                              Equations
                                                              Instances For
                                                                @[inline]

                                                                Creates a new PlainDate by adjusting the month to the given month value. The day is rolled over to the next valid month if necessary.

                                                                Equations
                                                                Instances For

                                                                  Calculates the Weekday of a given PlainDate using Zeller's Congruence for the Gregorian calendar.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For

                                                                    Returns the week of the month for the given PlainDate, where weeks start on firstDay. The first partial week containing day 1 is week 1, so weeks may span fewer than 7 days.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For

                                                                      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.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For

                                                                        Returns the first day of the week-based year for the given year, where weeks start on firstDay and the first week must contain at least minimalDays days of the new year.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For

                                                                          Returns the week number within the week-based year for the given PlainDate, using firstDay as the start of the week and minDays as the minimum number of days required in the first week of the year (default 4 for ISO 8601). Dates before the first week of the calendar year are counted as part of the last week of the previous year.

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For

                                                                            Returns the week-based year for the given PlainDate, using firstDay as the start of the week and minDays as the minimum number of days in the first week of the year (default 4 for ISO 8601).

                                                                            Equations
                                                                            • One or more equations did not get rendered due to their size.
                                                                            Instances For