Options
All
  • Public
  • Public/Protected
  • All
Menu

A day in a Calendar with extra information relative to any selection on the calendar, the current date, or events on the day.

Type parameters

  • T

    The type of data stored in the Event class.

  • M

    The type of metadata stored in the schedule.

Hierarchy

  • Day
    • CalendarDay

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

_dayIdentifier

_dayIdentifier: IdentifierInput = null

_dayOfWeek

_dayOfWeek: number = null

_dayOfYear

_dayOfYear: number = null

_fullWeekOfMonth

_fullWeekOfMonth: number = null

_fullWeekOfYear

_fullWeekOfYear: number = null

_lastDayOfMonth

_lastDayOfMonth: number = null

_lastFullWeekOfMonth

_lastFullWeekOfMonth: number = null

_lastFullWeekOfYear

_lastFullWeekOfYear: number = null

_lastWeekspanOfMonth

_lastWeekspanOfMonth: number = null

_lastWeekspanOfYear

_lastWeekspanOfYear: number = null

_monthIdentifier

_monthIdentifier: IdentifierInput = null

_quarter

_quarter: number = null

_quarterIdentifier

_quarterIdentifier: IdentifierInput = null

_timeIdentifier

_timeIdentifier: IdentifierInput = null

_week

_week: number = null

_weekIdentifier

_weekIdentifier: IdentifierInput = null

_weekOfMonth

_weekOfMonth: number = null

_weekOfYear

_weekOfYear: number = null

_weekspanOfMonth

_weekspanOfMonth: number = null

_weekspanOfYear

_weekspanOfYear: number = null

currentDay

currentDay: boolean = false

Whether this day is the current day (ex: today).

currentMonth

currentMonth: boolean = false

Whether this day is on the same month as the current day (ex: today).

currentOffset

currentOffset: number = 0

How many days away this day is from the current day (ex: today). If this day is the current day the offset is 0. If this day is before the current day it will be the negative number of days away. Otherwise this will be positive meaning this day is after the current day by the given days.

currentWeek

currentWeek: boolean = false

Whether this day is on the same week as the current day (ex: today).

currentYear

currentYear: boolean = false

Whether this day is on the same year as the current day (ex: today).

date

date: Date

The date that initialize the day. This should not be modified, and if it is it will result in unpredictable and incorrect behavior.

day

day: number

The day of the week, starting at 0 for Sunday.

dayOfMonth

dayOfMonth: number

The day of the month, starting at 1 for the 1st.

events

events: CalendarEvent<T, M>[] = []

The list of events on this day based on the settings and schedules in the calendar.

hour

hour: number

The hour of this timestamp (0 to 23).

inCalendar

inCalendar: boolean = false

Whether this day is in the current calendar or not. Some days are outside the calendar span and used to fill in weeks. Month calendars will fill in days so the list of days in the calendar start on Sunday and end on Saturday.

millis

millis: number

The milliseconds of this timestamp (0 to 999).

minute

minute: number

The minutes of this timestamp (0 to 59).

month

month: number

The month of this timestamp, zero based (January).

seconds

seconds: number

The seconds of this timestamp (0 to 59).

selectedDay

selectedDay: boolean = false

Whether this day is part of a selection on the calendar.

selectedMonth

selectedMonth: boolean = false

Whether this day is on the same month that the calendar selection is.

selectedWeek

selectedWeek: boolean = false

Whether this day is on the same week that the calendar selection is.

selectedYear

selectedYear: boolean = false

Whether this day is on the same year that the calendar selection is.

time

time: number

The time since the unix epoch in milliseconds in UTC.

year

year: number

The year of this timestamp.

Accessors

dayIdentifier

dayIdentifier:

The identifier which stores in a simple form the date of this Day.

dayOfWeek

dayOfWeek:

The day of the week relative to the first day of the week specified by Locale.weekStartsOn. So if the week starts on Monday, then this will be 0 for Monday, 1 for Tuesday, etc.

This is dependent on the locale of the instance (or global locale).

dayOfYear

dayOfYear:

The day of the year, starting at 1 for the 1st of January.

fullWeekOfMonth

fullWeekOfMonth:

The full week of the month, starting at 0 for a partial week (if one exists) and 1 for the first full week.

This is dependent on the locale of the instance (or global locale).

fullWeekOfYear

fullWeekOfYear:

The full week of the year, starting at 0 for a partial week (if one exists) and 1 for the first full week.

This is dependent on the locale of the instance (or global locale).

lastDayOfMonth

lastDayOfMonth:

The last day of the month, starting at 1 for the last day, 2 for the 2nd to last, etc.

lastFullWeekOfMonth

lastFullWeekOfMonth:

The last full week of the month, starting at 0 for the last week ending before Thursday and 1 for the last week with a Thursday.

