chore(): sync with main

This commit is contained in:
Liam DeBeasi
2022-06-27 09:54:57 -04:00
391 changed files with 15762 additions and 40817 deletions

View File

@@ -1,3 +1,5 @@
import { printIonWarning } from '@utils/logging';
import type { DatetimeParts } from '../datetime-interface';
/**
@@ -36,3 +38,14 @@ export const isAfter = (baseParts: DatetimeParts, compareParts: DatetimeParts) =
baseParts.day > compareParts.day!)
);
};
export const warnIfValueOutOfBounds = (value: DatetimeParts, min: DatetimeParts, max: DatetimeParts) => {
if ((min && isBefore(value, min)) || (max && isAfter(value, max))) {
printIonWarning(
'The value provided to ion-datetime is out of bounds.\n\n' +
`Min: ${JSON.stringify(min)}\n` +
`Max: ${JSON.stringify(max)}\n` +
`Value: ${JSON.stringify(value)}`
);
}
};