formatic 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e3760b14dfc9ada06bc26e574096d2bcc2de6ea0535341b464ae0461bd42f40
4
- data.tar.gz: 47ec92f48fe42b20ff6cac407bdc469ad88d59b7596f47b92fb5705c7ef3f050
3
+ metadata.gz: 032f7e8e0a8d71e094692ff1fee875c5514874ddf79876bba8d7026bcc3769df
4
+ data.tar.gz: dd414a5305acca154f715389fe88e3e0950d8146964396d7a524424a36edadd8
5
5
  SHA512:
6
- metadata.gz: 042c1c0b08bccdebb97e1eff2c3004677e499dedba3a6a5dea9f6c0317e6794f8cc9b67f32cb21f0cbbbb4496dbce0a0d93d51922b40300ee5183301ff54d419
7
- data.tar.gz: c74dc722ccc978558d690102faee42641f0d39916939f031de755f4123981af65077c039a886887688ec93c0f76b93ad477670aaa095ce782aed9a47fe63177c
6
+ metadata.gz: 60f8b3103a1a0948a4226c4311a5a44d7f65bc5ce48c205859b2fba5e4a73cf8bf46860382ab3b8f8ec546fe42612c0feac34d3b47863215928c1b3f76ef5512
7
+ data.tar.gz: 3538770fe0cccc3e88d069340e2b0cb2914951f46fe45bd7bd64ebf7e72b366d5c6373e209ee2bdb2749159d3bcd150035066b18fa3eb5f5c66832b892501dfa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [0.4.4] 2026-09-18
2
+
3
+ - Restrict year select to current year and later when `skip_past` is true
4
+
5
+ ## [0.4.3] 2026-09-17
6
+
7
+ - Add `skip_past` option to `Formatic::Date` to start calendar at today instead of 5 days ago
8
+ - Hide clear (X) calendar flick when the attribute is mandatory
9
+ - Fix `calendar` start date to be relative to `now` param
10
+
1
11
  ## [0.4.2] 2026-09-14
2
12
 
3
13
  - Even more clearly mark today
@@ -6,6 +6,7 @@ module Formatic
6
6
  # Date/calendar
7
7
  class Date < ::Formatic::Base
8
8
  option :calendar, as: :show_calendar, default: -> { true }
9
+ option :skip_past, default: -> { false }
9
10
 
10
11
  # Represents one element in the calendar.
11
12
  class Day
@@ -87,7 +88,7 @@ module Formatic
87
88
  end
88
89
 
89
90
  def calendar(now: ::Time.current)
90
- from = 5.days.ago.to_date
91
+ from = skip_past ? now.to_date : (now.to_date - 5.days)
91
92
  till = now.beginning_of_month.advance(months: 2).end_of_month.to_date
92
93
 
93
94
  (from..till).map do |date|
@@ -110,7 +111,8 @@ module Formatic
110
111
  end
111
112
 
112
113
  def collection_for_year
113
- result = (30.years.ago.year..10.years.from_now.year)
114
+ lower = skip_past ? ::Time.current.year : 30.years.ago.year
115
+ result = (lower..10.years.from_now.year)
114
116
  return result if wrapper.required?
115
117
 
116
118
  result.to_a.prepend nil
@@ -43,13 +43,15 @@ module Formatic
43
43
  </div>
44
44
  <% if calendar? %>
45
45
  <div class="c-formatic-date__calendar">
46
- <a class="c-formatic-date__flick c-formatic-date__clear js-formatic-date__shortcut" href="#"
47
- data-day=""
48
- data-month=""
49
- data-year=""
50
- >
51
- X
52
- </a>
46
+ <% if wrapper.optional? %>
47
+ <a class="c-formatic-date__flick c-formatic-date__clear js-formatic-date__shortcut" href="#"
48
+ data-day=""
49
+ data-month=""
50
+ data-year=""
51
+ >
52
+ X
53
+ </a>
54
+ <% end %>
53
55
  <% calendar.each do |day| %>
54
56
  <a class="c-formatic-date__flick <%= day.classes %> js-formatic-date__shortcut"
55
57
  href='#'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Formatic
4
- VERSION = '0.4.2'
4
+ VERSION = '0.4.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - halo
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  - !ruby/object:Gem::Version
229
229
  version: '0'
230
230
  requirements: []
231
- rubygems_version: 3.6.9
231
+ rubygems_version: 4.0.6
232
232
  specification_version: 4
233
233
  summary: A set of ViewComponents for form elements
234
234
  test_files: []