script to convert to js Date format, API queries