I want to use momentjs to check for invalid date/time strings:
var invalid = '2017-03-18 23;00;00'; if (moment(invalid).isValid()) { return 'valid date' }
This (correctly) throws a stacktrace with the familiar 'Deprecation warning: value provided is not in a recognized RFC2822 or ISO format......'
But even if I add a try/catch:
try { var invalid = '2017-03-18 23;00;00'; if (moment(invalid).isValid()) { return 'valid date' } catch (err) { throw Error ('invalid date format'); }
the stacktrace is still printed. What do I need to do to avoid the stacktrace from being printed?
I've searched all similar questions on StackOverflow but they all try to solve a different problem (fixing the input or finding the correct syntax to parse the input).
I using v2.18.1.