cron-parser icon indicating copy to clipboard operation
cron-parser copied to clipboard

documentation: Document "fields" (Getter) in README

Open greyscaled opened this issue 2 years ago • 0 comments

User Story 👥

Here there :wave: :wave:. I was initially evaluating using this library for the following use case:

  • an API sends me a cron string
  • I want to display a form with checkboxes and time inputs

PR here: https://github.com/coder/coder/pull/2006/files

To do this, I needed to parse day-of-week.

When I looked at this npm package/README, I saw that we could do some cool things, but I didn't see any evidence that I could just pull out the information I needed (ie: from the fields property).

It would be great to document fields.

Details

  • fields is a "getter" with the 5 cron-aspects as sub-properties, and gets the parsed cron string in pieces, usually as numbers in an array
  • it would be great to see an example of how to use `fields

I'm happy supplying a PR for this if that's ok!

greyscaled avatar Jun 03 '22 15:06 greyscaled