How to use `@sapphire/shapeshift ` dateValid & stringRegex
I have a slash command that needs to take in a date input in the format of
YYYY-MM-DD
. I want to perform validation on this and throw an error if it is not in this format or not a valid date. I was looking at the documenation, but I was hoping to see a code example to help explain the usage. I appreciate the explanation and help.1 Reply
Solution
You can't do it all in one validation I think so instead:
Or just try and parse it with
new Date()
first and use s.date.valid.run(...)