MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / Datetime

Class Datetime

core/src/components/datetime/datetime.tsx:118–2805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116 shadow: true,
117})
118export class Datetime implements ComponentInterface {
119 private inputId = `ion-dt-${datetimeIds++}`;
120 private calendarBodyRef?: HTMLElement;
121 private popoverRef?: HTMLIonPopoverElement;
122 private intersectionTrackerRef?: HTMLElement;
123 private clearFocusVisible?: () => void;
124 private parsedMinuteValues?: number[];
125 private parsedHourValues?: number[];
126 private parsedMonthValues?: number[];
127 private parsedYearValues?: number[];
128 private parsedDayValues?: number[];
129
130 private destroyCalendarListener?: () => void;
131 private destroyKeyboardMO?: () => void;
132
133 // TODO(FW-2832): types (DatetimeParts causes some errors that need untangling)
134 private minParts?: any;
135 private maxParts?: any;
136 private todayParts!: DatetimeParts;
137 private defaultParts!: DatetimeParts;
138 private loadTimeout: ReturnType<typeof setTimeout> | undefined;
139 /**
140 * Set true only by `visibleCallback`. Lets `hiddenCallback` ignore the
141 * synthetic "not intersecting" entry IntersectionObserver fires on
142 * `observe()` when the host mounts offscreen.
143 */
144 private hasBeenIntersecting = false;
145
146 private prevPresentation: string | null = null;
147
148 private resolveForceDateScrolling?: () => void;
149
150 @State() showMonthAndYear = false;
151
152 @State() activeParts: DatetimeParts | DatetimeParts[] = [];
153
154 @State() workingParts: DatetimeParts = {
155 month: 5,
156 day: 28,
157 year: 2021,
158 hour: 13,
159 minute: 52,
160 ampm: 'pm',
161 isAdjacentDay: false,
162 };
163
164 @Element() el!: HTMLIonDatetimeElement;
165
166 @State() isTimePopoverOpen = false;
167
168 /**
169 * When defined, will force the datetime to render the month
170 * containing the specified date. Currently, this should only
171 * be used to enable immediately auto-scrolling to the new month,
172 * and should then be reset to undefined once the transition is
173 * finished and the forced month is now in view.
174 *
175 * Applies to grid-style datetimes only.

Callers

nothing calls this directly

Calls 15

confirmMethod · 0.95
initializeListenersMethod · 0.95
printIonWarningFunction · 0.90
validatePartsFunction · 0.90
isSameDayFunction · 0.90
getPartsFromCalendarDayFunction · 0.90
getNextWeekFunction · 0.90
getPreviousWeekFunction · 0.90
getNextDayFunction · 0.90
getPreviousDayFunction · 0.90
getStartOfWeekFunction · 0.90
getEndOfWeekFunction · 0.90

Tested by

no test coverage detected