Time Conversion

  • + 0 comments

    Why doesn't this work?

    function timeConversion(s: string): string {
        // Write your code here
        const date: Date = new Date(`10/27/2024 ${s}`)
        const dateString: string = date.toLocaleTimeString("en-us", { hour12: false })
        return dateString
    }
    

    Can we not utilize date objects for this? I think it makes it more robust TBH