shekibobo / time_splitter

Easily split Time/DateTime attribute accessors on your models for date, time, hour, and minute.

Home Page:https://github.com/shekibobo/time_splitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow use another field as default

paulodiovani opened this issue · comments

Take the folowing example:

  split_accessor :starts_at, default: -> { Time.current }, time_format: '%H:%M'
  split_accessor :ends_at, default: -> { starts_at }, time_format: '%H:%M'

I want that, if ends_at is empty, TimeSplitter uses starts_at as default value.
Currently this is not allowed since the lambda is executed in Class scope.