Interactive

Countdown Widget

JavaScript countdown timer to a target date/time. Supports multiple layouts (default, compact, card, minimal), custom labels, timezone handling, and completion callbacks.

Default Layout

Standard countdown with all time units.

Code
<?php echo CountdownWidget::widget([ 'targetDate' => '2025-12-31 23:59:59', 'title' => 'Event Starts In', ]); ?>
Live Demo

Event Starts In

00
Days
00
Hours
00
Minutes
00
Seconds

Card Layout

Bootstrap card style countdown.

Code
<?php echo CountdownWidget::widget([ 'targetDate' => $saleEndDate, 'layout' => 'card', 'title' => 'Sale Ends In', ]); ?>
Live Demo
Sale Ends In
00
Days
00
Hours
00
Minutes
00
Seconds

Compact Format

Inline compact countdown (00:00:00:00).

Code
<?php echo CountdownWidget::widget([ 'targetDate' => $deadline, 'layout' => 'compact', ]); ?>
Live Demo
Time Remaining: 00:00:00:00

Minimal Layout

Inline minimal format (00d 00h 00m 00s).

Code
<?php echo CountdownWidget::widget([ 'targetDate' => $eventDate, 'layout' => 'minimal', ]); ?>
Live Demo
00d 00h 00m 00s

Without Seconds

Countdown showing only days, hours, and minutes.

Code
<?php echo CountdownWidget::widget([ 'targetDate' => $launchDate, 'showSeconds' => false, ]); ?>
Live Demo

Launch Date

00
Days
00
Hours
00
Minutes

With Expired Message

Shows custom message when countdown reaches zero.

Code
<?php echo CountdownWidget::widget([ 'targetDate' => $deadline, 'expiredMessage' => 'Event has started!', ]); ?>
Live Demo

Registration Closes In

00
Days
00
Hours
00
Minutes
00
Seconds

Configuration Options

OptionTypeDefaultDescription
targetDatestring|DateTimerequiredTarget date/time
timezonestringapp timezoneTimezone for target date
layoutstringdefaultLayout: default, compact, card, minimal
titlestringnullTitle above countdown
showLabelsbooltrueShow labels (Days, Hours, etc.)
showDaysbooltrueShow days counter
showHoursbooltrueShow hours counter
showMinutesbooltrueShow minutes counter
showSecondsbooltrueShow seconds counter
expiredMessagestringnullMessage when countdown expires
hideOnExpiredboolfalseHide widget when expired