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 +4 -4
- data/README.md +21 -0
- data/config/locales/th.rb +22 -0
- data/config/locales/th.yml +1 -1
- data/lib/latias/date/format/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf33d28866340d27a537043b57b7cd65b65c4b4f264c7ff6c306f7c91eba1bcd
|
|
4
|
+
data.tar.gz: 987e27304adff1009b6de738bfb06909d93c23e37fb1b843ac22d0e57a24dda6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
+
}
|
data/config/locales/th.yml
CHANGED
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
|
+
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-
|
|
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
|