MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / checkDate

Function checkDate

Timing-Functions/ParseDate.js:3–7  ·  view source on GitHub ↗
(date)

Source from the content-addressed store, hash-verified

1import { getMonthDays } from './GetMonthDays'
2
3function checkDate(date) {
4 if (date.day < 1 || date.day > getMonthDays(date.month, date.year)) {
5 throw new Error('Invalid day value.')
6 }
7}
8
9function parseDate(dateString) {
10 const regex = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/

Callers 1

parseDateFunction · 0.85

Calls 1

getMonthDaysFunction · 0.90

Tested by

no test coverage detected