mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Add new date format and 10-year period option (#154)
Added 'YYYYMMDD' to supported date formats in Family model. Introduced a 'last_10_years' period option in Period model with appropriate labels and date range.
This commit is contained in:
@@ -10,7 +10,8 @@ class Family < ApplicationRecord
|
||||
[ "YYYY/MM/DD", "%Y/%m/%d" ],
|
||||
[ "MM/DD/YYYY", "%m/%d/%Y" ],
|
||||
[ "D/MM/YYYY", "%e/%m/%Y" ],
|
||||
[ "YYYY.MM.DD", "%Y.%m.%d" ]
|
||||
[ "YYYY.MM.DD", "%Y.%m.%d" ],
|
||||
[ "YYYYMMDD", "%Y%m%d" ]
|
||||
].freeze
|
||||
|
||||
has_many :users, dependent: :destroy
|
||||
|
||||
@@ -63,6 +63,12 @@ class Period
|
||||
label_short: "5Y",
|
||||
label: "Last 5 Years",
|
||||
comparison_label: "vs. 5 years ago"
|
||||
},
|
||||
"last_10_years" => {
|
||||
date_range: -> { [ 10.years.ago.to_date, Date.current ] },
|
||||
label_short: "10Y",
|
||||
label: "Last 10 Years",
|
||||
comparison_label: "vs. 10 years ago"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user