MCPcopy Create free account
hub / github.com/UI5/webcomponents / _getTimestampFromDateValue

Method _getTimestampFromDateValue

packages/main/src/DayPicker.ts:905–920  ·  view source on GitHub ↗

* Converts a date value string to a timestamp. * @param dateValue - Date string to convert * @returns timestamp in seconds, or 0 if invalid * @private

(dateValue?: string)

Source from the content-addressed store, hash-verified

903 * @private
904 */
905 _getTimestampFromDateValue(dateValue?: string): number {
906 if (!dateValue) {
907 return 0;
908 }
909
910 try {
911 const jsDate = this.getValueFormat().parse(dateValue) as Date;
912 const calendarDate = CalendarDate.fromLocalJSDate(
913 jsDate,
914 this._primaryCalendarType,
915 );
916 return calendarDate.valueOf() / 1000;
917 } catch {
918 return 0;
919 }
920 }
921
922 _isDayPressed(target: HTMLElement): boolean {
923 const targetParent = target.parentNode as HTMLElement;

Callers 2

_isDateEnabledMethod · 0.95

Calls 4

fromLocalJSDateMethod · 0.80
valueOfMethod · 0.80
parseMethod · 0.45
getValueFormatMethod · 0.45

Tested by

no test coverage detected