latias-date-format 0.1.4 → 0.1.8

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: 026f89820818af162c25d71f7b689199305cbb2f3fadc147b6c80ac87e4ea178
4
- data.tar.gz: f39ec7e4438e06d01e9500bf1bea42a843af960cd47df88aa00436d32921b6b2
3
+ metadata.gz: cf33d28866340d27a537043b57b7cd65b65c4b4f264c7ff6c306f7c91eba1bcd
4
+ data.tar.gz: 987e27304adff1009b6de738bfb06909d93c23e37fb1b843ac22d0e57a24dda6
5
5
  SHA512:
6
- metadata.gz: d5f72ad0db9c7d3d581e761121baf1bfca171901d48f75f0990a08ecee763bb539590d0ef60541735c4c6786cdb3b48f8e942e248e45663cd531a3f9cbded3d6
7
- data.tar.gz: d906bdf14e3af86f468b35940212eb4c8b21cf025a4ecee8336287c2a6248357b3fbe6f5d21df978ebf6d9d18f3fecdd925fbbef12ce75f91eb910150bc1927d
6
+ metadata.gz: ebbf0639729f3b07eeba1256397bb3320c515152d4afd79f03ea129c238c74e8dc52a03d5ec856d1f9c1296a9d3e1cad5a8c266d7766311755dbcc462fc56618
7
+ data.tar.gz: d3492bd9425d5c779c9a5829a4b18155f26db823dc8d509f51de62081db5e89e7d38040622ee14037a6aabb3e206818ed77bd4384026baae832f992b3f018add
data/README.md CHANGED
@@ -1,19 +1,50 @@
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
11
- gem 'latias-date-format', '~> 0.1.4'
20
+ gem 'latias-date-format', '~> 0.1'
12
21
  # or
13
22
  gem 'latias-date-format', '~> 0.1', git: 'https://nattanon:dT1Lcvf8pvGoU7LX4Uqr@gitlab.opensource-technology.com/nattanon/latias-date-format-rails.git'
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,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
+ }
@@ -27,4 +27,6 @@ th:
27
27
  - กันยายน
28
28
  - ตุลาคม
29
29
  - พฤศจิกายน
30
- - ธันวาคม
30
+ - ธันวาคม
31
+ 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.4'.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.4
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-02-02 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