bullet_train 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67f18258ccc08e8f9c7ab4febd061776dbd014c14a851ff53a24b08b8f52740a
4
- data.tar.gz: d4a1eaccc46bdc38aac7ea2996f9908b899ddd7310e041a566015a59ff36e50e
3
+ metadata.gz: 15b2e81f913961c47cd7ab675ed1ec307f556f12343c0b1f86f570ef28795d87
4
+ data.tar.gz: e0dc0683ceac645f273ae98d2ef681043595107cbed257d07a78954593a3b5bd
5
5
  SHA512:
6
- metadata.gz: 255cfc9f4e0abcf1c25ff7d1e562f0a7c9bce5d11eefa1847feaae5247b04fa0a48679733d382216c0081cda8add87963a8a5c616cf438264cec1e7e0a316247
7
- data.tar.gz: b777a4c8d8f978ed1037c433b976351793dfadfdb59dfde8f23d4fdec72031d1dea52c9e36e664f2f560c9617fe8382017ff3ec5f9760b1afb17e77cea332297
6
+ metadata.gz: 93097fb9f2d180ed40e8b880f19a319c433eb87ad22a15319407c89fee24ce4e838a09af54fccc2fef4fb727e972600d5b2fede3759856d24dbf2269f0ff3af8
7
+ data.tar.gz: 5751619c7a2dd1616e5c2898c4ca292f1d4a90402f920c26de3a903240e9f0d14bc53f4ff4494744243ff11fcbd2fa01c4add6d32b18c63fa5a0dfaacc371339
@@ -1,20 +1,70 @@
1
1
  module Account::DatesHelper
2
- def display_date(timestamp, format: :default, date_format: nil)
2
+ def display_date(timestamp, custom_date_format = nil, format: :default, date_format: nil)
3
+ return nil unless timestamp
3
4
  format = date_format if date_format
4
- localize(local_time(timestamp).to_date, format: format) if timestamp
5
+
6
+ if format && format == :default
7
+ # e.g. October 11, 2018
8
+ if custom_date_format
9
+ local_time(timestamp).strftime(custom_date_format)
10
+ elsif local_time(timestamp).year == local_time(Time.now).year
11
+ local_time(timestamp).strftime("%B %-d")
12
+ else
13
+ local_time(timestamp).strftime("%B %-d, %Y")
14
+ end
15
+ else
16
+ localize(local_time(timestamp).to_date, format: format)
17
+ end
5
18
  end
6
19
 
7
- def display_time(timestamp, format: :default, time_format: nil)
20
+ def display_time(timestamp, custom_time_format = nil, format: :default, time_format: nil)
21
+ return nil unless timestamp
8
22
  format = time_format if time_format
9
- localize(local_time(timestamp).to_time, format: format) if timestamp
23
+
24
+ if format && format == :default
25
+ # e.g. 4:22 PM
26
+ local_time(timestamp).strftime(custom_time_format || "%l:%M %p")
27
+ else
28
+ localize(local_time(timestamp).to_time, format: format)
29
+ end
10
30
  end
11
31
 
12
- def display_date_and_time(timestamp, format: :default, date_format: nil, time_format: nil)
32
+ def display_date_and_time(timestamp, custom_date_format = nil, custom_time_format = nil, format: :default, date_format: nil, time_format: nil)
33
+ return nil unless timestamp
13
34
  format = "#{date_format} #{time_format}" if date_format && time_format
14
- localize(local_time(timestamp).to_datetime, format: format) if timestamp
35
+
36
+ if format && format == :default
37
+ # e.g. Today at 4:22 PM
38
+ # e.g. Yesterday at 2:12 PM
39
+ # e.g. April 24 at 7:39 AM
40
+ # today?
41
+ if local_time(timestamp).to_date == local_time(Time.now).to_date
42
+ "Today at #{display_time(timestamp, custom_time_format)}"
43
+ # yesterday?
44
+ elsif (local_time(timestamp).to_date) == (local_time(Time.now).to_date - 1.day)
45
+ "Yesterday at #{display_time(timestamp, custom_time_format)}"
46
+ else
47
+ "#{display_date(timestamp, custom_date_format)} at #{display_time(timestamp, custom_time_format)}"
48
+ end
49
+ else
50
+ localize(local_time(timestamp).to_datetime, format: format)
51
+ end
15
52
  end
16
53
 
17
54
  def local_time(timestamp)
18
55
  timestamp&.in_time_zone(current_user.time_zone)
19
56
  end
