latias-date-format 0.1.5 → 0.1.9

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: a95218e3dd319210d06465141eb38569dc3049913108887577bbc9c8cba8bd8f
4
- data.tar.gz: d1e053c8a47b45dc5f02c0c1ea15a1951d69836c1a47bd8b117123984ad79e58
3
+ metadata.gz: 6d2ded17d209a668383b914a43ab37f7c4eca66437840e2f3523d439a1d85526
4
+ data.tar.gz: f44a6ce1c2b9a75f6f83aee6599b7b9a335e60249cff48ee4ab6279f3e3fb905
5
5
  SHA512:
6
- metadata.gz: '0319448727f15b12f6d8afad338475ce07d8a7fc0d3608ab500b5aff5a8df5162e541a75f34d63c45f1108d77baa037989425daaad66df087f157d6ac91878b4'
7
- data.tar.gz: a529692281f9cd5a2758c73e3a0671486209ffb3632f3613abc5f3affab33735643c7f0a15ce91b7e33ed77d32a24877ff5e5ea9f39fcf33f9cb1cc87771eeff
6
+ metadata.gz: 959bcc5bcc56b92ff7cd7f43a1c8f3b026d46e0c73d1cd09bc76f13325e70db09fe4db72fc4f8c2518106705baa4b8869ce095ade566c8524f5496a772faaa11
7
+ data.tar.gz: 0666575a5deaee8d896d5d0dac9a2f1088fc0af6e8e5cdcf408169e99d1e82d2cc9c76060f3189035c559e671e3ecb1fc808ab562eee14c4eb7c786be41bfaed
data/README.md CHANGED
@@ -1,10 +1,19 @@
1
+ <!--
2
+ how to update
3
+ gem build latias-date-format.gemspec
4
+ gem push latias-date-format-0.1.6.gem
5
+ -->
6
+
1
7
  # Latias::Date::Format
8
+
2
9
  Short description and motivation.
3
10
 
4
11
  ## Usage
12
+
5
13
  How to use my plugin.
6
14
 
7
15
  ## Installation
16
+
8
17
  Add this line to your application's Gemfile:
9
18
 
10
19
  ```ruby
@@ -14,6 +23,28 @@ gem 'latias-date-format', '~> 0.1', git: 'https://nattanon:dT1Lcvf8pvGoU7LX4Uqr@
14
23
  ```
15
24
 
16
25
  ## Examples
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
+
17
48
  ```ruby
18
49
  2.6.5 :001 > buddist_date_format(Date.today) # Date
19
50
  => "15 มกราคม 2564"
@@ -27,8 +58,16 @@ gem 'latias-date-format', '~> 0.1', git: 'https://nattanon:dT1Lcvf8pvGoU7LX4Uqr@
27
58
  => "ม.ค. 2564 17:20:23 +0700"
28
59
  ```
29
60
 
61
+ ### Manual
62
+
63
+ ```ruby
64
+ include Latias::Date::Formater
65
+ ```
66
+
30
67
  ## Contributing
68
+
31
69
  Contribution directions go here.
32
70
 
33
71
  ## License
72
+
34
73
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,24 @@
1
+ {
2
+ th: {
3
+ date: {
4
+ formats: {
5
+ default: ->(date) { "%-d %B #{date.year + 543}" },
6
+ full: ->(date) { "%A %-d %B #{date.year + 543}" },
7
+ short: ->(date) { "%B #{date.year + 543}" },
8
+ month: ->(_date) { '%B' },
9
+ year: ->(date) { date.year + 543 }
10
+ }
11
+ },
12
+ time_with_zone: {
13
+ formats: {
14
+ default: ->(time) { "%d %B #{time.year + 543} %H:%M:%S" }
15
+ }
16
+ },
17
+ time: {
18
+ formats: {
19
+ default: ->(time) { "%d %B #{time.year + 543} %H:%M:%S" },
20
+ full: ->(time) { "%A %d %B #{time.year + 543} %H:%M:%S" }
21
+ }
22
+ }
23
+ }
24
+ }
@@ -29,4 +29,4 @@ th:
29
29
  - พฤศจิกายน
30
30
  - ธันวาคม
31
31
  day_names: [อาทิตย์, จันทร์, อังคาร, พุธ, พฤหัสบดี, ศุกร์, เสาร์]
32
- abbr_day_names: [อา., จ., อ., พ., พฤ., ศ., ส.]
32
+ abbr_day_names: [อา., จ., อ., พ., พฤ., ศ., ส.]
@@ -8,7 +8,6 @@ module Latias
8
8
  # ActionController::Base.include Latias::Date::Format
9
9
  ActionView::Base.include Latias::Date::Formater
10
10
  ActiveSupport.on_load(:action_controller_base) do
11
- puts 'include Latias::Date::Formater'
12
11
  include Latias::Date::Formater
13
12
  end
14
13
  end
@@ -1,7 +1,7 @@
1
1
  module Latias
2
2
  module Date
3
3
  module Format
4
- VERSION = '0.1.5'.freeze
4
+ VERSION = '0.1.9'.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.5
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - nattanon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-05 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