โ06-20-2018 10:51 AM
I am attempting to write javascript for a script snap to manipulate dates, times, and date/times. I am having issues getting a date field plus a separate time field parsed as a DateTime and further having issues when I need to add a duration of time to the DateTime. Are there any examples of this somewhere?
Doug
โ06-29-2018 11:56 AM
punchInDate is in โyyyy-MM-ddโ
punchInTime is in โHH:mmโ
punchIn should be something like โMM/dd/yyyy HH:mmโ, or โyyyy-MM-dd HH:mmโ, or โMMddyyyyHHmmโ, etc.
โ06-29-2018 12:01 PM
@doug.fossler
Use this-
$punchInDate.toLocaleDateString(โ{โformatโ:โyyyy-MM-dd HH:mmโ}โ
if punchInDate is coming as date field , if itโs coming as String then 1st do Date.parse($punchInDate), then use formater in mapper snap
โ06-29-2018 12:08 PM
I am not doing this inside a mapper snap, i am attempting to do this in javascript inside a script snap on purpose.
โ06-29-2018 12:14 PM
use mapper only. Why need to have script snap? always trying to ignore script as much as possible.
โ06-29-2018 12:23 PM
My use case will not allow this to be handled in a mapper. Unless you can tell me how to edit multiple docs based on the prior edits of said docs? I am aware of arrayโs but they would not solve the problem.