I have JS string with date: 21-05-2022. It is also possible to receive date string as 21-05-2022T23:15:56Z - date string with date and time data. I would like to check if incoming string contains only date or date and time. Now I am using a function which splits string by 'T' symbol and checks if resulted array has second [1] member. Maybe there is more elegant way to perform this operation? I can use moment.js library in this context.