formatic 0.4.2 → 0.4.3

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: 142e8c45bd25c9b20ec5287736872e8974af37ae08fff7b202dbe7968c07cd08
4
+ data.tar.gz: 221b88ebd0b0b08e73afcec6fb061dfa69267556ffa7d4ad383b76beea528edd
5
5
  SHA512:
6
- metadata.gz: 042c1c0b08bccdebb97e1eff2c3004677e499dedba3a6a5dea9f6c0317e6794f8cc9b67f32cb21f0cbbbb4496dbce0a0d93d51922b40300ee5183301ff54d419
7
- data.tar.gz: c74dc722ccc978558d690102faee42641f0d39916939f031de755f4123981af65077c039a886887688ec93c0f76b93ad477670aaa095ce782aed9a47fe63177c
6
+ metadata.gz: 8164cb6a8d6f0effb577340530e0c3d52331417cd8e63395a1a9593dd1fd09be1fa936a41898ab4d57b8119e8f7e6e37d630e0093cc87c7868f1e82285a03d02
7
+ data.tar.gz: 33be02040dcb62fc98e62d6c4f94ad923d7b7a661f92656900f7fc58d81e27b8552c492d37c6eab36ae03c0da43b479ed4d182b5b3138656a1ea3f4a587e7b8b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.4.3] 2026-09-17
2
+
3
+ - Add `skip_past` option to `Formatic::Date` to start calendar at today instead of 5 days ago
4
+ - Hide clear (X) calendar flick when the attribute is mandatory
5
+ - Fix `calendar` start date to be relative to `now` param
6
+
1
7
  ## [0.4.2] 2026-09-14
2
8
 
3
9
  - 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|
@@ -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.3'
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.3
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: []