UNPKG

1.85 kBTypeScriptView Raw
1import { NgbDateStruct } from '../ngb-date-struct';
2import * as i0 from "@angular/core";
3export declare function NGB_DATEPICKER_DATE_ADAPTER_FACTORY(): NgbDateStructAdapter;
4/**
5 * An abstract service that does the conversion between the internal datepicker `NgbDateStruct` model and
6 * any provided user date model `D`, ex. a string, a native date, etc.
7 *
8 * The adapter is used **only** for conversion when binding datepicker to a form control,
9 * ex. `[(ngModel)]="userDateModel"`. Here `userDateModel` can be of any type.
10 *
11 * The default datepicker implementation assumes we use `NgbDateStruct` as a user model.
12 *
13 * See the [date format overview](#/components/datepicker/overview#date-model) for more details
14 * and the [custom adapter demo](#/components/datepicker/examples#adapter) for an example.
15 */
16export declare abstract class NgbDateAdapter<D> {
17 /**
18 * Converts a user-model date of type `D` to an `NgbDateStruct` for internal use.
19 */
20 abstract fromModel(value: D | null): NgbDateStruct | null;
21 /**
22 * Converts an internal `NgbDateStruct` date to a user-model date of type `D`.
23 */
24 abstract toModel(date: NgbDateStruct | null): D | null;
25 static ɵfac: i0.ɵɵFactoryDeclaration<NgbDateAdapter<any>, never>;
26 static ɵprov: i0.ɵɵInjectableDeclaration<NgbDateAdapter<any>>;
27}
28export declare class NgbDateStructAdapter extends NgbDateAdapter<NgbDateStruct> {
29 /**
30 * Converts a NgbDateStruct value into NgbDateStruct value
31 */
32 fromModel(date: NgbDateStruct | null): NgbDateStruct | null;
33 /**
34 * Converts a NgbDateStruct value into NgbDateStruct value
35 */
36 toModel(date: NgbDateStruct | null): NgbDateStruct | null;
37 static ɵfac: i0.ɵɵFactoryDeclaration<NgbDateStructAdapter, never>;
38 static ɵprov: i0.ɵɵInjectableDeclaration<NgbDateStructAdapter>;
39}