From 0ddd5d51a4ef57d3d05f995b838a3211d16feb50 Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Fri, 19 Jan 2024 20:48:58 -0500 Subject: [PATCH] chore: prettier formatting --- .../src/components/datetime/datetime-interface.ts | 14 +++++++------- core/src/components/datetime/datetime.ios.scss | 8 +++++--- core/src/components/datetime/datetime.md.scss | 12 +++++++----- core/src/components/datetime/utils/format.ts | 2 +- .../src/components/datetime/utils/manipulation.ts | 15 ++++++++++++--- core/src/components/datetime/utils/parse.ts | 8 ++++++-- core/src/components/datetime/utils/state.ts | 10 ++++++---- 7 files changed, 44 insertions(+), 25 deletions(-) diff --git a/core/src/components/datetime/datetime-interface.ts b/core/src/components/datetime/datetime-interface.ts index 621286fb86..d63c2798dc 100644 --- a/core/src/components/datetime/datetime-interface.ts +++ b/core/src/components/datetime/datetime-interface.ts @@ -28,13 +28,13 @@ export type TitleSelectedDatesFormatter = (selectedDates: string[]) => string; export type DatetimeHighlightStyle = | { - textColor: string; - backgroundColor?: string; - } + textColor: string; + backgroundColor?: string; + } | { - textColor?: string; - backgroundColor: string; - }; + textColor?: string; + backgroundColor: string; + }; export type DatetimeHighlight = { date: string } & DatetimeHighlightStyle; @@ -42,7 +42,7 @@ export type DatetimeHighlightCallback = (dateIsoString: string) => DatetimeHighl export type DatetimeHourCycle = 'h11' | 'h12' | 'h23' | 'h24'; -export type DatetimeRangeValue = { start: string, end: string }; +export type DatetimeRangeValue = { start: string; end: string }; export type DatetimeMultipleValue = string[]; diff --git a/core/src/components/datetime/datetime.ios.scss b/core/src/components/datetime/datetime.ios.scss index df4d6a46e6..4f43fbd95b 100644 --- a/core/src/components/datetime/datetime.ios.scss +++ b/core/src/components/datetime/datetime.ios.scss @@ -329,10 +329,12 @@ &.calendar-day-range-start:not(.calendar-day-range-end)::after, &.calendar-day-range-end:not(.calendar-day-range-start)::before { + position: absolute; + width: 50%; height: 100%; + content: " "; - position: absolute; .calendar-day { background: var(--ion-color-base); @@ -342,13 +344,13 @@ } &.calendar-day-range-start::after { - right: 0; + @include position(null, 0, null, null); background: current-color(base, 0.1); } &.calendar-day-range-end::before { - left: 0; + @include position(null, null, null, 0); background: current-color(base, 0.1); } diff --git a/core/src/components/datetime/datetime.md.scss b/core/src/components/datetime/datetime.md.scss index 9b5c85d42a..22f7da864f 100644 --- a/core/src/components/datetime/datetime.md.scss +++ b/core/src/components/datetime/datetime.md.scss @@ -179,19 +179,21 @@ &.calendar-day-range-start:not(.calendar-day-range-end)::after, &.calendar-day-range-end:not(.calendar-day-range-start)::before { - width: 50%; - height: 100%; - content: " "; position: absolute; + width: 50%; + height: 100%; + background: current-color(base, 0.1); + + content: " "; } &.calendar-day-range-start::after { - right: 0; + @include position(null, 0, null, null); } &.calendar-day-range-end::before { - left: 0; + @include position(null, null, null, 0); } } diff --git a/core/src/components/datetime/utils/format.ts b/core/src/components/datetime/utils/format.ts index 66203c2c63..76bdfe833c 100644 --- a/core/src/components/datetime/utils/format.ts +++ b/core/src/components/datetime/utils/format.ts @@ -368,4 +368,4 @@ export const activePartsToArray = (activeParts: DatetimeParts | DatetimeRangePar return [activeParts.start, activeParts.end]; } return [activeParts]; -} +}; diff --git a/core/src/components/datetime/utils/manipulation.ts b/core/src/components/datetime/utils/manipulation.ts index fbb521c9b6..2fd2f66a8f 100644 --- a/core/src/components/datetime/utils/manipulation.ts +++ b/core/src/components/datetime/utils/manipulation.ts @@ -1,4 +1,9 @@ -import type { DatetimeMultipleValue, DatetimeParts, DatetimeRangeParts, DatetimeRangeValue } from '../datetime-interface'; +import type { + DatetimeMultipleValue, + DatetimeParts, + DatetimeRangeParts, + DatetimeRangeValue, +} from '../datetime-interface'; import { isAfter, isBefore, isSameDay } from './comparison'; import { getNumDaysInMonth } from './helpers'; @@ -15,8 +20,12 @@ const fourDigit = (val: number | undefined): string => { export function convertDataToISO(data: DatetimeParts): string; export function convertDataToISO(data: DatetimeRangeParts): DatetimeRangeValue; export function convertDataToISO(data: DatetimeParts[]): DatetimeMultipleValue; -export function convertDataToISO(data: DatetimeParts | DatetimeRangeParts | DatetimeParts[]): string | DatetimeMultipleValue; -export function convertDataToISO(data: DatetimeParts | DatetimeRangeParts | DatetimeParts[]): string | DatetimeMultipleValue | DatetimeRangeValue { +export function convertDataToISO( + data: DatetimeParts | DatetimeRangeParts | DatetimeParts[] +): string | DatetimeMultipleValue; +export function convertDataToISO( + data: DatetimeParts | DatetimeRangeParts | DatetimeParts[] +): string | DatetimeMultipleValue | DatetimeRangeValue { // Multiple selection if (Array.isArray(data)) { return data.map((parts) => convertDataToISO(parts)); diff --git a/core/src/components/datetime/utils/parse.ts b/core/src/components/datetime/utils/parse.ts index 795ea1be41..77d1c682fe 100644 --- a/core/src/components/datetime/utils/parse.ts +++ b/core/src/components/datetime/utils/parse.ts @@ -63,8 +63,12 @@ export function parseDate(val: DatetimeMultipleValue): DatetimeParts[] | undefin export function parseDate(val: DatetimeRangeValue): DatetimeParts[] | undefined; export function parseDate(val: undefined | null): undefined; export function parseDate(val: string | DatetimeMultipleValue): DatetimeParts | DatetimeParts[] | undefined; -export function parseDate(val: string | DatetimeMultipleValue | DatetimeRangeValue | undefined | null): DatetimeParts | DatetimeParts[] | undefined; -export function parseDate(val: string | DatetimeMultipleValue | DatetimeRangeValue | undefined | null): DatetimeParts | DatetimeParts[] | undefined { +export function parseDate( + val: string | DatetimeMultipleValue | DatetimeRangeValue | undefined | null +): DatetimeParts | DatetimeParts[] | undefined; +export function parseDate( + val: string | DatetimeMultipleValue | DatetimeRangeValue | undefined | null +): DatetimeParts | DatetimeParts[] | undefined { if (Array.isArray(val)) { const parsedArray: DatetimeParts[] = []; for (const valStr of val) { diff --git a/core/src/components/datetime/utils/state.ts b/core/src/components/datetime/utils/state.ts index bb93bfafe6..84ac7554d7 100644 --- a/core/src/components/datetime/utils/state.ts +++ b/core/src/components/datetime/utils/state.ts @@ -226,7 +226,7 @@ export const isDateRangeStart = (referenceParts: DatetimeParts, activeParts: Dat return startDate !== undefined && isSameDay(referenceParts, startDate); } return false; -} +}; export const isDateRangeEnd = (referenceParts: DatetimeParts, activeParts: DatetimeRangeParts) => { if (activeParts !== undefined && Array.isArray(activeParts)) { @@ -234,14 +234,16 @@ export const isDateRangeEnd = (referenceParts: DatetimeParts, activeParts: Datet return endDate !== undefined && isSameDay(referenceParts, endDate); } return false; -} +}; export const isDateInRange = (referenceParts: DatetimeParts, activeParts: DatetimeRangeParts) => { if (activeParts !== undefined && Array.isArray(activeParts)) { const startDate = activeParts[0]; const endDate = activeParts[1]; - const isAfterStart = startDate !== undefined && (isAfter(referenceParts, startDate) || isSameDay(referenceParts, startDate)); - const isBeforeEnd = endDate !== undefined && (isBefore(referenceParts, endDate) || isSameDay(referenceParts, endDate)); + const isAfterStart = + startDate !== undefined && (isAfter(referenceParts, startDate) || isSameDay(referenceParts, startDate)); + const isBeforeEnd = + endDate !== undefined && (isBefore(referenceParts, endDate) || isSameDay(referenceParts, endDate)); return isAfterStart && isBeforeEnd; } return false;