@checkdigit/time 4.0.0-PR.18-81a3 → 4.0.0-PR.18-e0fa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/package.json +1 -1
- package/src/date-fns/_lib/addLeadingZeros/test.mts +0 -12
- package/src/date-fns/_lib/getRoundingMethod/test.mts +0 -50
- package/src/date-fns/_lib/getTimezoneOffsetInMilliseconds/test.mts +0 -25
- package/src/date-fns/add/test.mts +0 -95
- package/src/date-fns/addBusinessDays/test.mts +0 -78
- package/src/date-fns/addDays/test.mts +0 -90
- package/src/date-fns/addHours/test.mts +0 -30
- package/src/date-fns/addISOWeekYears/test.mts +0 -41
- package/src/date-fns/addMilliseconds/test.mts +0 -30
- package/src/date-fns/addMinutes/test.mts +0 -30
- package/src/date-fns/addMonths/test.mts +0 -123
- package/src/date-fns/addQuarters/test.mts +0 -47
- package/src/date-fns/addSeconds/test.mts +0 -30
- package/src/date-fns/addWeeks/test.mts +0 -30
- package/src/date-fns/addYears/test.mts +0 -46
- package/src/date-fns/areIntervalsOverlapping/test.mts +0 -231
- package/src/date-fns/clamp/test.mts +0 -36
- package/src/date-fns/closestIndexTo/test.mts +0 -51
- package/src/date-fns/closestTo/test.mts +0 -49
- package/src/date-fns/compareAsc/test.mts +0 -58
- package/src/date-fns/compareDesc/test.mts +0 -58
- package/src/date-fns/constructFrom/test.mts +0 -47
- package/src/date-fns/constructNow/test.mts +0 -37
- package/src/date-fns/daysToWeeks/test.mts +0 -36
- package/src/date-fns/differenceInBusinessDays/test.mts +0 -102
- package/src/date-fns/differenceInCalendarDays/test.mts +0 -206
- package/src/date-fns/differenceInCalendarISOWeekYears/test.mts +0 -93
- package/src/date-fns/differenceInCalendarISOWeeks/test.mts +0 -89
- package/src/date-fns/differenceInCalendarMonths/test.mts +0 -82
- package/src/date-fns/differenceInCalendarQuarters/test.mts +0 -82
- package/src/date-fns/differenceInCalendarWeeks/test.mts +0 -136
- package/src/date-fns/differenceInCalendarYears/test.mts +0 -82
- package/src/date-fns/differenceInDays/test.mts +0 -175
- package/src/date-fns/differenceInHours/test.mts +0 -122
- package/src/date-fns/differenceInISOWeekYears/test.mts +0 -93
- package/src/date-fns/differenceInMilliseconds/test.mts +0 -53
- package/src/date-fns/differenceInMinutes/test.mts +0 -123
- package/src/date-fns/differenceInMonths/test.mts +0 -121
- package/src/date-fns/differenceInQuarters/test.mts +0 -109
- package/src/date-fns/differenceInSeconds/test.mts +0 -144
- package/src/date-fns/differenceInWeeks/test.mts +0 -111
- package/src/date-fns/differenceInYears/test.mts +0 -97
- package/src/date-fns/eachDayOfInterval/test.mts +0 -164
- package/src/date-fns/eachHourOfInterval/test.mts +0 -154
- package/src/date-fns/eachMinuteOfInterval/test.mts +0 -159
- package/src/date-fns/eachMonthOfInterval/test.mts +0 -151
- package/src/date-fns/eachQuarterOfInterval/test.mts +0 -136
- package/src/date-fns/eachWeekOfInterval/test.mts +0 -177
- package/src/date-fns/eachWeekendOfInterval/test.mts +0 -67
- package/src/date-fns/eachWeekendOfMonth/test.mts +0 -23
- package/src/date-fns/eachWeekendOfYear/test.mts +0 -18
- package/src/date-fns/eachYearOfInterval/test.mts +0 -136
- package/src/date-fns/endOfDay/test.mts +0 -27
- package/src/date-fns/endOfDecade/test.mts +0 -32
- package/src/date-fns/endOfHour/test.mts +0 -26
- package/src/date-fns/endOfISOWeek/test.mts +0 -27
- package/src/date-fns/endOfISOWeekYear/test.mts +0 -36
- package/src/date-fns/endOfMinute/test.mts +0 -26
- package/src/date-fns/endOfMonth/test.mts +0 -41
- package/src/date-fns/endOfQuarter/test.mts +0 -27
- package/src/date-fns/endOfSecond/test.mts +0 -26
- package/src/date-fns/endOfToday/test.mts +0 -19
- package/src/date-fns/endOfTomorrow/test.mts +0 -29
- package/src/date-fns/endOfWeek/test.mts +0 -86
- package/src/date-fns/endOfYear/test.mts +0 -27
- package/src/date-fns/endOfYesterday/test.mts +0 -29
- package/src/date-fns/format/test.mts +0 -909
- package/src/date-fns/formatDistance/test.mts +0 -189
- package/src/date-fns/formatDistanceStrict/test.mts +0 -329
- package/src/date-fns/formatDistanceToNow/test.mts +0 -196
- package/src/date-fns/formatDistanceToNowStrict/test.mts +0 -293
- package/src/date-fns/formatDuration/test.mts +0 -74
- package/src/date-fns/formatISO/test.mts +0 -55
- package/src/date-fns/formatISO9075/test.mts +0 -35
- package/src/date-fns/formatISODuration/test.mts +0 -75
- package/src/date-fns/formatRFC3339/test.mts +0 -41
- package/src/date-fns/formatRFC7231/test.mts +0 -18
- package/src/date-fns/formatRelative/test.mts +0 -92
- package/src/date-fns/fp/_lib/convertToFP/test.mts +0 -114
- package/src/date-fns/fromUnixTime/test.mts +0 -14
- package/src/date-fns/getDate/test.mts +0 -19
- package/src/date-fns/getDay/test.mts +0 -19
- package/src/date-fns/getDayOfYear/test.mts +0 -27
- package/src/date-fns/getDaysInMonth/test.mts +0 -33
- package/src/date-fns/getDaysInYear/test.mts +0 -35
- package/src/date-fns/getDecade/test.mts +0 -24
- package/src/date-fns/getDefaultOptions/test.mts +0 -58
- package/src/date-fns/getHours/test.mts +0 -19
- package/src/date-fns/getISODay/test.mts +0 -24
- package/src/date-fns/getISOWeek/test.mts +0 -54
- package/src/date-fns/getISOWeekYear/test.mts +0 -27
- package/src/date-fns/getISOWeeksInYear/test.mts +0 -37
- package/src/date-fns/getMilliseconds/test.mts +0 -19
- package/src/date-fns/getMinutes/test.mts +0 -19
- package/src/date-fns/getMonth/test.mts +0 -19
- package/src/date-fns/getOverlappingDaysInIntervals/test.mts +0 -243
- package/src/date-fns/getQuarter/test.mts +0 -19
- package/src/date-fns/getSeconds/test.mts +0 -19
- package/src/date-fns/getTime/test.mts +0 -21
- package/src/date-fns/getUnixTime/test.mts +0 -26
- package/src/date-fns/getWeek/test.mts +0 -56
- package/src/date-fns/getWeekOfMonth/test.mts +0 -75
- package/src/date-fns/getWeekYear/test.mts +0 -49
- package/src/date-fns/getWeeksInMonth/test.mts +0 -51
- package/src/date-fns/getYear/test.mts +0 -19
- package/src/date-fns/hoursToMilliseconds/test.mts +0 -23
- package/src/date-fns/hoursToMinutes/test.mts +0 -25
- package/src/date-fns/hoursToSeconds/test.mts +0 -25
- package/src/date-fns/interval/test.mts +0 -42
- package/src/date-fns/intervalToDuration/test.mts +0 -235
- package/src/date-fns/intlFormat/test.mts +0 -88
- package/src/date-fns/intlFormatDistance/test.mts +0 -588
- package/src/date-fns/isAfter/test.mts +0 -39
- package/src/date-fns/isBefore/test.mts +0 -39
- package/src/date-fns/isDate/test.mts +0 -72
- package/src/date-fns/isEqual/test.mts +0 -34
- package/src/date-fns/isExists/test.mts +0 -14
- package/src/date-fns/isFirstDayOfMonth/test.mts +0 -25
- package/src/date-fns/isFriday/test.mts +0 -24
- package/src/date-fns/isFuture/test.mts +0 -34
- package/src/date-fns/isLastDayOfMonth/test.mts +0 -25
- package/src/date-fns/isLeapYear/test.mts +0 -35
- package/src/date-fns/isMatch/test.mts +0 -27
- package/src/date-fns/isMonday/test.mts +0 -24
- package/src/date-fns/isPast/test.mts +0 -34
- package/src/date-fns/isSameDay/test.mts +0 -37
- package/src/date-fns/isSameHour/test.mts +0 -37
- package/src/date-fns/isSameISOWeek/test.mts +0 -34
- package/src/date-fns/isSameISOWeekYear/test.mts +0 -48
- package/src/date-fns/isSameMinute/test.mts +0 -37
- package/src/date-fns/isSameMonth/test.mts +0 -34
- package/src/date-fns/isSameQuarter/test.mts +0 -34
- package/src/date-fns/isSameSecond/test.mts +0 -43
- package/src/date-fns/isSameWeek/test.mts +0 -58
- package/src/date-fns/isSameYear/test.mts +0 -34
- package/src/date-fns/isSaturday/test.mts +0 -24
- package/src/date-fns/isSunday/test.mts +0 -24
- package/src/date-fns/isThisHour/test.mts +0 -34
- package/src/date-fns/isThisISOWeek/test.mts +0 -34
- package/src/date-fns/isThisMinute/test.mts +0 -34
- package/src/date-fns/isThisMonth/test.mts +0 -34
- package/src/date-fns/isThisQuarter/test.mts +0 -34
- package/src/date-fns/isThisSecond/test.mts +0 -34
- package/src/date-fns/isThisWeek/test.mts +0 -39
- package/src/date-fns/isThisYear/test.mts +0 -34
- package/src/date-fns/isThursday/test.mts +0 -24
- package/src/date-fns/isToday/test.mts +0 -34
- package/src/date-fns/isTomorrow/test.mts +0 -34
- package/src/date-fns/isTuesday/test.mts +0 -24
- package/src/date-fns/isValid/test.mts +0 -24
- package/src/date-fns/isWednesday/test.mts +0 -24
- package/src/date-fns/isWeekend/test.mts +0 -24
- package/src/date-fns/isWithinInterval/test.mts +0 -92
- package/src/date-fns/isYesterday/test.mts +0 -34
- package/src/date-fns/lastDayOfDecade/test.mts +0 -32
- package/src/date-fns/lastDayOfISOWeek/test.mts +0 -27
- package/src/date-fns/lastDayOfISOWeekYear/test.mts +0 -36
- package/src/date-fns/lastDayOfMonth/test.mts +0 -41
- package/src/date-fns/lastDayOfQuarter/test.mts +0 -27
- package/src/date-fns/lastDayOfWeek/test.mts +0 -86
- package/src/date-fns/lastDayOfYear/test.mts +0 -27
- package/src/date-fns/lightFormat/test.mts +0 -126
- package/src/date-fns/max/test.mts +0 -34
- package/src/date-fns/milliseconds/test.mts +0 -62
- package/src/date-fns/millisecondsToHours/test.mts +0 -24
- package/src/date-fns/millisecondsToMinutes/test.mts +0 -24
- package/src/date-fns/millisecondsToSeconds/test.mts +0 -24
- package/src/date-fns/min/test.mts +0 -34
- package/src/date-fns/minutesToHours/test.mts +0 -24
- package/src/date-fns/minutesToMilliseconds/test.mts +0 -23
- package/src/date-fns/minutesToSeconds/test.mts +0 -23
- package/src/date-fns/monthsToQuarters/test.mts +0 -24
- package/src/date-fns/monthsToYears/test.mts +0 -24
- package/src/date-fns/nextDay/test.mts +0 -44
- package/src/date-fns/nextFriday/test.mts +0 -24
- package/src/date-fns/nextMonday/test.mts +0 -24
- package/src/date-fns/nextSaturday/test.mts +0 -24
- package/src/date-fns/nextSunday/test.mts +0 -24
- package/src/date-fns/nextThursday/test.mts +0 -24
- package/src/date-fns/nextTuesday/test.mts +0 -23
- package/src/date-fns/nextWednesday/test.mts +0 -24
- package/src/date-fns/parse/test.mts +0 -2202
- package/src/date-fns/parseISO/test.mts +0 -362
- package/src/date-fns/parseJSON/test.mts +0 -129
- package/src/date-fns/previousDay/test.mts +0 -42
- package/src/date-fns/previousFriday/test.mts +0 -22
- package/src/date-fns/previousMonday/test.mts +0 -22
- package/src/date-fns/previousSaturday/test.mts +0 -22
- package/src/date-fns/previousSunday/test.mts +0 -22
- package/src/date-fns/previousThursday/test.mts +0 -22
- package/src/date-fns/previousTuesday/test.mts +0 -22
- package/src/date-fns/previousWednesday/test.mts +0 -22
- package/src/date-fns/quartersToMonths/test.mts +0 -24
- package/src/date-fns/quartersToYears/test.mts +0 -24
- package/src/date-fns/roundToNearestHours/test.mts +0 -200
- package/src/date-fns/roundToNearestMinutes/test.mts +0 -208
- package/src/date-fns/secondsToHours/test.mts +0 -24
- package/src/date-fns/secondsToMilliseconds/test.mts +0 -14
- package/src/date-fns/secondsToMinutes/test.mts +0 -24
- package/src/date-fns/set/test.mts +0 -121
- package/src/date-fns/setDate/test.mts +0 -30
- package/src/date-fns/setDay/test.mts +0 -112
- package/src/date-fns/setDayOfYear/test.mts +0 -30
- package/src/date-fns/setDefaultOptions/test.mts +0 -498
- package/src/date-fns/setHours/test.mts +0 -30
- package/src/date-fns/setISODay/test.mts +0 -59
- package/src/date-fns/setISOWeek/test.mts +0 -41
- package/src/date-fns/setISOWeekYear/test.mts +0 -50
- package/src/date-fns/setMilliseconds/test.mts +0 -30
- package/src/date-fns/setMinutes/test.mts +0 -30
- package/src/date-fns/setMonth/test.mts +0 -46
- package/src/date-fns/setQuarter/test.mts +0 -46
- package/src/date-fns/setSeconds/test.mts +0 -30
- package/src/date-fns/setWeek/test.mts +0 -63
- package/src/date-fns/setWeekYear/test.mts +0 -72
- package/src/date-fns/setYear/test.mts +0 -30
- package/src/date-fns/startOfDay/test.mts +0 -27
- package/src/date-fns/startOfDecade/test.mts +0 -32
- package/src/date-fns/startOfHour/test.mts +0 -27
- package/src/date-fns/startOfISOWeek/test.mts +0 -27
- package/src/date-fns/startOfISOWeekYear/test.mts +0 -41
- package/src/date-fns/startOfMinute/test.mts +0 -27
- package/src/date-fns/startOfMonth/test.mts +0 -27
- package/src/date-fns/startOfQuarter/test.mts +0 -27
- package/src/date-fns/startOfSecond/test.mts +0 -27
- package/src/date-fns/startOfToday/test.mts +0 -19
- package/src/date-fns/startOfTomorrow/test.mts +0 -29
- package/src/date-fns/startOfWeek/test.mts +0 -86
- package/src/date-fns/startOfWeekYear/test.mts +0 -58
- package/src/date-fns/startOfYear/test.mts +0 -38
- package/src/date-fns/startOfYesterday/test.mts +0 -29
- package/src/date-fns/sub/test.mts +0 -83
- package/src/date-fns/subBusinessDays/test.mts +0 -40
- package/src/date-fns/subDays/test.mts +0 -30
- package/src/date-fns/subHours/test.mts +0 -30
- package/src/date-fns/subISOWeekYears/test.mts +0 -41
- package/src/date-fns/subMilliseconds/test.mts +0 -30
- package/src/date-fns/subMinutes/test.mts +0 -30
- package/src/date-fns/subMonths/test.mts +0 -47
- package/src/date-fns/subQuarters/test.mts +0 -47
- package/src/date-fns/subSeconds/test.mts +0 -30
- package/src/date-fns/subWeeks/test.mts +0 -30
- package/src/date-fns/subYears/test.mts +0 -46
- package/src/date-fns/toDate/test.mts +0 -35
- package/src/date-fns/weeksToDays/test.mts +0 -24
- package/src/date-fns/yearsToDays/test.mts +0 -24
- package/src/date-fns/yearsToMonths/test.mts +0 -24
- package/src/date-fns/yearsToQuarters/test.mts +0 -24
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isSameWeek } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isSameWeek', () => {
|
|
5
|
-
it('returns true if the given dates have the same week', () => {
|
|
6
|
-
const result = isSameWeek(new Date(2014, 7 /* Aug */, 31), new Date(2014, 8 /* Sep */, 4));
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given dates have different weeks', () => {
|
|
11
|
-
const result = isSameWeek(new Date(2014, 7 /* Aug */, 30), new Date(2014, 8 /* Sep */, 4));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('allows to specify which day is the first day of the week', () => {
|
|
16
|
-
const result = isSameWeek(new Date(2014, 7 /* Aug */, 31), new Date(2014, 8 /* Sep */, 4), { weekStartsOn: 1 });
|
|
17
|
-
expect(result).toBe(false);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('allows to specify which day is the first day of the week in locale', () => {
|
|
21
|
-
const result = isSameWeek(new Date(2014, 7 /* Aug */, 31), new Date(2014, 8 /* Sep */, 4), {
|
|
22
|
-
locale: {
|
|
23
|
-
options: { weekStartsOn: 1 },
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
expect(result).toBe(false);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('`options.weekStartsOn` overwrites the first day of the week specified in locale', () => {
|
|
30
|
-
const result = isSameWeek(new Date(2014, 7 /* Aug */, 31), new Date(2014, 8 /* Sep */, 4), {
|
|
31
|
-
weekStartsOn: 1,
|
|
32
|
-
locale: {
|
|
33
|
-
options: { weekStartsOn: 0 },
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
expect(result).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('accepts a timestamp', () => {
|
|
40
|
-
const result = isSameWeek(new Date(2014, 7 /* Aug */, 31).getTime(), new Date(2014, 8 /* Sep */, 4).getTime());
|
|
41
|
-
expect(result).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('returns false if the first date is `Invalid Date`', () => {
|
|
45
|
-
const result = isSameWeek(new Date(NaN), new Date(1989, 6 /* Jul */, 10));
|
|
46
|
-
expect(result).toBe(false);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('returns false if the second date is `Invalid Date`', () => {
|
|
50
|
-
const result = isSameWeek(new Date(1987, 1 /* Feb */, 11), new Date(NaN));
|
|
51
|
-
expect(result).toBe(false);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('returns false if the both dates are `Invalid Date`', () => {
|
|
55
|
-
const result = isSameWeek(new Date(NaN), new Date(NaN));
|
|
56
|
-
expect(result).toBe(false);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isSameYear } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isSameYear', () => {
|
|
5
|
-
it('returns true if the given dates have the same year', () => {
|
|
6
|
-
const result = isSameYear(new Date(2014, 8 /* Sep */, 2), new Date(2014, 8 /* Sep */, 25));
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given dates have different years', () => {
|
|
11
|
-
const result = isSameYear(new Date(2014, 8 /* Sep */, 2), new Date(2013, 8 /* Sep */, 25));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('accepts a timestamp', () => {
|
|
16
|
-
const result = isSameYear(new Date(2014, 8 /* Sep */, 2).getTime(), new Date(2014, 8 /* Sep */, 25).getTime());
|
|
17
|
-
expect(result).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('returns false if the first date is `Invalid Date`', () => {
|
|
21
|
-
const result = isSameYear(new Date(NaN), new Date(1989, 6 /* Jul */, 10));
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('returns false if the second date is `Invalid Date`', () => {
|
|
26
|
-
const result = isSameYear(new Date(1987, 1 /* Feb */, 11), new Date(NaN));
|
|
27
|
-
expect(result).toBe(false);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('returns false if the both dates are `Invalid Date`', () => {
|
|
31
|
-
const result = isSameYear(new Date(NaN), new Date(NaN));
|
|
32
|
-
expect(result).toBe(false);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isSaturday } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isSaturday', () => {
|
|
5
|
-
it('returns true if the given date is Saturday', () => {
|
|
6
|
-
const result = isSaturday(new Date(2014, 8 /* Sep */, 27));
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given date is not Saturday', () => {
|
|
11
|
-
const result = isSaturday(new Date(2014, 8 /* Sep */, 25));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('accepts a timestamp', () => {
|
|
16
|
-
const result = isSaturday(new Date(2014, 1 /* Feb */, 15).getTime());
|
|
17
|
-
expect(result).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('returns false if the given date is `Invalid Date`', () => {
|
|
21
|
-
const result = isSaturday(new Date(NaN));
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isSunday } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isSunday', () => {
|
|
5
|
-
it('returns true if the given date is Sunday', () => {
|
|
6
|
-
const result = isSunday(new Date(2014, 8 /* Sep */, 21));
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given date is not Sunday', () => {
|
|
11
|
-
const result = isSunday(new Date(2014, 8 /* Sep */, 25));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('accepts a timestamp', () => {
|
|
16
|
-
const result = isSunday(new Date(2014, 1 /* Feb */, 9).getTime());
|
|
17
|
-
expect(result).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('returns false if the given date is `Invalid Date`', () => {
|
|
21
|
-
const result = isSunday(new Date(NaN));
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isThisHour } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isThisHour', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 8 /* Sep */, 25, 18, 15, 15, 500).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date and the current date have the same hour', () => {
|
|
17
|
-
const date = new Date(2014, 8 /* Sep */, 25, 18);
|
|
18
|
-
expect(isThisHour(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date and the current date have different hours', () => {
|
|
22
|
-
const date = new Date(2014, 8 /* Sep */, 25, 19);
|
|
23
|
-
expect(isThisHour(date)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const date = new Date(2014, 8 /* Sep */, 25, 18, 45).getTime();
|
|
28
|
-
expect(isThisHour(date)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isThisHour(new UTCDate(+new Date(2014, 8 /* Sep */, 25, 18)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isThisISOWeek } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isSameISOWeek', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 8 /* Sep */, 25).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date and the current date have the same ISO week', () => {
|
|
17
|
-
const date = new Date(2014, 8 /* Sep */, 22);
|
|
18
|
-
expect(isThisISOWeek(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date and the current date have different ISO weeks', () => {
|
|
22
|
-
const date = new Date(2014, 8 /* Sep */, 21);
|
|
23
|
-
expect(isThisISOWeek(date)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const date = new Date(2014, 8 /* Sep */, 29).getTime();
|
|
28
|
-
expect(isThisISOWeek(date)).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isThisISOWeek(new UTCDate(+new Date(2014, 8 /* Sep */, 25)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isThisMinute } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isThisMinute', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 8 /* Sep */, 25, 18, 30, 15, 500).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date and the current date have the same minute', () => {
|
|
17
|
-
const date = new Date(2014, 8 /* Sep */, 25, 18, 30);
|
|
18
|
-
expect(isThisMinute(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date and the current date have different minutes', () => {
|
|
22
|
-
const date = new Date(2014, 8 /* Sep */, 25, 18, 31);
|
|
23
|
-
expect(isThisMinute(date)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const date = new Date(2014, 8 /* Sep */, 25, 18, 30, 30).getTime();
|
|
28
|
-
expect(isThisMinute(date)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isThisMinute(new UTCDate(+new Date(2014, 8 /* Sep */, 25, 18, 30, 15, 500)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isThisMonth } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isThisMonth', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 8 /* Sep */, 1).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date and the current date have the same month (and year)', () => {
|
|
17
|
-
const date = new Date(2014, 8 /* Sep */, 15);
|
|
18
|
-
expect(isThisMonth(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date and the current date have different months', () => {
|
|
22
|
-
const date = new Date(2013, 7 /* Aug */, 31);
|
|
23
|
-
expect(isThisMonth(date)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const date = new Date(2014, 8 /* Sep */, 30).getTime();
|
|
28
|
-
expect(isThisMonth(date)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isThisMonth(new UTCDate(+new Date(2014, 8 /* Sep */, 1)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isThisQuarter } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isThisQuarter', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 6 /* Jul */, 1).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date and the current date have the same quarter (and year)', () => {
|
|
17
|
-
const date = new Date(2014, 6 /* Jul */, 2);
|
|
18
|
-
expect(isThisQuarter(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date and the current date have different quarters', () => {
|
|
22
|
-
const date = new Date(2014, 1 /* Feb */, 11);
|
|
23
|
-
expect(isThisQuarter(date)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const date = new Date(2014, 6 /* Jul */, 2).getTime();
|
|
28
|
-
expect(isThisQuarter(date)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isThisQuarter(new UTCDate(+new Date(2014, 6 /* Jul */, 1)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isThisSecond } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isThisSecond', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 8 /* Sep */, 25, 18, 30, 15, 500).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date and the current date have the same second', () => {
|
|
17
|
-
const date = new Date(2014, 8 /* Sep */, 25, 18, 30, 15);
|
|
18
|
-
expect(isThisSecond(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date and the current date have different seconds', () => {
|
|
22
|
-
const date = new Date(2014, 8 /* Sep */, 25, 18, 30, 16);
|
|
23
|
-
expect(isThisSecond(date)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const date = new Date(2014, 8 /* Sep */, 25, 18, 30, 15, 250).getTime();
|
|
28
|
-
expect(isThisSecond(date)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isThisSecond(new UTCDate(+new Date(2014, 8 /* Sep */, 25, 18, 30, 15, 500)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isThisWeek } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isThisWeek', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 8 /* Sep */, 21).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date and the current date have the same week', () => {
|
|
17
|
-
const date = new Date(2014, 8 /* Sep */, 21);
|
|
18
|
-
expect(isThisWeek(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date and the current date have different weeks', () => {
|
|
22
|
-
const date = new Date(2014, 8 /* Sep */, 29);
|
|
23
|
-
expect(isThisWeek(date)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('allows to specify which day is the first day of the week', () => {
|
|
27
|
-
const date = new Date(2014, 8 /* Sep */, 22);
|
|
28
|
-
expect(isThisWeek(date, { weekStartsOn: 1 })).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('accepts a timestamp', () => {
|
|
32
|
-
const date = new Date(2014, 8 /* Sep */, 21).getTime();
|
|
33
|
-
expect(isThisWeek(date)).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('respects date extensions', () => {
|
|
37
|
-
expect(isThisWeek(new UTCDate(+new Date(2014, 8 /* Sep */, 21)))).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isThisYear } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isThisYear', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 0 /* Jan */, 1).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date and the current date have the same year', () => {
|
|
17
|
-
const date = new Date(2014, 6 /* Jul */, 2);
|
|
18
|
-
expect(isThisYear(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date and the current date have different years', () => {
|
|
22
|
-
const date = new Date(2015, 6 /* Jul */, 2);
|
|
23
|
-
expect(isThisYear(date)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const date = new Date(2014, 6 /* Jul */, 2).getTime();
|
|
28
|
-
expect(isThisYear(date)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isThisYear(new UTCDate(+new Date(2014, 0 /* Jan */, 1)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isThursday } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isThursday', () => {
|
|
5
|
-
it('returns true if the given date is Thursday', () => {
|
|
6
|
-
const result = isThursday(new Date(2014, 8 /* Sep */, 25));
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given date is not Thursday', () => {
|
|
11
|
-
const result = isThursday(new Date(2014, 8 /* Sep */, 24));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('accepts a timestamp', () => {
|
|
16
|
-
const result = isThursday(new Date(2014, 1 /* Feb */, 13).getTime());
|
|
17
|
-
expect(result).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('returns false if the given date is `Invalid Date`', () => {
|
|
21
|
-
const result = isThursday(new Date(NaN));
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isToday } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isToday', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 8 /* Sep */, 25).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date is today', () => {
|
|
17
|
-
const result = isToday(new Date(2014, 8 /* Sep */, 25));
|
|
18
|
-
expect(result).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date is not today', () => {
|
|
22
|
-
const result = isToday(new Date(2014, 8 /* Sep */, 26));
|
|
23
|
-
expect(result).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const result = isToday(new Date(2014, 8 /* Sep */, 25).getTime());
|
|
28
|
-
expect(result).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isToday(new UTCDate(+new Date(2014, 8 /* Sep */, 25)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { UTCDate } from '@date-fns/utc';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { isTomorrow } from './index';
|
|
5
|
-
|
|
6
|
-
describe('isTomorrow', () => {
|
|
7
|
-
let clock: sinon.SinonFakeTimers;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
clock = sinon.useFakeTimers(new Date(2014, 8 /* Aug */, 25).getTime());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clock.restore();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns true if the given date is tomorrow', () => {
|
|
17
|
-
const result = isTomorrow(new Date(2014, 8 /* Sep */, 26));
|
|
18
|
-
expect(result).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns false if the given date is not tomorrow', () => {
|
|
22
|
-
const result = isTomorrow(new Date(2014, 8 /* Sep */, 25));
|
|
23
|
-
expect(result).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('accepts a timestamp', () => {
|
|
27
|
-
const result = isTomorrow(new Date(2014, 8 /* Sep */, 26).getTime());
|
|
28
|
-
expect(result).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('respects date extensions', () => {
|
|
32
|
-
expect(isTomorrow(new UTCDate(+new Date(2014, 8 /* Aug */, 26)))).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isTuesday } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isTuesday', () => {
|
|
5
|
-
it('returns true if the given date is Tuesday', () => {
|
|
6
|
-
const result = isTuesday(new Date(2014, 8 /* Sep */, 23));
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given date is not Tuesday', () => {
|
|
11
|
-
const result = isTuesday(new Date(2014, 8 /* Sep */, 25));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('accepts a timestamp', () => {
|
|
16
|
-
const result = isTuesday(new Date(2014, 1 /* Feb */, 11).getTime());
|
|
17
|
-
expect(result).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('returns false if the given date is `Invalid Date`', () => {
|
|
21
|
-
const result = isTuesday(new Date(NaN));
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isValid } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isValid', () => {
|
|
5
|
-
it('returns true if the given date is valid', () => {
|
|
6
|
-
const result = isValid(new Date());
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given date is invalid', () => {
|
|
11
|
-
const result = isValid(new Date(''));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('accepts a timestamp', () => {
|
|
16
|
-
expect(isValid(new Date(2014, 1 /* Feb */, 11).getTime())).toBe(true);
|
|
17
|
-
expect(isValid(NaN)).toBe(false);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('treats null as an invalid date', () => {
|
|
21
|
-
const result = isValid(null);
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isWednesday } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isWednesday', () => {
|
|
5
|
-
it('returns true if the given date is Wednesday', () => {
|
|
6
|
-
const result = isWednesday(new Date(2014, 8 /* Sep */, 24));
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given date is not Wednesday', () => {
|
|
11
|
-
const result = isWednesday(new Date(2014, 8 /* Sep */, 25));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('accepts a timestamp', () => {
|
|
16
|
-
const result = isWednesday(new Date(2014, 1 /* Feb */, 12).getTime());
|
|
17
|
-
expect(result).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('returns false if the given date is `Invalid Date`', () => {
|
|
21
|
-
const result = isWednesday(new Date(NaN));
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isWeekend } from './index';
|
|
3
|
-
|
|
4
|
-
describe('isWeekend', () => {
|
|
5
|
-
it('returns true if the given date is in a weekend', () => {
|
|
6
|
-
const result = isWeekend(new Date(2014, 9 /* Oct */, 5));
|
|
7
|
-
expect(result).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns false if the given date is not in a weekend', () => {
|
|
11
|
-
const result = isWeekend(new Date(2014, 9 /* Oct */, 6));
|
|
12
|
-
expect(result).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('accepts a timestamp', () => {
|
|
16
|
-
const result = isWeekend(new Date(2014, 9 /* Oct */, 5).getTime());
|
|
17
|
-
expect(result).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('returns false if the given date is `Invalid Date`', () => {
|
|
21
|
-
const result = isWeekend(new Date(NaN));
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
});
|