SHEQL is a schema less solution to the problem of storing repeated events in a calendar. It is inspired by CSS selectors.
#Features
- 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.
#Elements They are analogous to tag names in HTML.
-
y- Representing years -
m- Representing months -
w- Representing weeks -
d- Representing days
#Element Properties Properties are like css classes applied on tags. Each tag has its own set of classes (properties as we call them here).
###Years
-
365d,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.
###Months
-
31d,30d,29d,28d- Filters all the the months based on the total days that are in that month. -
4w,5w- Filter out months based on the number of weeks in it. -
jan...dec- Filtering based on the month name.
###Weeks
-
7d,4d- Filter outs weeks based on the total number of days in it.
###Days
-
21- Filter based on the date value. -
sat,sun, ...fri- Filter days on the day of the week.
##Filters
Filters can be applied on any type of element. They can use the element's properties also.
###Dot notation Use it to filter out elements that have the specified property.
y.365d /*Selects non-leap years*/
m.jan /*Select the month January*/###exclamation notation Use it to filter out elements that do NOT have the specified property.
m!jan /*all months except january*/###nth element Use it to filter out the nth element
d:n[x+3] /*All days except the first 2*/
d:n[3] /*3 day only*/
d:n[2x] /*All alternate days*/###lth element Use it to filter out the nth element for the last element.
d:l[x+3] /*All days except the last 2*/#Examples
Yearly repeated on the 45th day
y d:n[45]Monthly 1st sat
m d.sat:n[1]Monthly 1st day if it's a sat
m d:n[1].satmonthly last sat
m d.sat:l[1]monthly second last sat
m d.sat:l[2]monthly all sat
m d.satevery 3rd months 2nd sat
m:n[3x] d.sat:n[2]every 1st of every month
m d:n[1]Every alternate month second week, first mondays
m:n[2x] w:n[2] d.monEvery alternate month second monday
m:n[2x] d.mon:n[2]100th day of each year
y d:n[100]14th Feb every yr
y m:n[1] d:n[14]
y m.feb d:n[14]
y m.feb d.14Every 20th day
d:n[20x]every mar-dec weekdays
y m:n[-x+3] d:n[x+1]:n[-x+1]every day in jan except fridays
m.jan d!frievery alternate month's first and third saturday
m:n[2x] d.sat:l[x+2]:n[2x+1]##How to use from cli
- run
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
require 'sheql'.
##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);