57
+
58
+ def am_pm?
59
+ !"#{I18n.t("time.am", fallback: false, default: "")}#{I18n.t("time.pm", fallback: false, default: "")}".empty?
60
+ end
61
+
62
+ def time_zone_name_to_id
63
+ ActiveSupport::TimeZone.all.map { |tz| {tz.name.to_s => tz.tzinfo.name} }.reduce({}, :merge)
64
+ end
65
+
66
+ def current_time_zone
67
+ current_time_zone_name = current_user&.time_zone || current_user&.current_team&.time_zone || "UTC"
68
+ ActiveSupport::TimeZone.find_tzinfo(current_time_zone_name).name
69
+ end
20
70
  end
@@ -0,0 +1,38 @@
1
+ en:
2
+ daterangepicker:
3
+ firstDay: 1
4
+ separator: " - "
5
+ applyLabel: "Apply"
6
+ cancelLabel: "Cancel"
7
+ fromLabel: "From"
8
+ toLabel: "To"
9
+ customRangeLabel: "Custom"
10
+ weekLabel: "W"
11
+ daysOfWeek:
12
+ - "Su"
13
+ - "Mo"
14
+ - "Tu"
15
+ - "We"
16
+ - "Th"
17
+ - "Fr"
18
+ - "Sa"
19
+ monthNames:
20
+ - "January"
21
+ - "February"
22
+ - "March"
23
+ - "April"
24
+ - "May"
25
+ - "June"
26
+ - "July"
27
+ - "August"
28
+ - "September"
29
+ - "October"
30
+ - "November"
31
+ - "December"
32
+ date_range_controller:
33
+ today: Today
34
+ yesterday: yesterday
35
+ last7Days: Last 7 Days
36
+ last30Days: Last 30 Days
37
+ thisMonth: This Month
38
+ lastMonth: Last Month
@@ -0,0 +1,13 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ date_field: "%m/%d/%Y"
5
+ date_and_time_field: "%m/%d/%Y %l:%M %p"
6
+ date_controller: "MM/DD/YYYY"
7
+ time:
8
+ am: AM
9
+ pm: PM
10
+ formats:
11
+ date_field: "%m/%d/%Y"
12
+ date_and_time_field: "%m/%d/%Y %l:%M %p"
13
+ date_controller: "MM/DD/YYYY h:mm A"
@@ -118,8 +118,8 @@ Certain form field partials like `buttons` and `super_select` can also have thei
118
118
  | [`buttons`](/docs/field-partials/buttons.md) | `string` | Optionally | `assign_checkboxes` | | |
119
119
  | `cloudinary_image` | `string` | | | | |
120
120
  | `color_picker` | `string` | | | [pickr](https://simonwep.github.io/pickr/) | |
121
- | `date_and_time_field` | `datetime` | | `assign_date_and_time` | [Date Range Picker](https://www.daterangepicker.com) | |
122
- | `date_field` | `date` | | `assign_date` | [Date Range Picker](https://www.daterangepicker.com) | |
121
+ | `date_and_time_field` | `datetime` | | | [Date Range Picker](https://www.daterangepicker.com) | |
122
+ | `date_field` | `date` | | | [Date Range Picker](https://www.daterangepicker.com) | |
123
123
  | `email_field` | `string` | | | | |
124
124
  | `emoji_field` | `string` | | | [Emoji Mart](https://missiveapp.com/open/emoji-mart) | A front-end library which allows users to browse and select emojis with ease. | |
125
125
  | [`file_field`](/docs/field-partials/file-field.md) | `attachment` | | | [Active Storage](https://edgeguides.rubyonrails.org/active_storage_overview.html) | |
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-11 00:00:00.000000000 Z
11
+ date: 2023-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -640,8 +640,10 @@ files:
640
640
  - config/locales/en/onboarding/user_details.en.yml
641
641
  - config/locales/en/onboarding/user_email.en.yml
642
642
  - config/locales/en/roles.en.yml
643
+ - config/locales/en/stimulus.yml
643
644
  - config/locales/en/teams.en.yml
644
645
  - config/locales/en/users.en.yml
646
+ - config/locales/localization.en.yml
645
647
  - config/routes.rb
646
648
  - db/migrate/20161115160419_devise_create_users.rb
647
649
  - db/migrate/20161116003852_add_api_key_to_user.rb
@@ -753,8 +755,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
753
755
  - !ruby/object:Gem::Version
754
756
  version: '0'
755
757
  requirements: []
756
- rubygems_version: 3.3.7
757
- signing_key:
758
+ rubygems_version: 3.4.10
759
+ signing_key:
758
760
  specification_version: 4
759
761
  summary: Bullet Train
760
762
  test_files: []