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:
Mark Hendriksen
2025-09-22 09:21:06 +02:00
committed by GitHub
parent 2892ebb2fe
commit 5f97f2fc4d
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -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"
}
}