latias-date-format 0.1.7 → 0.1.8

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: 3ca7372c40ccda674af94b029713832347875ff8e1593258736919d396e2b8cb
4
- data.tar.gz: 4925ae99610072c7cd1a55cf5f70666298be3004fa7b6431e9daf1d104f700f2
3
+ metadata.gz: cf33d28866340d27a537043b57b7cd65b65c4b4f264c7ff6c306f7c91eba1bcd
4
+ data.tar.gz: 987e27304adff1009b6de738bfb06909d93c23e37fb1b843ac22d0e57a24dda6
5
5
  SHA512:
6
- metadata.gz: c3b567559a2e1e0c9c04a37927298360b5e7822617bbb4468000dd71627a8c3777cc0c4dff84301f4a31d231ffec8543832edb080b728f2c586921650fafb65b
7
- data.tar.gz: cb57d483061e6ee788ef5cd190ece7262280c37cd1f92ac4024846c901476760839769a40f3b8064bf83b93595ff314aa349bc3cc61ae4ffb8e73fae6b56c7ce
6
+ metadata.gz: ebbf0639729f3b07eeba1256397bb3320c515152d4afd79f03ea129c238c74e8dc52a03d5ec856d1f9c1296a9d3e1cad5a8c266d7766311755dbcc462fc56618
7
+ data.tar.gz: d3492bd9425d5c779c9a5829a4b18155f26db823dc8d509f51de62081db5e89e7d38040622ee14037a6aabb3e206818ed77bd4384026baae832f992b3f018add
data/README.md CHANGED
@@ -24,6 +24,27 @@ gem 'latias-date-format', '~> 0.1', git: 'https://nattanon:dT1Lcvf8pvGoU7LX4Uqr@
24
24
 
25
25
  ## Examples
26
26
 
27
+ #### with I18n
28
+
29
+ ```ruby
30
+ 3.0.1 :001 > I18n.l(date) # Date
31
+ => "25 สิงหาคม 2564"
32
+ 3.0.1 :002 > I18n.l(date, format: :full) # Date
33
+ => "พุธ 25 สิงหาคม 2564"
34
+ 3.0.1 :003 > I18n.l(date, format: :short) # Date
35
+ => "สิงหาคม 2564"
36
+ 3.0.1 :004 > I18n.l(date, format: :month) # Date
37
+ => "สิงหาคม"
38
+ 3.0.1 :005 > I18n.l(date, format: :year) # Date
39
+ => "2564"
40
+ 3.0.1 :006 > I18n.l(time) # DateTime
41
+ => "25 สิงหาคม 2564 20:15:44"
42
+ 3.0.1 :007 > I18n.l(time, format: :full) # DateTime
43
+ => "พุธ 25 สิงหาคม 2564 20:15:44"
44
+ ```
45
+
46
+ ### with function
47
+
27
48
  ```ruby
28
49
  2.6.5 :001 > buddist_date_format(Date.today) # Date
29
50
  => "15 มกราคม 2564"
@@ -0,0 +1,22 @@
1
+ {
2
+ th: {
3
+ date: {
4
+ formats: {
5
+ default: ->(date) { "%-d %B #{date.year + 543}" },
6
+ short: ->(date) { "%B #{date.year + 543}" },
7
+ month: ->(_date) { '%B' },
8
+ year: ->(date) { date.year + 543 }
9
+ }
10
+ },
11
+ time_with_zone: {
12
+ formats: {
13
+ default: ->(time) { "%d %B #{time.year + 543} %H:%M:%S" }
14
+ }
15
+ },
16
+ time: {
17
+ formats: {
18
+ default: ->(time) { "%d %B #{time.year + 543} %H:%M:%S" }
19
+ }
20
+ }
21
+ }
22
+ }
@@ -29,4 +29,4 @@ th:
29
29
  - พฤศจิกายน
30
30
  - ธันวาคม
31
31
  day_names: [อาทิตย์, จันทร์, อังคาร, พุธ, พฤหัสบดี, ศุกร์, เสาร์]
32
- abbr_day_names: [อา., จ., อ., พ., พฤ., ศ., ส.]
32
+ abbr_day_names: [อา., จ., อ., พ., พฤ., ศ., ส.]
@@ -1,7 +1,7 @@
1
1
  module Latias
2
2
  module Date
3
3
  module Format
4
- VERSION = '0.1.7'.freeze
4
+ VERSION = '0.1.8'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: latias-date-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - nattanon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-08 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -42,6 +42,7 @@ files:
42
42
  - app/mailers/latias/date/format/application_mailer.rb
43
43
  - app/models/latias/date/format/application_record.rb
44
44
  - app/views/layouts/latias/date/format/application.html.erb
45
+ - config/locales/th.rb
45
46
  - config/locales/th.yml
46
47
  - config/routes.rb
47
48
  - lib/latias/date/format.rb