简体   繁体   中英

Calculate dates with Later.js

I am trying to calculate complex dates with Later.js.

I want to to things like: "on the third Tuesday of every month"

but I get an error pointing to 'third'. According to the docs, only 'first' and 'last' are recoginzed...ok, so if I change it to: "on the first Tuesday of every month"

Then the error is at 'Tuesday'.

Anyone know how I can use Later.js to figure such dates using the text parser?

You can do it by using "day instance" phrase which works on later.parse.text or "dayOfWeekCount()" method which works on later.parse.recur()

for example on 3rd tuesday on every month you can write

var sched = later.parse.text("on the 3rd day instance on Tues at 16:00")

OR

var sched = later.parse.recur().on(3).dayOfWeekCount().on(3).dayOfWeek().on("8:00").time()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM