MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / dateIsBetween

Function dateIsBetween

apps/site/util/date.ts:1–13  ·  view source on GitHub ↗
(startDate: string, endDate: string)

Source from the content-addressed store, hash-verified

1export const dateIsBetween = (startDate: string, endDate: string): boolean => {
2 const invalidDateStr = 'Invalid Date';
3 const start = new Date(startDate);
4 const end = new Date(endDate);
5
6 if ([start.toString(), end.toString()].includes(invalidDateStr)) {
7 throw new Error('dateIsBetween got called with invalid dates');
8 }
9
10 const now = new Date();
11
12 return start < now && now < end;
13};

Callers 3

WithBadgeGroupFunction · 0.90
WithBannerFunction · 0.90
date.test.mjsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected