DateGalleryChangeConfig
TYPE DEFINITION
The configuration object for the DateGallery's changeConfig method.
All properties are optional and can be used in any combination. Meaning you can change the mode and numberOfFrames, or the mode and initialDate or just the numberOfFrames.
Since 1.6.0
Properties
-
initialDate Optional
string | Date
An optional date that will act as the initial anchor date for the date frame.
When no date is provided the DateGallery will move to the anchorDate of the firstFrame.
Some examples:
- When going from day to year the year will be set to the year of the anchorDate.
- When moving from year to month it will go to January 1st of the year of the anchorDate
- When moving from week to month it will go to the first of the month from the start of the week.
Can either be a Date instance, or a string which can be passed to the Date constructor to make a date.
For example if you use "2023-06-23" as the initialDate and the mode is set to 'year', the date frame will be the year 2023. If for the same initialDate the mode was set to month-six-weeks the month of June would have been the date frame instead.
Defaults undefined meaning the current anchor date is used.
Since 1.6.0
-
mode Optional
The mode the DateGallery is going to start on.
Can be one of these modes:
- 'day': a single day per frame.
- 'week': seven days per frame, starting at the configured firstDayOfWeek.
- 'month': all days within a calendar month per frame. A frame will then always start on the first of the month, and end on the last day of the month.
- 'month-six-weeks': all days within a calendar month, but padded out to six weeks. Meaning that there are always 42 days in the frame. Useful for when you want you calendar / datepicker to be visually stable height wise. Starts the days on the configured firstDayOfWeek.
- 'month-pad-to-week': all days within a calendar month, but padded out so it always contains full weeks. Only the smallest amount of padding is added to get to the full weeks. Starts the days on the configured firstDayOfWeek. For example if the week is configured to start on sunday, and the month starts on a tuesday, it will add monday and sunday.
- 'year': a frame will contain all 365 days (or 366 when a leap year) within a year.
Defaults to undefined meaning the mode is not changed.
Since 1.6.0
-
numberOfFrames Optional
number
The number of frames that are visible at a time for the end user.
This is useful for when you want to show a multiple frames at the same time. For example if you an entire years worth of month-single-month calendars you'd set the numberOfFrames to 12.
Defaults to undefined meaning the current numberOfFrames is used
Since 1.6.0