alpinweis / cronex

Ruby library that converts cron expressions into human readable strings
Other
78 stars 29 forks source link

Include day of week when day of month is included #8

Closed dzader closed 5 years ago

dzader commented 6 years ago

looking at other implementations of this library the day of week is included even when the day of month is included.

This can be seen by visiting: https://cronexpressiondescriptor.azurewebsites.net/?expression=23+12+15+*+SUN&locale=en (relevant code showing day of month + day of week are always formatted )

or by running the following pip install cron-descriptor

from cron_descriptor import get_description, ExpressionDescriptor
print(get_description('23 12 15 * SUN'))
# -> At 12:23 PM, on day 15 of the month, only on Sunday

(relevant code showing day of month + day of week are always formatted)

alpinweis commented 6 years ago

The current ruby implementation is based on the java implementation

https://github.com/grahamar/cron-parser/blob/master/cron-parser-core/src/main/java/net/redhogs/cronparser/CronExpressionDescriptor.java#L246

Although, if this combination of DoW and DoM is a valid cron expression I'm fine with the proposed changes.