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

Function isDayDisabled

core/src/components/datetime/utils/state.ts:31–90  ·  view source on GitHub ↗
(
  refParts: DatetimeParts,
  minParts?: DatetimeParts,
  maxParts?: DatetimeParts,
  dayValues?: number[]
)

Source from the content-addressed store, hash-verified

29 * or the max/min dates.
30 */
31export const isDayDisabled = (
32 refParts: DatetimeParts,
33 minParts?: DatetimeParts,
34 maxParts?: DatetimeParts,
35 dayValues?: number[]
36) => {
37 /**
38 * If this is a filler date (i.e. padding)
39 * then the date is disabled.
40 */
41 if (refParts.day === null) {
42 return true;
43 }
44
45 /**
46 * If user passed in a list of acceptable day values
47 * check to make sure that the date we are looking
48 * at is in this array.
49 */
50 if (dayValues !== undefined && !dayValues.includes(refParts.day)) {
51 return true;
52 }
53
54 /**
55 * Given a min date, perform the following
56 * checks. If any of them are true, then the
57 * day should be disabled:
58 * 1. Is the current year < the min allowed year?
59 * 2. Is the current year === min allowed year,
60 * but the current month < the min allowed month?
61 * 3. Is the current year === min allowed year, the
62 * current month === min allow month, but the current
63 * day < the min allowed day?
64 */
65 if (minParts && isBefore(refParts, minParts)) {
66 return true;
67 }
68
69 /**
70 * Given a max date, perform the following
71 * checks. If any of them are true, then the
72 * day should be disabled:
73 * 1. Is the current year > the max allowed year?
74 * 2. Is the current year === max allowed year,
75 * but the current month > the max allowed month?
76 * 3. Is the current year === max allowed year, the
77 * current month === max allow month, but the current
78 * day > the max allowed day?
79 */
80 if (maxParts && isAfter(refParts, maxParts)) {
81 return true;
82 }
83
84 /**
85 * If none of these checks
86 * passed then the date should
87 * be interactive.
88 */

Callers 3

DatetimeClass · 0.90
state.spec.tsFile · 0.90
getCalendarDayStateFunction · 0.85

Calls 2

isBeforeFunction · 0.90
isAfterFunction · 0.90

Tested by

no test coverage detected