cypriss / mutations

Compose your business logic into commands that sanitize and validate input.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support Time objects

assembler opened this issue · comments

Changing following line:
https://github.com/cypriss/mutations/blob/master/lib/mutations/date_filter.rb#L20

to:
if data.is_a?(Date) || data.is_a?(Time)

Would support both Date, DateTime and Time objects. I'm dealing with TimeWithZone instances in my rails project and this would come in handy. Up until then, I could use the following:

duck :starts_at, methods: [:acts_like_time?]

I'm surprised that there is no support for timestamps as inputs. We're having to write our own filter here to support timestamps in our application.

I've added a PR that would support time objects: #90

#90 was released in 0.8.0! 🎉