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

Function clampDate

core/src/components/datetime/utils/parse.ts:130–141  ·  view source on GitHub ↗
(
  dateParts: DatetimeParts,
  minParts?: DatetimeParts,
  maxParts?: DatetimeParts
)

Source from the content-addressed store, hash-verified

128}
129
130export const clampDate = (
131 dateParts: DatetimeParts,
132 minParts?: DatetimeParts,
133 maxParts?: DatetimeParts
134): DatetimeParts => {
135 if (minParts && isBefore(dateParts, minParts)) {
136 return minParts;
137 } else if (maxParts && isAfter(dateParts, maxParts)) {
138 return maxParts;
139 }
140 return dateParts;
141};
142
143/**
144 * Parses an hour and returns if the value is in the morning (am) or afternoon (pm).

Callers 3

DatetimeClass · 0.90
validatePartsFunction · 0.90
parse.spec.tsFile · 0.90

Calls 2

isBeforeFunction · 0.90
isAfterFunction · 0.90

Tested by

no test coverage detected