Cron Expressioncron form

NG-ZORRO experiments are features that are released but not yet considered stable or production ready

Developers and users can opt-in into these features before they are fully released. But breaking changes may occur with any release.

When To Use#

When you want to use cron in Angular.

Import Module#

import { NzCronExpressionModule } from 'ng-zorro-antd/cron-expression';

Examples

2024-12-20 03:45:00


2024-12-20 03:45:00

The simplest usage.

expand codeexpand code
      Loading...
    
2024-12-20 03:45:00
2024-12-20 03:45:00
2024-12-20 03:45:00

There are three sizes of an CronExpression box: large (40px)、default (32px) and small (24px).

expand codeexpand code
      Loading...
    
2024-12-20 03:45:00

No bezel.

expand codeexpand code
      Loading...
    
2024-12-20 03:45:00
2024-12-20 03:45:00

There are two rule types of an CronExpression box: nzType="linux" (five-segment) andnzType="spring" (six-segment).

expand codeexpand code
      Loading...
    

[nzCollapseDisable]="true"

expand codeexpand code
      Loading...
    
2024-12-21 01:01:00

cron: 1 1 * * *

You can use nzExtra to specify the content on the right.

expand codeexpand code
      Loading...
    
Next Time: 2024-12-20 04:10:00

Custom rendering next execution time.

expand codeexpand code
      Loading...
    
2024-12-21 01:00:00
2024-12-21 01:00:00

<nz-cron-expression formControlName="cron"></nz-cron-expression>

expand codeexpand code
      Loading...
    

API#

Install cron-parser in your project first:

npm install cron-parser

nz-cron-expression#

ParameterDescriptionTypeDefault
[nzType]Cron rule type'linux'|'spring'linux
[nzDisabled]Disablebooleanfalse
[nzBorderless]Whether to hide the borderbooleanfalse
[nzSize]The size of the input box.'large'|'small'|'default'default
[nzCollapseDisable]Hide collapsebooleanfalse
[nzExtra]Render the content on the rightTemplateRef<void>-
[nzSemantic]Custom rendering next execution timeTemplateRef<void>-

Note#

Supported format#

*    *    *    *    *    *
┬    ┬    ┬    ┬    ┬    ┬
│    │    │    │    │    |
│    │    │    │    │    └ day of week (0 - 7, 1L - 7L) (0 or 7 is Sun)
│    │    │    │    └───── month (1 - 12)
│    │    │    └────────── day of month (1 - 31, L)
│    │    └─────────────── hour (0 - 23)
│    └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, optional)