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

Function getTimeColumnsData

core/src/components/datetime/utils/data.ts:611–665  ·  view source on GitHub ↗
(
  locale: string,
  refParts: DatetimeParts,
  hourCycle?: DatetimeHourCycle,
  minParts?: DatetimeParts,
  maxParts?: DatetimeParts,
  allowedHourValues?: number[],
  allowedMinuteValues?: number[]
)

Source from the content-addressed store, hash-verified

609};
610
611export const getTimeColumnsData = (
612 locale: string,
613 refParts: DatetimeParts,
614 hourCycle?: DatetimeHourCycle,
615 minParts?: DatetimeParts,
616 maxParts?: DatetimeParts,
617 allowedHourValues?: number[],
618 allowedMinuteValues?: number[]
619): { [key: string]: WheelColumnOption[] } => {
620 const computedHourCycle = getHourCycle(locale, hourCycle);
621 const use24Hour = is24Hour(computedHourCycle);
622 const { hours, minutes, am, pm } = generateTime(
623 locale,
624 refParts,
625 computedHourCycle,
626 minParts,
627 maxParts,
628 allowedHourValues,
629 allowedMinuteValues
630 );
631
632 const hoursItems = hours.map((hour) => {
633 return {
634 text: getFormattedHour(hour, computedHourCycle),
635 value: getInternalHourValue(hour, use24Hour, refParts.ampm),
636 };
637 });
638 const minutesItems = minutes.map((minute) => {
639 return {
640 text: addTimePadding(minute),
641 value: minute,
642 };
643 });
644
645 const dayPeriodItems = [];
646 if (am && !use24Hour) {
647 dayPeriodItems.push({
648 text: getLocalizedDayPeriod(locale, 'am'),
649 value: 'am',
650 });
651 }
652
653 if (pm && !use24Hour) {
654 dayPeriodItems.push({
655 text: getLocalizedDayPeriod(locale, 'pm'),
656 value: 'pm',
657 });
658 }
659
660 return {
661 minutesData: minutesItems,
662 hoursData: hoursItems,
663 dayPeriodData: dayPeriodItems,
664 };
665};

Callers 2

data.spec.tsFile · 0.90

Calls 8

getHourCycleFunction · 0.90
is24HourFunction · 0.90
getFormattedHourFunction · 0.90
getInternalHourValueFunction · 0.90
addTimePaddingFunction · 0.90
getLocalizedDayPeriodFunction · 0.90
generateTimeFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected