Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples assume Dates instead of Instants? #47

Closed
werenike opened this issue Mar 14, 2021 · 2 comments
Closed

Examples assume Dates instead of Instants? #47

werenike opened this issue Mar 14, 2021 · 2 comments

Comments

@werenike
Copy link

werenike commented Mar 14, 2021

I'm trying to use a filter on the result of periodic-seq like in this example in the README:

(->> (chime/periodic-seq (-> (.adjustInto (LocalTime/of 0 0)
                                          (ZonedDateTime/now (ZoneId/of "America/New_York")))
                             .toInstant)
                         (Period/ofDays 1))

     (filter (comp #{DayOfWeek/TUESDAY DayOfWeek/FRIDAY}
                   #(.getDayOfWeek %))))

However when I try try example, I get this error:

No matching field found: getDayOfWeek for class java.time.Instant

The function seems to return Instants while the example assumes Dates. Am I doing something wrong or is there a problem with the example? Thanks!

@werenike
Copy link
Author

werenike commented Mar 14, 2021

I've worked around it in a way similar to this for now:

     (filter (comp #{DayOfWeek/TUESDAY DayOfWeek/FRIDAY}
                   #(.getDayOfWeek %)
                   #(.atZone % (ZoneId/of "America/New_York"))))

@jarohen
Copy link
Owner

jarohen commented Mar 16, 2021

Thanks again - have updated the README :)

jarohen added a commit that referenced this issue Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants