Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions Plugins.

Plugins. Functions

  • name

    setWeekDay

    summary

    Set the day of the week to the given date.

    description

    Set the day of the week to the given date.

    example

    // Set week day to Sunday, with the default weekStartsOn of Sunday: // Tick month index is 1..12 const result = setDay(new Date(2022, 8, 1), 0) //=> Thu June 31 2022 00:00:00 (2022/7/31)

    example

    // Set week day to Sunday, with a weekStartsOn of Monday: // Tick month index is 1..12 const result = setDay(new Date(2014, 9, 1), 0, { weekStartsOn: 1 }) //=> Sun Sep 07 2014 00:00:00

    Parameters

    • date: DateTime

      date - the date to be changed

    • dayOfWeek: number
    • weekStartsOn: number

    Returns DateTime

    the new date with the day of the week set

Generated using TypeDoc