This is dependent on the locale of the instance (or global locale).

lastFullWeekOfYear

lastFullWeekOfYear:

The last full week of the year, starting at 0 for the last week ending before Thursday and 1 for the last week with a Thursday.

This is dependent on the locale of the instance (or global locale).

lastWeekspanOfMonth

lastWeekspanOfMonth:

The last weekspan of the month, starting at 0 representing 31st to 25th for a month with 31 days. Weekspans allow you to create schedules for things like "the last saturday of the month".

lastWeekspanOfYear

lastWeekspanOfYear:

The last weekspan of the year, starting at 0 representing December 31st to December 25th. Weekspans allow you to create schedules for things like "the last saturday of the year".

monthIdentifier

monthIdentifier:

The identifier which stores in a simple form the month and year of this Day.

quarter

quarter:

The quarter of the year this day is in, starting at 0 for January through March.

quarterIdentifier

quarterIdentifier:

The identifier which stores in a simple form the quarter and year of this Day.

timeIdentifier

timeIdentifier:

The identifier which stores in a simple form the date and time of this Day.

week

week:

The week of the year. The first week of the year (1) contains Jan 1st.

This is dependent on the locale of the instance (or global locale).

weekIdentifier

weekIdentifier:

The identifier which stores in a simple form the week of the year of this Day.

weekOfMonth

weekOfMonth:

The week of the month. The first week of the month (1) is the first week which has the date Locale.firstWeekContainsDate. If there is a week before that it will be 0.

This is dependent on the locale of the instance (or global locale).

weekOfYear

weekOfYear:

The week of the year. The first week of the year (1) is the first week which has the date Locale.firstWeekContainsDate. If there is a week before that it will be 0. Frequently referred to as the ISO week.

This is dependent on the locale of the instance (or global locale).

weekspanOfMonth

weekspanOfMonth:

The weekspan of the month, starting at 0 representing the 1st to the 7th. Weekspans allow you to create schedules for things like "the first saturday of the month".

weekspanOfYear

weekspanOfYear:

The weekspan of the year, starting at 0 representing January 1st to the 7th. Weekspans allow you to create schedules for things like "the first saturday of the year".

Methods

add

  • add(unit: Unit, amount?: number): Day

asTime

