Countdown Timers
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
To implement a timer in the block manifest, connect the landing_countdown extension.
How to Configure the Timer
The minimum configuration is as follows:
'assets' => [
'ext' => ['landing_countdown'],
],
Optionally, you can specify the block version:
'block' => [
'version' => '18.5.0',
],
The version is used to restrict the addition of the block in older versions of the product where the necessary resources are not yet available.
What the Timer Extension Does
The landing_countdown extension calculates the remaining time until data-end-date and updates the values of the elements js-cd-days, js-cd-hours, js-cd-minutes, and js-cd-seconds.
End Date Attribute
For the timer container node, add the end date attribute:
'attrs' => [
'.landing-block-node-date' => [
[
'name' => 'End Date',
'type' => 'date',
'time' => true,
'format' => 'ms',
'attribute' => 'data-end-date',
],
],
],
Timer Markup
The timer container must have the class js-countdown. Inside the container, there should be nodes:
js-cd-days— daysjs-cd-hours— hoursjs-cd-minutes— minutesjs-cd-seconds— seconds
Optionally, you can add:
js-cd-years— yearsjs-cd-month— months
Supported attributes include:
data-end-date— end date in Unix time in millisecondsdata-start-date— start date for calculationsdata-years-format— format for displaying yearsdata-month-format— format for displaying monthsdata-days-format— format for displaying daysdata-hours-format— format for displaying hoursdata-minutes-format— format for displaying minutesdata-seconds-format— format for displaying secondsdata-days-expired-classes— classes added when the days value is zero
Value formats:
%S— with leading zero, e.g.,03%-S— without leading zero, e.g.,3
For hours, you can use %H or %I/%-I. The %I and %-I formats display the total number of hours remaining until the timer ends. In this mode, it is common to remove data-days-format and the js-cd-days element.
Example
<section class="landing_block g-pt-30 g-pb-30 g-bg-orange g-color-white">
<div class="landing-block-node-date mx-auto js-countdown text-center g-font-weight-300 g-line-height-1-2"
data-end-date="1555249081000"
data-days-format="%D"
data-hours-format="%H"
data-minutes-format="%M"
data-seconds-format="%S"
data-days-expired-classes="u-countdown--days-expiried">
<div class="landing-block-node-number u-countdown--days-hide d-inline-block g-mx-20">
<div class="landing-block-node-number-number g-font-size-36 mb-0">
<span class="js-cd-days">12</span>
</div>
</div>
<div class="landing-block-node-number-delimiter u-countdown--days-hide d-inline-block g-font-size-36">:</div>
<div class="landing-block-node-number d-inline-block g-mx-20">
<div class="landing-block-node-number-number g-font-size-36 mb-0">
<span class="js-cd-hours">01</span>
</div>
</div>
<div class="landing-block-node-number-delimiter d-inline-block g-font-size-36">:</div>
<div class="landing-block-node-number d-inline-block g-mx-20">
<div class="landing-block-node-number-number g-font-size-36 mb-0">
<span class="js-cd-minutes">52</span>
</div>
</div>
<div class="landing-block-node-number-delimiter d-inline-block g-font-size-36">:</div>
<div class="landing-block-node-number d-inline-block g-mx-20">
<div class="landing-block-node-number-number g-font-size-36 mb-0">
<span class="js-cd-seconds">52</span>
</div>
</div>
</div>
</section>
Examples of Standard Blocks
Examples of blocks of this type can be viewed in the repository through the methods landing.block.getmanifestfile and landing.block.getrepository.
Codes for some standard blocks:
51.2.countdown_0451.3.countdown_0851.3.countdown_08_wo_bg51.4.countdown_music51.5.countdown_event51.7.countdown_1351.1.countdown_01
Important Considerations
data-end-dateis passed in milliseconds- for
%Iand%-I, the total number of hours is displayed, without a separate days block - if you need to hide days after they reach zero, use
data-days-expired-classes