Timer custom format?

Community Driven Extensions Project
Post Reply
berrysanusih
Posts: 1
Joined: 10 Aug 2016, 09:11

10 Aug 2016, 09:21

Hi, i try to use timer with custom format...

I make my timer like this

Code: Select all

<pe:timer  
			update=":globalMessages createOrderButton" formatFunction="return formatMe(value);"
			timeout="#{orderPendingBacking.calculateCountDownTimeNoLimit(pending.orderTime)}"  
			listener="#{orderPendingBacking.onTimeout()}"/>
And formatMe function like this

Code: Select all

<script type="text/javascript">
			window.formatMe = function(value){  
				var diffSeconds = value / 1000 % 60;
				var diffMinutes = value / (60 * 1000) % 60;
				var diffHours = value / (60 * 60 * 1000) % 24;
				var diffDays = value / (24 * 60 * 60 * 1000);
				var days = Math.floor(diffDays);
				var hours = Math.floor(diffHours);
				if (days > 0) {
					hours = hours + (days * 24);
				}
				return hours + ":" + Math.floor(diffMinutes) + ":" + Math.floor(diffSeconds); 
			};
		</script>
Let say the timeout value is 172801000...In my web the timer show "47:53:59", but the timer didn't count down...I always need to refresh my page for the timer to count down...Am i doing it wrong?

Thanks for the help

I'm using primefaces 5.3, primefaces extension 3.0, and wilfly 9.0.2

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests