Validate Date JS function

Hi, it seems to me unmanageable hassle to create a js functions that meets the following:
Receives a string as a parameter, returns a Boolean indicating if the parameter string passed, is a valid date.
True indicates a valid date was provided .
False indicates that a valid date was not provided.
A valid date string, will have only the full month name(ex “January” not “Jan”) and a day number. The string parameter can contain any number of spaces, but the month name must always start at the first non-space character from the beginning of the string. The day number part of the date string to be tested could contain alphabetic characters and thus making it invalid. ALL code should be executed WITHOUT using Built-in functions like toString() or IndexOf() for example.
Examples for desired output:
function (“January 21”)) ➔true
function(“Auust 3”)) ➔false

I’m grateful to everyone who may assume any solution

Your date object itself will tell you if it’s a valid date. If it’s not, it will return “Invalid Date”. Since you know what the result will be if it’s invalid, it should be easy from there to create a boolean from it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.