latias-date-format 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +36 -0
- data/Rakefile +32 -0
- data/app/assets/config/latias_date_format_manifest.js +1 -0
- data/app/assets/stylesheets/latias/date/format/application.css +15 -0
- data/app/controllers/latias/date/format/application_controller.rb +9 -0
- data/app/helpers/latias/date/format/application_helper.rb +8 -0
- data/app/jobs/latias/date/format/application_job.rb +8 -0
- data/app/mailers/latias/date/format/application_mailer.rb +10 -0
- data/app/models/latias/date/format/application_record.rb +9 -0
- data/app/views/layouts/latias/date/format/application.html.erb +15 -0
- data/config/locales/th.yml +30 -0
- data/config/routes.rb +2 -0
- data/lib/latias/date/format.rb +19 -0
- data/lib/latias/date/format/engine.rb +9 -0
- data/lib/latias/date/format/version.rb +7 -0
- data/lib/tasks/latias/date/format_tasks.rake +4 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a3f5e69b2511ca44ede71a3ddc3c5a204e2346696696309ddfa38e985c275f09
|
4
|
+
data.tar.gz: f01602e9b487ee80b131d46f9965446eafc503483f1bf2acd601d39d599b065f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 689cc7bcbb3689a4150da250b9010f3561b5620f2d032ae7b10beee728c7da492d3f8df835d3f245b4d8ee10a39d5ab918a2d4ade68aed712e69ec44d0a676b4
|
7
|
+
data.tar.gz: 0772c36969372fa7c81ae1a14b54e42df61395367199c1eb226f1360b507fd2e17a8258b5f58afaf3fdcea495eb3be683456927555013740bf6302c992b56b91
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2021 nattanon
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Latias::Date::Format
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'latias-date-format', '0.1.1', git: 'https://nattanon:dT1Lcvf8pvGoU7LX4Uqr@gitlab.opensource-technology.com/nattanon/latias-date-format-rails.git'
|
12
|
+
```
|
13
|
+
|
14
|
+
## Examples
|
15
|
+
```ruby
|
16
|
+
include Latias::Date::Format
|
17
|
+
```
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
2.6.5 :001 > buddist_date_format(Date.today) # Date
|
21
|
+
=> "15 มกราคม 2564"
|
22
|
+
2.6.5 :002 > buddist_date_format(Date.today, format: "%d") # Date
|
23
|
+
=> "15"
|
24
|
+
2.6.5 :003 > buddist_date_format(Date.today, format: "%d %y") # Date
|
25
|
+
=> "15 64"
|
26
|
+
2.6.5 :004 > buddist_date_format(Date.today, format: "%d %Y") # Date
|
27
|
+
=> "15 2564"
|
28
|
+
2.6.5 :005 > buddist_date_format(DateTime.now(), format: "%b %Y %H:%M:%S %z") # DateTime
|
29
|
+
=> "ม.ค. 2564 17:20:23 +0700"
|
30
|
+
```
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
Contribution directions go here.
|
34
|
+
|
35
|
+
## License
|
36
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Latias::Date::Format'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/latias/date/format .css
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Latias date format</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag "latias/date/format/application", media: "all" %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<%= yield %>
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
th:
|
2
|
+
date:
|
3
|
+
abbr_month_names:
|
4
|
+
-
|
5
|
+
- ม.ค.
|
6
|
+
- ก.พ.
|
7
|
+
- มี.ค.
|
8
|
+
- เม.ย.
|
9
|
+
- พ.ค.
|
10
|
+
- มิ.ย.
|
11
|
+
- ก.ค.
|
12
|
+
- ส.ค.
|
13
|
+
- ก.ย.
|
14
|
+
- ต.ค.
|
15
|
+
- พ.ย.
|
16
|
+
- ธ.ค.
|
17
|
+
month_names:
|
18
|
+
-
|
19
|
+
- มกราคม
|
20
|
+
- กุมภาพันธ์
|
21
|
+
- มีนาคม
|
22
|
+
- เมษายน
|
23
|
+
- พฤษภาคม
|
24
|
+
- มิถุนายน
|
25
|
+
- กรกฎาคม
|
26
|
+
- สิงหาคม
|
27
|
+
- กันยายน
|
28
|
+
- ตุลาคม
|
29
|
+
- พฤศจิกายน
|
30
|
+
- ธันวาคม
|
data/config/routes.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'latias/date/format/engine'
|
2
|
+
|
3
|
+
module Latias
|
4
|
+
module Date
|
5
|
+
module Format
|
6
|
+
def buddist_date_format(date, format: '%e %B %Y')
|
7
|
+
format = format.gsub('%Y', buddhist_year(date.year).to_s)
|
8
|
+
format = format.gsub('%y', (buddhist_year(date.year) % 100).to_s)
|
9
|
+
I18n.l(date, format: format, locale: :th)
|
10
|
+
end
|
11
|
+
|
12
|
+
def buddhist_year(year)
|
13
|
+
year + 543
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
extend Latias::Date::Format
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: latias-date-format
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- nattanon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.1.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 6.1.1
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- nattanon@hospital-os.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/assets/config/latias_date_format_manifest.js
|
38
|
+
- app/assets/stylesheets/latias/date/format/application.css
|
39
|
+
- app/controllers/latias/date/format/application_controller.rb
|
40
|
+
- app/helpers/latias/date/format/application_helper.rb
|
41
|
+
- app/jobs/latias/date/format/application_job.rb
|
42
|
+
- app/mailers/latias/date/format/application_mailer.rb
|
43
|
+
- app/models/latias/date/format/application_record.rb
|
44
|
+
- app/views/layouts/latias/date/format/application.html.erb
|
45
|
+
- config/locales/th.yml
|
46
|
+
- config/routes.rb
|
47
|
+
- lib/latias/date/format.rb
|
48
|
+
- lib/latias/date/format/engine.rb
|
49
|
+
- lib/latias/date/format/version.rb
|
50
|
+
- lib/tasks/latias/date/format_tasks.rake
|
51
|
+
homepage: https://gitlab.opensource-technology.com/nattanon/latias-date-format-rails
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata:
|
55
|
+
source_code_uri: https://gitlab.opensource-technology.com/nattanon/latias-date-format-rails
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubygems_version: 3.2.6
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: Latias::Date::Format. in rails
|
75
|
+
test_files: []
|