projects/angularx-flatpickr/src/lib/flatpickr-defaults.service.ts
Properties |
|
allowInput |
allowInput:
|
Type : boolean
|
Optional |
Allows the user to enter a date directly input the input field. By default, direct entry is disabled. |
allowInvalidPreload |
allowInvalidPreload:
|
Type : boolean
|
Optional |
Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid |
altFormat |
altFormat:
|
Type : string
|
Optional |
Exactly the same as date format, but for the altInput field. |
altInput |
altInput:
|
Type : boolean
|
Optional |
Example :
|
altInputClass |
altInputClass:
|
Type : string
|
Optional |
This class will be added to the input element created by the altInput option.
Note that |
appendTo |
appendTo:
|
Type : HTMLElement
|
Optional |
Instead of |
ariaDateFormat |
ariaDateFormat:
|
Type : string
|
Optional |
Defines how the date will be formatted in the aria-label for calendar days, using the same tokens as dateFormat. If you change this, you should choose a value that will make sense if a screen reader reads it out loud. |
clickOpens |
clickOpens:
|
Type : boolean
|
Optional |
Whether clicking on the input should open the picker.
You could disable this if you wish to open the calendar manually |
convertModelValue |
convertModelValue:
|
Type : boolean
|
Optional |
Auto convert the ngModel value from a string to a date / array of dates / from - to date object depending on the |
dateFormat |
dateFormat:
|
Type : string
|
Optional |
A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in the table below. |
defaultHour |
defaultHour:
|
Type : number
|
Optional |
Initial value of the hour element. |
defaultMinute |
defaultMinute:
|
Type : number
|
Optional |
Initial value of the minute element. |
defaultSeconds |
defaultSeconds:
|
Type : number
|
Optional |
Initial value of the seconds element. |
disable |
disable:
|
Type : DisableEnableDate[]
|
Optional |
See disabling dates. |
disableMobile |
disableMobile:
|
Type : boolean
|
Optional |
Set disableMobile to true to always use the non-native picker. By default, Flatpickr utilizes native datetime widgets unless certain options (e.g. disable) are used. |
enable |
enable:
|
Type : DisableEnableDate[]
|
Optional |
See enabling dates. |
enableSeconds |
enableSeconds:
|
Type : boolean
|
Optional |
Enables seconds in the time picker. |
enableTime |
enableTime:
|
Type : boolean
|
Optional |
Enables time picker. |
formatDate |
formatDate:
|
Type : function
|
Optional |
Allows using a custom date formatting function instead of the built-in handling for date formats using dateFormat, altFormat, etc. |
getWeek |
getWeek:
|
Type : function
|
Optional |
You may override the function that extracts the week numbers from a Date by supplying a getWeek function. It takes in a date as a parameter and should return a corresponding string that you want to appear left of every week. |
hourIncrement |
hourIncrement:
|
Type : number
|
Optional |
Adjusts the step for the hour input (incl. scrolling). |
ignoredFocusElements |
ignoredFocusElements:
|
Type : HTMLElement[]
|
Optional |
Array of HTML elements that should not close the picker on click. |
inline |
inline:
|
Type : boolean
|
Optional |
Displays the calendar inline. |
locale |
locale:
|
Type : object | string
|
Optional |
The locale object or string to use for the locale. |
maxDate |
maxDate:
|
Type : string | Date
|
Optional |
The maximum date that a user can pick to (inclusive). |
maxTime |
maxTime:
|
Type : string
|
Optional |
The maximum time that a user can pick to (inclusive). |
minDate |
minDate:
|
Type : string | Date
|
Optional |
The minimum date that a user can start picking from (inclusive). |
minTime |
minTime:
|
Type : string
|
Optional |
The minimum time that a user can start picking from (inclusive). |
minuteIncrement |
minuteIncrement:
|
Type : number
|
Optional |
Adjusts the step for the minute input (incl. scrolling). |
mode |
mode:
|
Type : "single" | "multiple" | "range"
|
Optional |
Select a single date, multiple dates or a date range. |
monthSelectorType |
monthSelectorType:
|
Type : "static" | "dropdown"
|
Optional |
How the month should be displayed in the header of the calendar. |
nextArrow |
nextArrow:
|
Type : string
|
Optional |
HTML for the arrow icon, used to switch months. |
noCalendar |
noCalendar:
|
Type : boolean
|
Optional |
Hides the day selection in calendar. Use it along with |
now |
now:
|
Type : Date | string | number
|
Optional |
Provide a date for 'today', which will be used instead of "new Date()" |
parseDate |
parseDate:
|
Type : function
|
Optional |
Function that expects a date string and must return a Date object. |
plugins |
plugins:
|
Type : any[]
|
Optional |
Array of plugin instances to use. |
prevArrow |
prevArrow:
|
Type : string
|
Optional |
HTML for the left arrow icon. |
shorthandCurrentMonth |
shorthandCurrentMonth:
|
Type : boolean
|
Optional |
Show the month using the shorthand version (ie, Sep instead of September). |
showMonths |
showMonths:
|
Type : number
|
Optional |
The number of months shown. |
static |
static:
|
Type : boolean
|
Optional |
Position the calendar inside the wrapper and next to the input element. (Leave |
time24hr |
time24hr:
|
Type : boolean
|
Optional |
Displays time picker in 24 hour mode without AM/PM selection when enabled. |
utc |
utc:
|
Type : boolean
|
Optional |
When true, dates will parsed, formatted, and displayed in UTC. It's recommended that date strings contain the timezone, but not necessary. |
weekNumbers |
weekNumbers:
|
Type : boolean
|
Optional |
Enables display of week numbers in calendar. |
wrap |
wrap:
|
Type : boolean
|
Optional |
Custom elements and input groups. |
import { Injectable } from '@angular/core';
export type DisableEnableDate =
| string
| Date
| { from: Date | string; to: Date | string }
| ((date: Date) => boolean);
export interface FlatpickrDefaultsInterface {
/**
* Exactly the same as date format, but for the altInput field.
*/
altFormat?: string;
/**
* Show the user a readable date (as per altFormat), but return something totally different to the server.
*/
altInput?: boolean;
/**
* This class will be added to the input element created by the altInput option.
* Note that `altInput` already inherits classes from the original input.
*/
altInputClass?: string;
/**
* Allows the user to enter a date directly input the input field. By default, direct entry is disabled.
*/
allowInput?: boolean;
/**
* Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid
*/
allowInvalidPreload?: boolean;
/**
* Instead of `body`, appends the calendar to the specified node instead.
*/
appendTo?: HTMLElement;
/**
* Defines how the date will be formatted in the aria-label for calendar days, using the same tokens as dateFormat. If you change this, you should choose a value that will make sense if a screen reader reads it out loud.
*/
ariaDateFormat?: string;
/**
* Whether clicking on the input should open the picker.
* You could disable this if you wish to open the calendar manually `with.open()`.
*/
clickOpens?: boolean;
/**
* A string of characters which are used to define how the date will be displayed in the input box.
* The supported characters are defined in the table below.
*/
dateFormat?: string;
/**
* Initial value of the hour element.
*/
defaultHour?: number;
/**
* Initial value of the minute element.
*/
defaultMinute?: number;
/**
* Initial value of the seconds element.
*/
defaultSeconds?: number;
/**
* See <a href="https://chmln.github.io/flatpickr/examples/#disabling-specific-dates">disabling dates</a>.
*/
disable?: DisableEnableDate[];
/**
* Set disableMobile to true to always use the non-native picker.
* By default, Flatpickr utilizes native datetime widgets unless certain options (e.g. disable) are used.
*/
disableMobile?: boolean;
/**
* See <a href="https://chmln.github.io/flatpickr/examples/#disabling-all-dates-except-select-few">enabling dates</a>.
*/
enable?: DisableEnableDate[];
/**
* Enables time picker.
*/
enableTime?: boolean;
/**
* Enables seconds in the time picker.
*/
enableSeconds?: boolean;
/**
* Allows using a custom date formatting function instead of the built-in handling for date formats using dateFormat, altFormat, etc.
*/
formatDate?: (value: any) => string;
/**
* Adjusts the step for the hour input (incl. scrolling).
*/
hourIncrement?: number;
/**
* Displays the calendar inline.
*/
inline?: boolean;
/**
* The maximum date that a user can pick to (inclusive).
*/
maxDate?: string | Date;
/**
* The minimum date that a user can start picking from (inclusive).
*/
minDate?: string | Date;
/**
* The maximum time that a user can pick to (inclusive).
*/
maxTime?: string;
/**
* The minimum time that a user can start picking from (inclusive).
*/
minTime?: string;
/**
* Adjusts the step for the minute input (incl. scrolling).
*/
minuteIncrement?: number;
/**
* Select a single date, multiple dates or a date range.
*/
mode?: 'single' | 'multiple' | 'range';
/**
* HTML for the arrow icon, used to switch months.
*/
nextArrow?: string;
/**
* Hides the day selection in calendar. Use it along with `enableTime` to create a time picker.
*/
noCalendar?: boolean;
/**
* Provide a date for 'today', which will be used instead of "new Date()"
*/
now?: Date | string | number;
/**
* Function that expects a date string and must return a Date object.
*/
parseDate?: (str: string) => Date;
/**
* HTML for the left arrow icon.
*/
prevArrow?: string;
/**
* Show the month using the shorthand version (ie, Sep instead of September).
*/
shorthandCurrentMonth?: boolean;
/**
* Position the calendar inside the wrapper and next to the input element. (Leave `false` unless you know what you're doing).
*/
static?: boolean;
/**
* Displays time picker in 24 hour mode without AM/PM selection when enabled.
*/
time24hr?: boolean;
/**
* When true, dates will parsed, formatted, and displayed in UTC.
* It's recommended that date strings contain the timezone, but not necessary.
*/
utc?: boolean;
/**
* Enables display of week numbers in calendar.
*/
weekNumbers?: boolean;
/**
* You may override the function that extracts the week numbers from a Date by supplying a getWeek function.
* It takes in a date as a parameter and should return a corresponding string that you want to appear left of every week.
*/
getWeek?: (date: Date) => string;
/**
* Custom elements and input groups.
*/
wrap?: boolean;
/**
* Array of plugin instances to use.
*/
plugins?: any[];
/**
* The locale object or string to use for the locale.
*/
locale?: object | string;
/**
* Auto convert the ngModel value from a string to a date / array of dates / from - to date object depending on the `mode`
*/
convertModelValue?: boolean;
/**
* The number of months shown.
*/
showMonths?: number;
/**
* How the month should be displayed in the header of the calendar.
*/
monthSelectorType?: 'static' | 'dropdown';
/**
* Array of HTML elements that should not close the picker on click.
*/
ignoredFocusElements?: HTMLElement[];
}
@Injectable()
export class FlatpickrDefaults implements FlatpickrDefaultsInterface {
/**
* Exactly the same as date format, but for the altInput field.
*/
altFormat: string = 'F j, Y';
/**
* Show the user a readable date (as per altFormat), but return something totally different to the server.
*/
altInput: boolean = false;
/**
* This class will be added to the input element created by the altInput option.
* Note that `altInput` already inherits classes from the original input.
*/
altInputClass: string = '';
/**
* Allows the user to enter a date directly input the input field. By default, direct entry is disabled.
*/
allowInput: boolean = false;
/**
* Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid
*/
allowInvalidPreload: boolean = false;
/**
* Instead of `body`, appends the calendar to the specified node instead.
*/
appendTo: HTMLElement | undefined = undefined;
/**
* Defines how the date will be formatted in the aria-label for calendar days, using the same tokens as dateFormat. If you change this, you should choose a value that will make sense if a screen reader reads it out loud.
*/
ariaDateFormat?: string = 'F j, Y';
/**
* Whether clicking on the input should open the picker.
* You could disable this if you wish to open the calendar manually `with.open()`.
*/
clickOpens: boolean = true;
/**
* A string of characters which are used to define how the date will be displayed in the input box.
* The supported characters are defined in the table below.
*/
dateFormat: string = 'Y-m-d';
/**
* Initial value of the hour element.
*/
defaultHour?: number = 12;
/**
* Initial value of the minute element.
*/
defaultMinute?: number = 0;
/**
* Initial value of the seconds element.
*/
defaultSeconds?: number = 0;
/**
* See <a href="https://chmln.github.io/flatpickr/examples/#disabling-specific-dates">disabling dates</a>.
*/
disable: DisableEnableDate[] = [];
/**
* Set disableMobile to true to always use the non-native picker.
* By default, Flatpickr utilizes native datetime widgets unless certain options (e.g. disable) are used.
*/
disableMobile: boolean = false;
/**
* See <a href="https://chmln.github.io/flatpickr/examples/#disabling-all-dates-except-select-few">enabling dates</a>.
*/
enable: DisableEnableDate[];
/**
* Enables time picker.
*/
enableTime: boolean = false;
/**
* Enables seconds in the time picker.
*/
enableSeconds: boolean = false;
/**
* Allows using a custom date formatting function instead of the built-in handling for date formats using dateFormat, altFormat, etc.
*/
formatDate?: (value: any) => string = undefined;
/**
* Adjusts the step for the hour input (incl. scrolling).
*/
hourIncrement: number = 1;
/**
* Displays the calendar inline.
*/
inline: boolean = false;
/**
* The maximum date that a user can pick to (inclusive).
*/
maxDate: string | Date | undefined = undefined;
/**
* The minimum date that a user can start picking from (inclusive).
*/
minDate: string | Date | undefined = undefined;
/**
* The maximum time that a user can pick to (inclusive).
*/
maxTime: string | undefined = undefined;
/**
* The minimum time that a user can start picking from (inclusive).
*/
minTime: string | undefined = undefined;
/**
* Adjusts the step for the minute input (incl. scrolling).
*/
minuteIncrement: number = 5;
/**
* Select a single date, multiple dates or a date range.
*/
mode: 'single' | 'multiple' | 'range' = 'single';
/**
* HTML for the arrow icon, used to switch months.
*/
nextArrow: string = '>';
/**
* Hides the day selection in calendar. Use it along with `enableTime` to create a time picker.
*/
noCalendar: boolean = false;
/**
* Default now to the current date
*/
now: Date | string | number = new Date();
/**
* Function that expects a date string and must return a Date object.
*/
parseDate: (str: string) => Date;
/**
* HTML for the left arrow icon.
*/
prevArrow: string = '<';
/**
* Show the month using the shorthand version (ie, Sep instead of September).
*/
shorthandCurrentMonth: boolean = false;
/**
* Position the calendar inside the wrapper and next to the input element. (Leave `false` unless you know what you're doing).
*/
static: boolean = false;
/**
* Displays time picker in 24 hour mode without AM/PM selection when enabled.
*/
time24hr: boolean = false;
/**
* When true, dates will parsed, formatted, and displayed in UTC.
* It's recommended that date strings contain the timezone, but not necessary.
*/
utc: boolean = false;
/**
* Enables display of week numbers in calendar.
*/
weekNumbers: boolean = false;
/**
* You may override the function that extracts the week numbers from a Date by supplying a getWeek function.
* It takes in a date as a parameter and should return a corresponding string that you want to appear left of every week.
*/
getWeek: (date: Date) => string;
/**
* Custom elements and input groups.
*/
wrap: boolean = false;
/**
* Array of plugin instances to use.
*/
plugins: any[] = [];
/**
* The locale object or string to use for the locale.
*/
locale: object | string = 'default';
/**
* Auto convert the ngModel value from a string to a date / array of dates / from - to date object depending on the `mode`
*/
convertModelValue: boolean = false;
/**
* The number of months shown.
*/
showMonths: number = 1;
/**
* How the month should be displayed in the header of the calendar.
*/
monthSelectorType: 'static' | 'dropdown' = 'static';
/**
* Array of HTML elements that should not close the picker on click.
*/
ignoredFocusElements: HTMLElement[] = [];
}