Created
June 28, 2019 15:11
-
-
Save arun12209/8717e9846f22c54c0ef3dee744905411 to your computer and use it in GitHub Desktop.
OpptyCloseTimerCmpHelper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
countDownAction : function(component, event, helper,closeDate) { | |
var interval = window.setInterval( | |
$A.getCallback(function() { | |
var opptyCloseDate = new Date( closeDate+" 00:00:00 "); | |
var now_date = new Date(); | |
var timeDiff = opptyCloseDate.getTime()- now_date.getTime(); // time difference between opportunity close date and todays date | |
component.set("v.isValid",true); | |
var seconds=Math.floor(timeDiff/1000); // seconds | |
var minutes=Math.floor(seconds/60); //minute | |
var hours=Math.floor(minutes/60); //hours | |
var days=Math.floor(hours/24); //days | |
hours %=24; | |
minutes %=60; | |
seconds %=60; | |
component.set("v.day",days); | |
component.set("v.hour",hours); | |
component.set("v.minute",minutes); | |
component.set("v.second",seconds); | |
}), 1000); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment