let indexTargetSpan = $(`#timeSpan${index}`)[0]
console.log('indexTargetSpan')
console.log(indexTargetSpan)
console.log(indexTargetSpan.innerText)
let todaydate = new Date()
let year = todaydate.getFullYear()
// returns this string: Sun Jun 18 2023 21:40:52 GMT-0400 (Eastern Daylight Time)
let timetoday = todaydate.toString().match(/{year}\s(.+?)\sGMT/)
console.log('timetoday')
console.log(timetoday)
how to use that variable in the regex so that a hard-coded '2023' that does successfully return: "21:40:52"
👎 and that hard-coded value doesn't work when deployed in production 6 months from now when .getFullYear() returns 2023
const handleClick = (index:number) => { console.log($(
#timeSpan${index}
))// returns this string: Sun Jun 18 2023 21:40:52 GMT-0400 (Eastern Daylight Time)
how to use that variable in the regex so that a hard-coded '2023' that does successfully return:
"21:40:52"
👎 and that hard-coded value doesn't work when deployed in production 6 months from now when .getFullYear() returns 2023