Rails - How to display number of days between two dates in a rails form -
i making simple rails app , have form whereby employee can register vacation days. have 2 date fields (start_date , end_date), , have field displayed in theshow action/page (and if possible appear instantaneously within form after days selected). how can this?
this how can in ruby.
(start_date.to_i - end_date.to_i) / 86_400 datetime.to_i returns seconds since epoch
86400 - amount of seconds in day.
just add ajax query or async code simplest solution.
Comments
Post a Comment