1

I've tried to find an algorithm (Salesforce, aura) but without success. Probably, you have any ideas!

I have:

  • attribute
    <aura:attribute name="bulkApply" type="Map" default="{}"/>

  • datetime input:
<lightning:input label=""
                 class="label-hidden"
                 variant="label-hidden"
                 type="datetime-local"
                 value="{!v.bulkApply.SchedStartTime}"
/>
  • and time input:
<lightning:input type="time"
                 label=""
                 class="label-hidden"
                 variant="label-hidden"
                 name="startTimeOnly"
                 value="{!v.bulkApply.startTimeOnly}"
/>

This is what they look like and what I need to do:

inputs

After click the button to action replace logic I have the following values:

 let startTimeOnly = cmp.get('v.bulkApply.startTimeOnly');
 let schedStartTime = cmp.get('v.bulkApply.SchedStartTime');

 console.log(startTimeOnly); //00:30:00.000
 console.log(schedStartTime);//2023-02-08T13:00:00.000Z

 //here should be algorithm

The main problem is that I have time value with applied user timezone and datatime value in UTC format. Salesforce User timezone is Australia (GMT+11). That is why I have 2023-02-08T13:00:00.000Z instead of 9 Feb, 00:00. Please note, that browser timezone can be differ from salesforce user timezone.

1 Answer 1

0

You can use the split of javascript.

Let dateAndTime = schedStartTime.split('T');
//This will return an Array
//dateAndTime[0] - date
//dateAndTime[1] - time
// You can replace the value at 1 index

You probably need to convert the dateTime into string.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .