MCPcopy
hub / github.com/youzan/vant-weapp / compareDay

Function compareDay

packages/calendar/utils.ts:31–50  ·  view source on GitHub ↗
(day1: Date | number, day2: Date | number)

Source from the content-addressed store, hash-verified

29}
30
31export function compareDay(day1: Date | number, day2: Date | number) {
32 if (!(day1 instanceof Date)) {
33 day1 = new Date(day1);
34 }
35
36 if (!(day2 instanceof Date)) {
37 day2 = new Date(day2);
38 }
39
40 const compareMonthResult = compareMonth(day1, day2);
41
42 if (compareMonthResult === 0) {
43 const date1 = day1.getDate();
44 const date2 = day2.getDate();
45
46 return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
47 }
48
49 return compareMonthResult;
50}
51
52export function getDayByOffset(date: Date, offset: number) {
53 date = new Date(date);

Callers 5

limitDateRangeFunction · 0.90
onClickDayFunction · 0.90
isSelectedFunction · 0.90
getRangeDayTypeFunction · 0.90
getDayTypeFunction · 0.90

Calls 1

compareMonthFunction · 0.70

Tested by

no test coverage detected