bullet_train 1.0.75 → 1.0.76

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: b293f3471c55d1a0ba3427a46a0e7b94c0115d1fd3da880d55e68acfb2462724
4
- data.tar.gz: 22a63347cdaf4805348e26ce9f117c8e7e5955de73dc7a14f47aebc8723dcef2
3
+ metadata.gz: 1304c0985b95c7d97ec6946b7db2cba4aa6ff9c9cd94d42b5235ecfff87df984
4
+ data.tar.gz: a06bdab53e17c60fdb793cd65bd4ccc66f07eec005a36049566d51913352672b
5
5
  SHA512:
6
- metadata.gz: d84de4b0a827f9e6f87f4e4028d81c5267ebcfad34e3393834f6865e7368deafef81778ab42a27da5c39ebd1294e0ee78c06064e8386f55c91e0977df32bd812
7
- data.tar.gz: 9694b9b4002a6c33906115f5d098241a6605d3b86dbcb6e30a8a9de7e0a1a78addc518fd48a5e4f3752c83eecc011627c56f585169315df92859b45b28d34b89
6
+ metadata.gz: 0645f429cf77724cebe323c67cfbb99c9da602eee2f1c66df4de8c80207a5740bf555842f79bc0a74c56eb40328af2780b9f7dab3ccf81dea37ac7b72807b63d
7
+ data.tar.gz: ad960c79b67b759d1e25d9a4d61fd8edb87ff08ea5f08b82fc29c1bc7d3f06d14bf80b390739226362015dd3c6fe540432cf8f6971b9a314a4806a7099f3ea93
@@ -1,8 +1,10 @@
1
1
  module Account::DatesHelper
2
2
  # e.g. October 11, 2018
3
- def display_date(timestamp)
3
+ def display_date(timestamp, custom_date_format = nil)
4
4
  return nil unless timestamp
5
- if local_time(timestamp).year == local_time(Time.now).year
5
+ if custom_date_format
6
+ local_time(timestamp).strftime(custom_date_format)
7
+ elsif local_time(timestamp).year == local_time(Time.now).year
6
8
  local_time(timestamp).strftime("%B %-d")
7
9
  else
8
10
  local_time(timestamp).strftime("%B %-d, %Y")
@@ -12,23 +14,23 @@ module Account::DatesHelper
12
14
  # e.g. October 11, 2018 at 4:22 PM
13
15
  # e.g. Yesterday at 2:12 PM
14
16
  # e.g. April 24 at 7:39 AM
15
- def display_date_and_time(timestamp)
17
+ def display_date_and_time(timestamp, custom_date_format = nil, custom_time_format = nil)
16
18
  return nil unless timestamp
17
19
 
18
20
  # today?
19
21
  if local_time(timestamp).to_date == local_time(Time.now).to_date
20
- "Today at #{display_time(timestamp)}"
22
+ "Today at #{display_time(timestamp, custom_time_format)}"
21
23
  # yesterday?
22
24
  elsif (local_time(timestamp).to_date) == (local_time(Time.now).to_date - 1.day)
23
- "Yesterday at #{display_time(timestamp)}"
25
+ "Yesterday at #{display_time(timestamp, custom_time_format)}"
24
26
  else
25
- "#{display_date(timestamp)} at #{display_time(timestamp)}"
27
+ "#{display_date(timestamp, custom_date_format)} at #{display_time(timestamp, custom_time_format)}"
26
28
  end
27
29
  end
28
30
 
29
31
  # e.g. 4:22 PM
30
- def display_time(timestamp)
31
- local_time(timestamp).strftime("%l:%M %p")
32
+ def display_time(timestamp, custom_time_format = nil)
33
+ local_time(timestamp).strftime(custom_time_format || "%l:%M %p")
32
34
  end
33
35
 
34
36
  def local_time(time)
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.0.75"
2
+ VERSION = "1.0.76"
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.0.75
4
+ version: 1.0.76
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-10 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard