decentworks-date-support 0.1.0
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 +7 -0
- data/.gem_rbs_collection/actionpack/7.2/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/actionpack/7.2/actioncontroller-7.2.rbs +14 -0
- data/.gem_rbs_collection/actionpack/7.2/actioncontroller.rbs +290 -0
- data/.gem_rbs_collection/actionpack/7.2/actiondispatch.rbs +349 -0
- data/.gem_rbs_collection/actionpack/7.2/actionpack-generated.rbs +11497 -0
- data/.gem_rbs_collection/actionpack/7.2/patch.rbs +77 -0
- data/.gem_rbs_collection/actionview/6.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/actionview/6.0/actionview-generated.rbs +8976 -0
- data/.gem_rbs_collection/actionview/6.0/actionview.rbs +1940 -0
- data/.gem_rbs_collection/actionview/6.0/patch.rbs +57 -0
- data/.gem_rbs_collection/activesupport/7.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/activesupport/7.0/activesupport-7.0.rbs +381 -0
- data/.gem_rbs_collection/activesupport/7.0/activesupport-generated.rbs +11633 -0
- data/.gem_rbs_collection/activesupport/7.0/activesupport.rbs +724 -0
- data/.gem_rbs_collection/activesupport/7.0/manifest.yaml +15 -0
- data/.gem_rbs_collection/activesupport/7.0/patch.rbs +55 -0
- data/.gem_rbs_collection/ast/2.4/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/ast/2.4/ast.rbs +73 -0
- data/.gem_rbs_collection/cgi/0.5/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/cgi/0.5/core.rbs +925 -0
- data/.gem_rbs_collection/cgi/0.5/manifest.yaml +3 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/array.rbs +4 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/atomic_reference.rbs +16 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/executor.rbs +96 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/hash.rbs +4 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/map.rbs +68 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/promises.rbs +249 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/set.rbs +4 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/timer_task.rbs +47 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs +5 -0
- data/.gem_rbs_collection/connection_pool/2.4/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/connection_pool/2.4/connection_pool.rbs +34 -0
- data/.gem_rbs_collection/connection_pool/2.4/manifest.yaml +2 -0
- data/.gem_rbs_collection/diff-lcs/1.5/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/diff-lcs/1.5/diff-lcs.rbs +11 -0
- data/.gem_rbs_collection/faker/3.4.2/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/faker/3.4.2/faker-2.23.rbs +90 -0
- data/.gem_rbs_collection/faker/3.4.2/faker.rbs +18 -0
- data/.gem_rbs_collection/i18n/1.10/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/i18n/1.10/backend.rbs +274 -0
- data/.gem_rbs_collection/i18n/1.10/i18n.rbs +116 -0
- data/.gem_rbs_collection/lint_roller/1.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/lint_roller/1.1/lint_roller.rbs +48 -0
- data/.gem_rbs_collection/minitest/5.25/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/abstract_reporter.rbs +52 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/assertion.rbs +17 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/assertions.rbs +590 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/backtrace_filter.rbs +23 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/bench_spec.rbs +102 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/benchmark.rbs +259 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/composite_reporter.rbs +25 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/compress.rbs +13 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/error_on_warning.rbs +3 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/expectation.rbs +2 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/expectations.rbs +21 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/guard.rbs +64 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/mock.rbs +64 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/executor.rbs +46 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/test/class_methods.rbs +5 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/test.rbs +3 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel.rbs +2 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/pride_io.rbs +62 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/pride_lol.rbs +19 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/progress_reporter.rbs +11 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/reportable.rbs +53 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/reporter.rbs +5 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/result.rbs +28 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/runnable.rbs +163 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/skip.rbs +6 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/spec/dsl/instance_methods.rbs +48 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/spec/dsl.rbs +129 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/spec.rbs +11 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/statistics_reporter.rbs +81 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/summary_reporter.rbs +18 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/test/lifecycle_hooks.rbs +92 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/test.rbs +69 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/unexpected_error.rbs +12 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/unexpected_warning.rbs +6 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/unit/test_case.rbs +3 -0
- data/.gem_rbs_collection/minitest/5.25/minitest/unit.rbs +4 -0
- data/.gem_rbs_collection/minitest/5.25/minitest.rbs +115 -0
- data/.gem_rbs_collection/nokogiri/1.11/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/nokogiri/1.11/nokogiri.rbs +2332 -0
- data/.gem_rbs_collection/nokogiri/1.11/patch.rbs +4 -0
- data/.gem_rbs_collection/parallel/1.20/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/parallel/1.20/parallel.rbs +86 -0
- data/.gem_rbs_collection/parser/3.2/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/parser/3.2/manifest.yaml +7 -0
- data/.gem_rbs_collection/parser/3.2/parser.rbs +194 -0
- data/.gem_rbs_collection/parser/3.2/polyfill.rbs +4 -0
- data/.gem_rbs_collection/rack/2.2/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rack/2.2/manifest.yaml +3 -0
- data/.gem_rbs_collection/rack/2.2/rack.rbs +1480 -0
- data/.gem_rbs_collection/rails-dom-testing/2.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rails-dom-testing/2.0/rails-dom-testing.rbs +51 -0
- data/.gem_rbs_collection/rails-html-sanitizer/1.6/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rails-html-sanitizer/1.6/rails-html-sanitizer.rbs +53 -0
- data/.gem_rbs_collection/railties/6.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/railties/6.0/manifest.yaml +2 -0
- data/.gem_rbs_collection/railties/6.0/patch.rbs +17 -0
- data/.gem_rbs_collection/railties/6.0/railties-generated.rbs +4822 -0
- data/.gem_rbs_collection/railties/6.0/railties.rbs +44 -0
- data/.gem_rbs_collection/rainbow/3.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rainbow/3.0/global.rbs +7 -0
- data/.gem_rbs_collection/rainbow/3.0/presenter.rbs +209 -0
- data/.gem_rbs_collection/rainbow/3.0/rainbow.rbs +5 -0
- data/.gem_rbs_collection/rake/13.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rake/13.0/manifest.yaml +2 -0
- data/.gem_rbs_collection/rake/13.0/rake.rbs +39 -0
- data/.gem_rbs_collection/regexp_parser/2.8/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/regexp_parser/2.8/regexp_parser.rbs +17 -0
- data/.gem_rbs_collection/rubocop/1.57/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rubocop/1.57/rubocop.rbs +208 -0
- data/.gem_rbs_collection/rubocop-ast/1.46/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rubocop-ast/1.46/rubocop-ast.rbs +903 -0
- data/.gem_rbs_collection/thor/1.2/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/thor/1.2/thor.rbs +62 -0
- data/.gem_rbs_collection/tzinfo/2.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/tzinfo/2.0/manifest.yaml +7 -0
- data/.gem_rbs_collection/tzinfo/2.0/tzinfo.rbs +600 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +12 -0
- data/Steepfile +43 -0
- data/lib/decentworks/active_support/time_with_zone_support.rb +327 -0
- data/lib/decentworks/date/support/version.rb +9 -0
- data/lib/decentworks/date_support.rb +323 -0
- data/lib/decentworks_date_support.rb +4 -0
- data/rbs_collection.lock.yaml +288 -0
- data/rbs_collection.yaml +41 -0
- data/sig/decentworks/active_support/time_with_zone_support.rbs +109 -0
- data/sig/decentworks/date/support.rbs +8 -0
- data/sig/decentworks/date_support.rbs +107 -0
- metadata +197 -0
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official email address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
[INSERT CONTACT METHOD].
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
|
86
|
+
actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
+
ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
+
community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.1, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
+
|
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
+
|
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 yutaka.mizomoto
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 YutakaMizomoto
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Decentworks::Date::Support - 日付機能拡張ライブラリ
|
|
2
|
+
|
|
3
|
+
## 概要
|
|
4
|
+
|
|
5
|
+
Railsの`Date`、`ActiveSupport::TimeWithZone`に対する機能拡張を行います。
|
|
6
|
+
|
|
7
|
+
## 機能
|
|
8
|
+
|
|
9
|
+
### 週関係
|
|
10
|
+
|
|
11
|
+
- 週の始まりの曜日を指定しての日付・期間の取得
|
|
12
|
+
|
|
13
|
+
### 月関係
|
|
14
|
+
|
|
15
|
+
- Nヶ月前、Nヶ月後の日付の取得メソッドの追加
|
|
16
|
+
- 暦月の日付・期間の取得メソッドの追加
|
|
17
|
+
|
|
18
|
+
### 四半期関係
|
|
19
|
+
|
|
20
|
+
- 第1四半期〜第4四半期の日付・期間の取得メソッドの追加
|
|
21
|
+
|
|
22
|
+
### 上下期関係
|
|
23
|
+
|
|
24
|
+
- 上期〜下期の日付・期間の取得メソッドの追加
|
|
25
|
+
|
|
26
|
+
### その他
|
|
27
|
+
|
|
28
|
+
- 満経過月数の計算
|
|
29
|
+
|
|
30
|
+
## インストール
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
gem 'decentworks-date-support'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 使い方の例
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
require 'decentworks_date_support'
|
|
40
|
+
|
|
41
|
+
using ::Decentworks::DateSupport
|
|
42
|
+
|
|
43
|
+
d = ::Date.new(2026, 8, 5)
|
|
44
|
+
d.all_this_week(:sunday) # => ::Date.new(2026, 8, 2)..::Date.new(2026, 8, 8)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
require 'decentworks_date_support'
|
|
49
|
+
|
|
50
|
+
using ::Decentworks::ActiveSupport::TimeWithZoneSupport
|
|
51
|
+
|
|
52
|
+
d = ::Time.zone.local(2026, 8, 5)
|
|
53
|
+
d.all_this_week(:sunday) # => ::Date.new(2026, 8, 2).beginning_of_day..::Date.new(2026, 8, 8).end_of_day
|
|
54
|
+
```
|
data/Rakefile
ADDED
data/Steepfile
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# D = Steep::Diagnostic
|
|
2
|
+
#
|
|
3
|
+
# target :lib do
|
|
4
|
+
# signature "sig"
|
|
5
|
+
# ignore_signature "sig/test"
|
|
6
|
+
#
|
|
7
|
+
# check "lib" # Directory name
|
|
8
|
+
# check "path/to/source.rb" # File name
|
|
9
|
+
# check "app/models/**/*.rb" # Glob
|
|
10
|
+
# # ignore "lib/templates/*.rb"
|
|
11
|
+
#
|
|
12
|
+
# # library "pathname" # Standard libraries
|
|
13
|
+
# # library "strong_json" # Gems
|
|
14
|
+
#
|
|
15
|
+
# # configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
|
|
16
|
+
# # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
|
|
17
|
+
# # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
|
|
18
|
+
# # configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
|
|
19
|
+
# # configure_code_diagnostics do |hash| # You can setup everything yourself
|
|
20
|
+
# # hash[D::Ruby::NoMethod] = :information
|
|
21
|
+
# # end
|
|
22
|
+
# end
|
|
23
|
+
|
|
24
|
+
# target :test do
|
|
25
|
+
# unreferenced! # Skip type checking the `lib` code when types in `test` target is changed
|
|
26
|
+
# signature "sig/test" # Put RBS files for tests under `sig/test`
|
|
27
|
+
# check "test" # Type check Ruby scripts under `test`
|
|
28
|
+
#
|
|
29
|
+
# configure_code_diagnostics(D::Ruby.lenient) # Weak type checking for test code
|
|
30
|
+
#
|
|
31
|
+
# # library "pathname" # Standard libraries
|
|
32
|
+
# end
|
|
33
|
+
|
|
34
|
+
target :lib do
|
|
35
|
+
# 型検査をしたいrubyファイルが格納されているディレクトリ名
|
|
36
|
+
check "lib"
|
|
37
|
+
|
|
38
|
+
# 型定義を記述するRBSファイルが格納されているディレクトリ名
|
|
39
|
+
signature "sig"
|
|
40
|
+
|
|
41
|
+
# 取り込みたいライブラリ
|
|
42
|
+
# library "pathname"
|
|
43
|
+
end
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "date"
|
|
4
|
+
require "decentworks/date_support"
|
|
5
|
+
|
|
6
|
+
module Decentworks
|
|
7
|
+
module ActiveSupport
|
|
8
|
+
module TimeWithZoneSupport
|
|
9
|
+
using ::Decentworks::DateSupport
|
|
10
|
+
|
|
11
|
+
refine ::ActiveSupport::TimeWithZone do
|
|
12
|
+
# #############################################################################################################
|
|
13
|
+
# 週関係
|
|
14
|
+
# #############################################################################################################
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# 今週
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
# 現在の日付が属する週の始まりの日付
|
|
21
|
+
#
|
|
22
|
+
# @param beginning_of_week 週の始まりの曜日。省略した場合は、config.beginning_of_weekの設定に従います。
|
|
23
|
+
def beginning_of_this_week(beginning_of_week = nil)
|
|
24
|
+
to_date # steep:ignore NoMethod
|
|
25
|
+
.beginning_of_this_week(beginning_of_week)
|
|
26
|
+
.beginning_of_day
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# 現在の日付が属する週の終わりの日付
|
|
30
|
+
#
|
|
31
|
+
# @param beginning_of_week 週の始まりの曜日。省略した場合は、config.beginning_of_weekの設定に従います。
|
|
32
|
+
def end_of_this_week(beginning_of_week = nil)
|
|
33
|
+
to_date # steep:ignore NoMethod
|
|
34
|
+
.next_week
|
|
35
|
+
.beginning_of_this_week(beginning_of_week)
|
|
36
|
+
.yesterday
|
|
37
|
+
.end_of_day
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# 今週の期間
|
|
41
|
+
#
|
|
42
|
+
# @param beginning_of_week 週の始まりの曜日。省略した場合は、config.beginning_of_weekの設定に従います。
|
|
43
|
+
def all_this_week(beginning_of_week = nil)
|
|
44
|
+
::Range.new(
|
|
45
|
+
beginning_of_this_week(beginning_of_week),
|
|
46
|
+
end_of_this_week(beginning_of_week)
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# #############################################################################################################
|
|
51
|
+
# 月関係
|
|
52
|
+
# #############################################################################################################
|
|
53
|
+
|
|
54
|
+
#
|
|
55
|
+
# 今月関係
|
|
56
|
+
#
|
|
57
|
+
|
|
58
|
+
# 現在の日付が属する月の期間
|
|
59
|
+
def all_this_month = ::Range.new(beginning_of_month, end_of_month) # steep:ignore NoMethod
|
|
60
|
+
|
|
61
|
+
#
|
|
62
|
+
# Nヶ月前関係
|
|
63
|
+
#
|
|
64
|
+
|
|
65
|
+
# 2ヶ月前の日付
|
|
66
|
+
def two_months_ago = months_ago(2) # steep:ignore NoMethod
|
|
67
|
+
|
|
68
|
+
# 3ヶ月前の日付
|
|
69
|
+
def three_months_ago = months_ago(3) # steep:ignore NoMethod
|
|
70
|
+
|
|
71
|
+
# 4ヶ月前の日付
|
|
72
|
+
def four_months_ago = months_ago(4) # steep:ignore NoMethod
|
|
73
|
+
|
|
74
|
+
# 5ヶ月前の日付
|
|
75
|
+
def five_months_ago = months_ago(5) # steep:ignore NoMethod
|
|
76
|
+
|
|
77
|
+
# 6ヶ月前の日付
|
|
78
|
+
def six_months_ago = months_ago(6) # steep:ignore NoMethod
|
|
79
|
+
|
|
80
|
+
# 半年前の日
|
|
81
|
+
alias_method :half_year_ago, :six_months_ago
|
|
82
|
+
|
|
83
|
+
# 7ヶ月前の日付
|
|
84
|
+
def seven_months_ago = months_ago(7) # steep:ignore NoMethod
|
|
85
|
+
|
|
86
|
+
# 8ヶ月前の日付
|
|
87
|
+
def eight_months_ago = months_ago(8) # steep:ignore NoMethod
|
|
88
|
+
|
|
89
|
+
# 9ヶ月前の日付
|
|
90
|
+
def nine_months_ago = months_ago(9) # steep:ignore NoMethod
|
|
91
|
+
|
|
92
|
+
# 10ヶ月前の日付
|
|
93
|
+
def ten_months_ago = months_ago(10) # steep:ignore NoMethod
|
|
94
|
+
|
|
95
|
+
# 11ヶ月前の日付
|
|
96
|
+
def eleven_months_ago = months_ago(11) # steep:ignore NoMethod
|
|
97
|
+
|
|
98
|
+
#
|
|
99
|
+
# Nヶ月後関係
|
|
100
|
+
#
|
|
101
|
+
|
|
102
|
+
# 2ヶ月後の日付
|
|
103
|
+
def two_months_since = months_since(2) # steep:ignore NoMethod
|
|
104
|
+
|
|
105
|
+
# 3ヶ月後の日付
|
|
106
|
+
def three_months_since = months_since(3) # steep:ignore NoMethod
|
|
107
|
+
|
|
108
|
+
# 4ヶ月後の日付
|
|
109
|
+
def four_months_since = months_since(4) # steep:ignore NoMethod
|
|
110
|
+
|
|
111
|
+
# 5ヶ月後の日付
|
|
112
|
+
def five_months_since = months_since(5) # steep:ignore NoMethod
|
|
113
|
+
|
|
114
|
+
# 6ヶ月後の日付
|
|
115
|
+
def six_months_since = months_since(6) # steep:ignore NoMethod
|
|
116
|
+
|
|
117
|
+
# 半年前の日
|
|
118
|
+
alias_method :half_year_since, :six_months_since
|
|
119
|
+
|
|
120
|
+
# 7ヶ月後の日付
|
|
121
|
+
def seven_months_since = months_since(7) # steep:ignore NoMethod
|
|
122
|
+
|
|
123
|
+
# 8ヶ月後の日付
|
|
124
|
+
def eight_months_since = months_since(8) # steep:ignore NoMethod
|
|
125
|
+
|
|
126
|
+
# 9ヶ月後の日付
|
|
127
|
+
def nine_months_since = months_since(9) # steep:ignore NoMethod
|
|
128
|
+
|
|
129
|
+
# 10ヶ月後の日付
|
|
130
|
+
def ten_months_since = months_since(10) # steep:ignore NoMethod
|
|
131
|
+
|
|
132
|
+
# 11ヶ月後の日付
|
|
133
|
+
def eleven_months_since = months_since(11) # steep:ignore NoMethod
|
|
134
|
+
|
|
135
|
+
#
|
|
136
|
+
# 暦月関係
|
|
137
|
+
#
|
|
138
|
+
|
|
139
|
+
# 1月の月初
|
|
140
|
+
def beginning_of_january = to_date.beginning_of_january.beginning_of_day # steep:ignore NoMethod
|
|
141
|
+
|
|
142
|
+
# 1月の月末
|
|
143
|
+
def end_of_january = beginning_of_january.end_of_month.end_of_day
|
|
144
|
+
|
|
145
|
+
# 1月の期間
|
|
146
|
+
def all_january = ::Range.new(beginning_of_january, end_of_january)
|
|
147
|
+
|
|
148
|
+
# 2月の月初
|
|
149
|
+
def beginning_of_february = to_date.beginning_of_february.beginning_of_day # steep:ignore NoMethod
|
|
150
|
+
|
|
151
|
+
# 2月の月末
|
|
152
|
+
def end_of_february = beginning_of_february.end_of_month.end_of_day
|
|
153
|
+
|
|
154
|
+
# 2月の期間
|
|
155
|
+
def all_february = ::Range.new(beginning_of_february, end_of_february)
|
|
156
|
+
|
|
157
|
+
# 3月の月初
|
|
158
|
+
def beginning_of_march = to_date.beginning_of_march.beginning_of_day # steep:ignore NoMethod
|
|
159
|
+
|
|
160
|
+
# 3月の月末
|
|
161
|
+
def end_of_march = beginning_of_march.end_of_month.end_of_day
|
|
162
|
+
|
|
163
|
+
# 3月の期間
|
|
164
|
+
def all_march = ::Range.new(beginning_of_march, end_of_march)
|
|
165
|
+
|
|
166
|
+
# 4月の月初
|
|
167
|
+
def beginning_of_april = to_date.beginning_of_april.beginning_of_day # steep:ignore NoMethod
|
|
168
|
+
|
|
169
|
+
# 4月の月末
|
|
170
|
+
def end_of_april = beginning_of_april.end_of_month.end_of_day
|
|
171
|
+
|
|
172
|
+
# 4月の期間
|
|
173
|
+
def all_april = ::Range.new(beginning_of_april, end_of_april)
|
|
174
|
+
|
|
175
|
+
# 5月の月初
|
|
176
|
+
def beginning_of_may = to_date.beginning_of_may.beginning_of_day # steep:ignore NoMethod
|
|
177
|
+
|
|
178
|
+
# 5月の月末
|
|
179
|
+
def end_of_may = beginning_of_may.end_of_month.end_of_day
|
|
180
|
+
|
|
181
|
+
# 5月の期間
|
|
182
|
+
def all_may = ::Range.new(beginning_of_may, end_of_may)
|
|
183
|
+
|
|
184
|
+
# 6月の月初
|
|
185
|
+
def beginning_of_june = to_date.beginning_of_june.beginning_of_day # steep:ignore NoMethod
|
|
186
|
+
|
|
187
|
+
# 6月の月末
|
|
188
|
+
def end_of_june = beginning_of_june.end_of_month.end_of_day
|
|
189
|
+
|
|
190
|
+
# 6月の期間
|
|
191
|
+
def all_june = ::Range.new(beginning_of_june, end_of_june)
|
|
192
|
+
|
|
193
|
+
# 7月の月初
|
|
194
|
+
def beginning_of_july = to_date.beginning_of_july.beginning_of_day # steep:ignore NoMethod
|
|
195
|
+
|
|
196
|
+
# 7月の月末
|
|
197
|
+
def end_of_july = beginning_of_july.end_of_month.end_of_day
|
|
198
|
+
|
|
199
|
+
# 7月の期間
|
|
200
|
+
def all_july = ::Range.new(beginning_of_july, end_of_july)
|
|
201
|
+
|
|
202
|
+
# 8月の月初
|
|
203
|
+
def beginning_of_august = to_date.beginning_of_august.beginning_of_day # steep:ignore NoMethod
|
|
204
|
+
|
|
205
|
+
# 8月の月末
|
|
206
|
+
def end_of_august = beginning_of_august.end_of_month.end_of_day
|
|
207
|
+
|
|
208
|
+
# 8月の期間
|
|
209
|
+
def all_august = ::Range.new(beginning_of_august, end_of_august)
|
|
210
|
+
|
|
211
|
+
# 9月の月初
|
|
212
|
+
def beginning_of_september = to_date.beginning_of_september.beginning_of_day # steep:ignore NoMethod
|
|
213
|
+
|
|
214
|
+
# 9月の月末
|
|
215
|
+
def end_of_september = beginning_of_september.end_of_month.end_of_day
|
|
216
|
+
|
|
217
|
+
# 9月の期間
|
|
218
|
+
def all_september = ::Range.new(beginning_of_september, end_of_september)
|
|
219
|
+
|
|
220
|
+
# 10月の月初
|
|
221
|
+
def beginning_of_october = to_date.beginning_of_october.beginning_of_day # steep:ignore NoMethod
|
|
222
|
+
|
|
223
|
+
# 10月の月末
|
|
224
|
+
def end_of_october = beginning_of_october.end_of_month.end_of_day
|
|
225
|
+
|
|
226
|
+
# 10月の期間
|
|
227
|
+
def all_october = ::Range.new(beginning_of_october, end_of_october)
|
|
228
|
+
|
|
229
|
+
# 11月の月初
|
|
230
|
+
def beginning_of_november = to_date.beginning_of_november.beginning_of_day # steep:ignore NoMethod
|
|
231
|
+
|
|
232
|
+
# 11月の月末
|
|
233
|
+
def end_of_november = beginning_of_november.end_of_month.end_of_day
|
|
234
|
+
|
|
235
|
+
# 11月の期間
|
|
236
|
+
def all_november = ::Range.new(beginning_of_november, end_of_november)
|
|
237
|
+
|
|
238
|
+
# 12月の月初
|
|
239
|
+
def beginning_of_december = to_date.beginning_of_december.beginning_of_day # steep:ignore NoMethod
|
|
240
|
+
|
|
241
|
+
# 12月の月末
|
|
242
|
+
def end_of_december = beginning_of_december.end_of_month.end_of_day
|
|
243
|
+
|
|
244
|
+
# 12月の期間
|
|
245
|
+
def all_december = ::Range.new(beginning_of_december, end_of_december)
|
|
246
|
+
|
|
247
|
+
# #############################################################################################################
|
|
248
|
+
# 四半期関係
|
|
249
|
+
# #############################################################################################################
|
|
250
|
+
|
|
251
|
+
# 第1四半期の始めの日付
|
|
252
|
+
alias_method :beginning_of_first_quarter, :beginning_of_january
|
|
253
|
+
|
|
254
|
+
# 第1四半期の終わりの日付
|
|
255
|
+
alias_method :end_of_first_quarter, :end_of_march
|
|
256
|
+
|
|
257
|
+
# 第1四半期の期間
|
|
258
|
+
def all_first_quarter = ::Range.new(beginning_of_first_quarter, end_of_first_quarter)
|
|
259
|
+
|
|
260
|
+
# 第2四半期の始めの日付
|
|
261
|
+
alias_method :beginning_of_second_quarter, :beginning_of_april
|
|
262
|
+
|
|
263
|
+
# 第2四半期の終わりの日付
|
|
264
|
+
alias_method :end_of_second_quarter, :end_of_june
|
|
265
|
+
|
|
266
|
+
# 第2四半期の期間
|
|
267
|
+
def all_second_quarter = ::Range.new(beginning_of_second_quarter, end_of_second_quarter)
|
|
268
|
+
|
|
269
|
+
# 第3四半期の始めの日付
|
|
270
|
+
alias_method :beginning_of_third_quarter, :beginning_of_july
|
|
271
|
+
|
|
272
|
+
# 第3四半期の終わりの日付
|
|
273
|
+
alias_method :end_of_third_quarter, :end_of_september
|
|
274
|
+
|
|
275
|
+
# 第3四半期の期間
|
|
276
|
+
def all_third_quarter = ::Range.new(beginning_of_third_quarter, end_of_third_quarter)
|
|
277
|
+
|
|
278
|
+
# 第4四半期の始めの日付
|
|
279
|
+
alias_method :beginning_of_fourth_quarter, :beginning_of_october
|
|
280
|
+
|
|
281
|
+
# 第4四半期の終わりの日付
|
|
282
|
+
alias_method :end_of_fourth_quarter, :end_of_december
|
|
283
|
+
|
|
284
|
+
# 第4四半期の期間
|
|
285
|
+
def all_fourth_quarter = ::Range.new(beginning_of_fourth_quarter, end_of_fourth_quarter)
|
|
286
|
+
|
|
287
|
+
# #############################################################################################################
|
|
288
|
+
# 上下期関係
|
|
289
|
+
# #############################################################################################################
|
|
290
|
+
|
|
291
|
+
# 上期の始まりの日付
|
|
292
|
+
alias_method :beginning_of_first_half, :beginning_of_first_quarter
|
|
293
|
+
|
|
294
|
+
# 上期の終わりの日付
|
|
295
|
+
alias_method :end_of_first_half, :end_of_second_quarter
|
|
296
|
+
|
|
297
|
+
# 上期の期間
|
|
298
|
+
def all_first_half = ::Range.new(beginning_of_first_half, end_of_first_half)
|
|
299
|
+
|
|
300
|
+
# 下期の始まりの日付
|
|
301
|
+
alias_method :beginning_of_second_half, :beginning_of_third_quarter
|
|
302
|
+
|
|
303
|
+
# 下期の終わりの日付
|
|
304
|
+
alias_method :end_of_second_half, :end_of_fourth_quarter
|
|
305
|
+
|
|
306
|
+
# 下期の期間
|
|
307
|
+
def all_second_half = ::Range.new(beginning_of_second_half, end_of_second_half)
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
refine ::ActiveSupport::TimeWithZone.singleton_class do
|
|
311
|
+
# #############################################################################################################
|
|
312
|
+
# 満経過月数
|
|
313
|
+
# #############################################################################################################
|
|
314
|
+
|
|
315
|
+
# 満経過月数
|
|
316
|
+
# steep:ignore:start
|
|
317
|
+
def whole_months_elapsed(from:, to:)
|
|
318
|
+
::Date.whole_months_elapsed(
|
|
319
|
+
from: from.to_date,
|
|
320
|
+
to: to.to_date
|
|
321
|
+
)
|
|
322
|
+
end
|
|
323
|
+
# steep:ignore:end
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
end
|