I have a variable called workFrom that has time(hh:mm) as String at the FrontEnd(Angular JS). I would like to convert this to Date format before posting the data on to MongoDB with default date as 01/01/1970 and the time from whatever has been posted from workFrom. How do I do it?
Eg : workFrom : 11:40 should be converted to 01/01/1970 11:40 (according to the standard format of date used in MongoDB).
Thanks in advance
'11:40'.split(':').reduce((h,m)=> new Date(h*3.6e6 + m*6e4).toISOString()).