Schedule Query Langauge
SHEQL is a schema less solution to the problem of storing repeated events in a calendar. It is inspired by CSS selectors.
- A Far More powerful and customizable logic for repetition can be written.
- A Schemaless Architecture.
- A single change is required to update repeated events.
- Platform independent.
They are analogous to tag names in HTML.
y- Representing years
m- Representing months
w- Representing weeks
d- Representing days
Properties are like css classes applied on tags. Each tag has its own set of classes (properties as we call them here).
366d- Filters all the years in the given range which have 365 days or 366 days (AKA leap year)
52w- Filters all the years based on the total number of weeks that fall in that year. First day of the week is Sunday be default.
2015- Filter based on the year value.
28d- Filters all the the months based on the total days that are in that month.
5w- Filter out months based on the number of weeks in it.
dec- Filtering based on the month name.
4d- Filter outs weeks based on the total number of days in it.
21- Filter based on the date value.
fri- Filter days on the day of the week.
Filters can be applied on any type of element. They can use the element's properties also.
Use it to filter out elements that have the specified property.
y.365d /*Selects non-leap years*/ m.jan /*Select the month January*/
Use it to filter out elements that do NOT have the specified property.
m!jan /*all months except january*/
Use it to filter out the nth element
d:n[x+3] /*All days except the first 2*/ d:n /*3 day only*/ d:n[2x] /*All alternate days*/
Use it to filter out the nth element for the last element.
d:l[x+3] /*All days except the last 2*/
Yearly repeated on the 45th day
Monthly 1st sat
Monthly 1st day if it's a sat
monthly last sat
monthly second last sat
monthly all sat
every 3rd months 2nd sat
every 1st of every month
Every alternate month second week, first mondays
m:n[2x] w:n d.mon
Every alternate month second monday
100th day of each year
14th Feb every yr
y m:n d:n y m.feb d:n y m.feb d.14
Every 20th day
every mar-dec weekdays
y m:n[-x+3] d:n[x+1]:n[-x+1]
every day in jan except fridays
every alternate month's first and third saturday
How to use from cli
npm install sheql -g.
- Example - get all the tuesdays of the year, except if they fall on the last day of the month
sheql 'm.sep d:l[x+2].tue'
- To use it as a package dependency, install it locally and use
Using as a dependency
var sheql = require('sheql'); var startDate = new Date(2010, 1,10); var endDate = new Date(2110, 4,15); var startDayOfWeek = 1; //Monday sheql.getDates('m.sep d:l[x+2].tue', startDate, endDate, startDayOfWeek);