I need to validate UK dates, I'm using moment.js. The UK date format is "dd/mm/yyyy". The following code reports false validating the date "25/03/2021", why? How can I solve?
moment.locale("en");
const since = "25/03/2021";
let date = moment(since, "L");
let isValid = date.isValid();
console.log(isValid);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
Update: I tried the solution of msmolcic but the problem is that I'm validating dates taken from the browser and when UK English is set the locale is "en" and not "en-GB". The following code fails.
How can I fix it?
moment.locale("en");
const since = "25/03/2021";
let date = moment(since, "L");
console.log(date);
let isValid = date.isValid();
console.log(isValid);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment-with-locales.min.js"></script>