@apility/rule-builder
v1.0.7
Published
Boilerplate for TypeScript projects (Node.js and browser modules)
Downloads
93
Readme
Rule Builder PHP
Installation
yarn add @apility/rule-builder
Example rule
Validates true all of 2021, except on the 17th of may, 24th of december and all of june.
{
"type": "group",
"count": "all",
"children": [
{
"type": "group",
"count": "any",
"children": [
{
"type": "dateRange",
"from": "2021-01-01",
"to": "2022-01-01"
}
]
},
{
"type": "not",
"child": {
"type": "group",
"count": "any",
"children": [
{
"type": "dateRange",
"from": "2021-05-17",
"to": "2021-05-18"
},
{
"type": "dateRange",
"from": "2021-12-24",
"to": "2021-12-25"
},
{
"type": "dateRange",
"from": "2021-06-01",
"to": "2021-07-01"
}
]
}
}
]
}
Simple example matching weekends in september 2021
{
"type": "group",
"count": "all",
"children": [
{
"type": "dayOfWeek,",
"days": [
6,
0
]
},
{
"type": "dateRange",
"from": "2021-09-01",
"to": "2021-10-01"
}
]
}