DEV Community

Discussion on: Two string methods every JavaScript developer should know.

Collapse
 
jalovatt profile image
Adam Lovatt • Edited

That's fair, though I would argue the level of RegExiness involved here is something everyone should make a point of learning because it solves so many problems.

An even shorter alternative, since you know the input format won't change: const justDate = date.slice(1, 11).