between

  • between(day: Day, unit: Unit, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • unit: Unit
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

clearLocale

  • clearLocale(): void
  • Sets the locale of this Day instance to the global locale.

    Returns void

clearSelected

  • clearSelected(): this
  • Clears the selection flags on this day. This is done when the selection on the calendar is cleared.

    Returns this

compare

  • compare(day: Day, precision?: Unit): number

daysBetween

  • daysBetween(day: Day, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

daysInMonth

  • daysInMonth(): number

daysInYear

  • daysInYear(): number

endOf

  • endOf(unit: Unit, inclusive?: boolean): Day

format

  • format(format: string, cache?: boolean): string
  • Parameters

    • format: string
    • Default value cache: boolean = false

    Returns string

getLocale

hoursBetween

  • hoursBetween(day: Day, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

isAfter

  • isAfter(day: Day, precision?: Unit): boolean

isBefore

  • isBefore(day: Day, precision?: Unit): boolean

isBetween

  • isBetween(start: Day, end: Day, inclusive?: boolean, precision?: Unit): boolean
  • Parameters

    • start: Day
    • end: Day
    • Default value inclusive: boolean = true
    • Optional precision: Unit

    Returns boolean

isDST

  • isDST(): boolean

isEndOf

  • isEndOf(unit: Unit, inclusive?: boolean): boolean
  • Parameters

    • unit: Unit
    • Default value inclusive: boolean = true

    Returns boolean

isLeapYear

  • isLeapYear(): boolean

isSameOrAfter

  • isSameOrAfter(day: Day, precision?: Unit): boolean

isSameOrBefore

  • isSameOrBefore(day: Day, precision?: Unit): boolean

isStartOf

  • isStartOf(unit: Unit): boolean

iterateEvents

max

millisBetween

  • millisBetween(day: Day, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

min

minutesBetween

  • minutesBetween(day: Day, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

monthsBetween

  • monthsBetween(day: Day, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

mutate

  • mutate(mutator: function): Day
  • Parameters

    • mutator: function
        • (date: Date): any
        • Parameters

          • date: Date

          Returns any

    Returns Day

next

  • next(days?: number): Day
  • Parameters

    • Default value days: number = 1

    Returns Day

offset

  • offset(): number

prev

  • prev(days?: number): Day
  • Parameters

    • Default value days: number = 1

    Returns Day

relative

  • relative(millis: number): Day

resetLocaleCache

  • resetLocaleCache(): void

sameDay

  • sameDay(day: Day): boolean
  • Determines whether this day and the given day lie on the same day.

    Parameters

    Returns boolean

sameHour

  • sameHour(day: Day): boolean
  • Determines whether this week and the given day lie on the same year.

    Parameters

    Returns boolean

sameMinute

  • sameMinute(day: Day): boolean

sameMonth

  • sameMonth(day: Day): boolean
  • Determines whether this day and the given day lie on the same month.

    Parameters

    Returns boolean

sameQuarter

  • sameQuarter(day: Day): boolean
  • Determines whether this day and the given day lie on the same month.

    Parameters

    Returns boolean

sameTime

  • sameTime(time: Time): boolean

sameWeek

  • sameWeek(day: Day): boolean
  • Determines whether this day and the given day lie on the same week.

    Parameters

    Returns boolean

sameYear

  • sameYear(day: Day): boolean
  • Determines whether this week and the given day lie on the same year.

    Parameters

    Returns boolean

secondsBetween

  • secondsBetween(day: Day, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

setLocale

  • setLocale(key: string): this
  • Sets the locale for this Day and returns this.

    Parameters

    • key: string

      The code to the locale to apply.

    Returns this

startOf

toArray

  • toArray(): number[]

toDate

  • toDate(): Date

toISOString

  • toISOString(keepOffset?: boolean): string
  • Parameters

    • Default value keepOffset: boolean = false

    Returns string

toJSON

  • toJSON(): string

toObject

  • toObject(): object

toString

  • toString(): string

updateCurrent

  • updateCurrent(current: Day): this
  • Updates the current flags on this day given the current day (ex: today).

    Parameters

    • current: Day

      The current day of the calendar.

    Returns this

updateSelected

  • updateSelected(selected: DaySpan): this
  • Updates the selection flags on this day given the selection range on the calendar.

    Parameters

    • selected: DaySpan

      The span of days selected on the calendar.

    Returns this

utc

  • utc(keepLocalTime?: boolean): Day
  • Parameters

    • Optional keepLocalTime: boolean

    Returns Day

weeksBetween

  • weeksBetween(day: Day, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

weeksInYear

  • weeksInYear(): number

withDay

  • withDay(day: number): Day

withDayOfMonth

  • withDayOfMonth(day: number): Day

withDayOfWeek

  • withDayOfWeek(dayOfWeek: number): Day

withDayOfYear

  • withDayOfYear(dayOfYear: number): Day

withFullWeekOfMonth

  • withFullWeekOfMonth(week: number): Day

withFullWeekOfYear

  • withFullWeekOfYear(week: number): Day

withHour

  • withHour(hour: number): Day

withMonth

  • withMonth(month: number): Day

withTime

withTimes

  • withTimes(hour?: number, minute?: number, second?: number, millisecond?: number): Day
  • Parameters

    • Default value hour: number = Constants.HOUR_MIN
    • Default value minute: number = Constants.MINUTE_MIN
    • Default value second: number = Constants.SECOND_MIN
    • Default value millisecond: number = Constants.MILLIS_MIN

    Returns Day

Protected withWeek

  • withWeek(week: number, relativeWeek: number): Day

withWeekOfMonth

  • withWeekOfMonth(week: number): Day

withWeekOfYear

  • withWeekOfYear(week: number): Day

withWeekspanOfMonth

  • withWeekspanOfMonth(week: number): Day

withWeekspanOfYear

  • withWeekspanOfYear(week: number): Day

withYear

  • withYear(year: number): Day

yearsBetween

  • yearsBetween(day: Day, op?: Op, absolute?: boolean): number
  • Parameters

    • day: Day
    • Default value op: Op = Op.DOWN
    • Default value absolute: boolean = true

    Returns number

Static build

  • build(year: number, month: number, date?: number, hour?: number, minute?: number, second?: number, millisecond?: number): Day
  • Parameters

    • year: number
    • month: number
    • Default value date: number = Constants.DAY_MIN
    • Default value hour: number = Constants.HOUR_MIN
    • Default value minute: number = Constants.MINUTE_MIN
    • Default value second: number = Constants.SECOND_MIN
    • Default value millisecond: number = Constants.MILLIS_MIN

    Returns Day

Static fromArray

  • fromArray(input: number[]): Day

Static fromDate

  • fromDate(date: Date): Day | null

Static fromDayIdentifier

  • fromDayIdentifier(id: number): Day

Static fromFormat

  • fromFormat(input: string, formats: string | string[]): Day

Static fromObject

  • fromObject(input: object): Day

Static fromString

  • fromString(input: string): Day

Static now

Static parse

Static today

Static tomorrow

  • tomorrow(): Day

Static unix

  • unix(millis: number): Day

Static unixSeconds

  • unixSeconds(seconds: number): Day

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc