date_generator 1.0.0 copy "date_generator: ^1.0.0" to clipboard
date_generator: ^1.0.0 copied to clipboard

Generate dates based on their position within a month

Date Generator #

Generate dates based on the position within a month

Generating Dates #

You start off with the ordinal which is the week within the month

Generator().first

This will look for the first week, there are methods for first, second, third, fourth, and last. last being a method that returns either the 4th or 5th week depending on how the month is.

You can also select the first by number input

Generator().week(1)

To select the last week us the number 5

Next you select the week day within that week.

Generator().first.saturday

Just like the week number you can select the week day by using the weekDay(int) method. The week days are numbered from 1-7.

Next you can select the month

Generator().first.saturday.may
Generator().first.saturday.month(5)

The months are numbered 1-12.

And finally you can select the year

Generator().first.saturday.may.of(2019);

This will return a DateTime object given these constraints (in this case the first saturday of may 2019.

Holiday Groups #

HolidayGroup is just an interface to categorize holidays together. It also has convenience methods to get methods by strings (getHolidayGenerator) and get the list of holidays supported by the group extending the class (holidayNames). Users can also add to the grouping if they would like by adding holidays through the addHolidays(<String, HolidayFunction>{}) method.

If you like this package consider following me on Instagram

5
likes
140
pub points
19%
popularity

Publisher

verified publisherpetit.dev

Generate dates based on their position within a month

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on date_generator