Natural language dates autocompletion

I was just finishing up porting over my final bunch of remaining stuff from v1 to v2 and noticed I had another simple plug lying around. Ever since Silverbullet became my one platform for notes, task management, project management and the like dates became an important part of the experience and at some point, as an initial experiment with PLUG development and with some then AI help, I had cooked up this comment of mine into a date autocompletion plug along the lines of the in-built emoji one.
I’m sure with Lua in v2, there is probably a way to pull this off entirely in Lua - but in case anyone wants an out of the box solution, cleaned it up for v2 and made it available at github:deepkn/silverbullet-nldates/nldates.plug.js . The prefix to activate the completion is !! and just follow it up with the date in natural language like “next friday” or “two weeks from now” etc. Uses Chrono js under the hood, so should be able to handle most common usages. Will be making a proper release after some testing.

4 Likes

Looks useful!

is there a non-minified version? I’d like to fork and implement some things of my own :slight_smile:

Code is available here, it’s fairly simple: GitHub - deepkn/silverbullet-nldates: A natural language date completion plugin for SilverbulletMD. You can fork it and go with any modifications. Feel free to submit a PR as well if you think it’s widely useful.

1 Like

very fun and impressive.
I try something like “!!first monday of december” “!!last monday of next month”.
Is it supported? @deepkn

I guess it’s not there yet - honestly the plug simply uses chrono.js under the hood, so what’s supported is limited to what chrono.js supports. It indeed has some limitations there.

1 Like

I have not found sandbox to test chrono.js. It’s not easy to know supported features .