Interface DateSupport

All Known Implementing Classes:
NaftahDate, NaftahDateTime

public interface DateSupport
Provides arithmetic operations for NaftahTemporalPoint instances, including addition and subtraction of years, months, weeks, and days.

This interface can be implemented by NaftahDate or used by NaftahDateTime to delegate date arithmetic.

Author:
Chakib Daii
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the day-of-month component of this date.
    Returns the day of the week as an Naftah string for this date.
    int
    Returns the day-of-year for this date according to its chronology.
    Returns the Naftah name of the month for this date.
    int
    Returns the numeric month value (1–12) of this date.
    int
    Returns the year component of this date.
    boolean
    Checks if the year of this date is a leap year in its chronology.
    int
    Returns the length of the month in days for this date.
    int
    Returns the length of the year in days for this date.
    minusDays(long daysToSubtract)
    Returns a new date instance with the specified number of days subtracted.
    minusMonths(long monthsToSubtract)
    Returns a new date instance with the specified number of months subtracted.
    minusWeeks(long weeksToSubtract)
    Returns a new date instance with the specified number of weeks subtracted.
    minusYears(long yearsToSubtract)
    Returns a new date instance with the specified number of years subtracted.
    plusDays(long daysToAdd)
    Returns a new date instance with the specified number of days added.
    plusMonths(long monthsToAdd)
    Returns a new date instance with the specified number of months added.
    plusWeeks(long weeksToAdd)
    Returns a new date instance with the specified number of weeks added.
    plusYears(long yearsToAdd)
    Returns a new date instance with the specified number of years added.
    long
    Converts this date to the number of days since the epoch (1970-01-01) in the ISO calendar.
  • Method Details

    • toEpochDay

      long toEpochDay()
      Converts this date to the number of days since the epoch (1970-01-01) in the ISO calendar.
      Returns:
      the epoch day count
    • getYear

      int getYear()
      Returns the year component of this date.
      Returns:
      the year value
    • getMonthValue

      int getMonthValue()
      Returns the numeric month value (1–12) of this date.
      Returns:
      the month value
    • getMonth

      String getMonth()
      Returns the Naftah name of the month for this date.
      Returns:
      the Naftah month name
    • getDayOfMonth

      int getDayOfMonth()
      Returns the day-of-month component of this date.
      Returns:
      the day of the month
    • getDayOfYear

      int getDayOfYear()
      Returns the day-of-year for this date according to its chronology.
      Returns:
      the day of the year (1–365 or 1–366 for leap years)
    • getDayOfWeek

      String getDayOfWeek()
      Returns the day of the week as an Naftah string for this date.

      The calculation is based on the epoch day of the underlying ChronoLocalDate.

      Returns:
      the Naftah name of the day of the week
    • isLeapYear

      boolean isLeapYear()
      Checks if the year of this date is a leap year in its chronology.
      Returns:
      true if the year is a leap year, false otherwise
    • lengthOfMonth

      int lengthOfMonth()
      Returns the length of the month in days for this date.

      The length is determined according to the chronology of the calendar.

      Returns:
      the number of days in the month
    • lengthOfYear

      int lengthOfYear()
      Returns the length of the year in days for this date.

      The number of days depends on the chronology of the date:

      • For Gregorian years (ISO chronology), leap years return 366 days, and non-leap years return 365 days.
      • For Hijri years, leap years return 355 days, and non-leap years return 354 days.

      Returns:
      the number of days in the year according to its chronology
    • plusYears

      NaftahTemporalPoint plusYears(long yearsToAdd)
      Returns a new date instance with the specified number of years added.
      Parameters:
      yearsToAdd - the number of years to add, may be negative
      Returns:
      a new NaftahTemporalPoint instance with years added
    • plusMonths

      NaftahTemporalPoint plusMonths(long monthsToAdd)
      Returns a new date instance with the specified number of months added.
      Parameters:
      monthsToAdd - the number of months to add, may be negative
      Returns:
      a new NaftahTemporalPoint instance with months added
    • plusWeeks

      NaftahTemporalPoint plusWeeks(long weeksToAdd)
      Returns a new date instance with the specified number of weeks added.
      Parameters:
      weeksToAdd - the number of weeks to add, may be negative
      Returns:
      a new NaftahTemporalPoint instance with weeks added
    • plusDays

      NaftahTemporalPoint plusDays(long daysToAdd)
      Returns a new date instance with the specified number of days added.
      Parameters:
      daysToAdd - the number of days to add, may be negative
      Returns:
      a new NaftahTemporalPoint instance with days added
    • minusYears

      NaftahTemporalPoint minusYears(long yearsToSubtract)
      Returns a new date instance with the specified number of years subtracted.
      Parameters:
      yearsToSubtract - the number of years to subtract, may be negative
      Returns:
      a new NaftahTemporalPoint instance with years subtracted
    • minusMonths

      NaftahTemporalPoint minusMonths(long monthsToSubtract)
      Returns a new date instance with the specified number of months subtracted.
      Parameters:
      monthsToSubtract - the number of months to subtract, may be negative
      Returns:
      a new NaftahTemporalPoint instance with months subtracted
    • minusWeeks

      NaftahTemporalPoint minusWeeks(long weeksToSubtract)
      Returns a new date instance with the specified number of weeks subtracted.
      Parameters:
      weeksToSubtract - the number of weeks to subtract, may be negative
      Returns:
      a new NaftahTemporalPoint instance with weeks subtracted
    • minusDays

      NaftahTemporalPoint minusDays(long daysToSubtract)
      Returns a new date instance with the specified number of days subtracted.
      Parameters:
      daysToSubtract - the number of days to subtract, may be negative
      Returns:
      a new NaftahTemporalPoint instance with days subtracted