Please read this tread
You should make following modification to code work startDate = tagStartDate[0].value
startDate = tagStartDate[0].value