work_calendar 0.1.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +2 -2
- data/LICENSE.txt +1 -1
- data/README.md +9 -2
- data/lib/work_calendar/version.rb +1 -1
- data/lib/work_calendar.rb +57 -0
- metadata +3 -4
- data/work_calendar-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f66433c0f4ff9e22ecbc54a74a4c329ba40649a72e4a1cfeeeb643c92f606f28
|
4
|
+
data.tar.gz: 3ec2123e14ac3f60b18738546c2630e1c1c9f2154397d99826902d0a80e548e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 668d6439db8f984c36352908e5c2b030ca298eb3af6c94f772baf9d0f91fa3b1dd6db17fc73f94950e0376e4ea47100ee1fabcb42900c2069e0e0d93d619a386
|
7
|
+
data.tar.gz: 9a555ad38e58beb479b1907360e62aeda71fc005f168c2747802406f39b7580ad98717745c93d867b8798823a28baf7827a05788a39cddcb61d6018d45ed27b3
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2019
|
3
|
+
Copyright (c) 2019 Toughbyte Ltd
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -32,10 +32,17 @@ Get next `n`'th workday date relative to specified date; if no `date` parameter
|
|
32
32
|
WorkCalendar.next_workday(n, date)
|
33
33
|
```
|
34
34
|
|
35
|
-
|
35
|
+
Works same way as `next_workday` method, only looking backwards.
|
36
36
|
|
37
37
|
```ruby
|
38
|
-
WorkCalendar.prev_workday(date)
|
38
|
+
WorkCalendar.prev_workday(n, date)
|
39
|
+
```
|
40
|
+
|
41
|
+
Get first/last day since specified date
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
WorkCalendar.first_workday_since(date)
|
45
|
+
WorkCalendar.last_workday_since(date)
|
39
46
|
```
|
40
47
|
|
41
48
|
## License
|
data/lib/work_calendar.rb
CHANGED
@@ -47,6 +47,51 @@ module WorkCalendar
|
|
47
47
|
11 => {
|
48
48
|
holidays: [4]
|
49
49
|
}
|
50
|
+
},
|
51
|
+
2021 => {
|
52
|
+
1 => {
|
53
|
+
holidays: [1, 4, 5, 6, 7, 8]
|
54
|
+
},
|
55
|
+
2 => {
|
56
|
+
workdays: [20],
|
57
|
+
holidays: [22, 23]
|
58
|
+
},
|
59
|
+
3 => {
|
60
|
+
holidays: [8]
|
61
|
+
},
|
62
|
+
5 => {
|
63
|
+
holidays: [3, 10]
|
64
|
+
},
|
65
|
+
6 => {
|
66
|
+
holidays: [14]
|
67
|
+
},
|
68
|
+
11 => {
|
69
|
+
holidays: [4, 5]
|
70
|
+
},
|
71
|
+
12 => {
|
72
|
+
holidays: [31]
|
73
|
+
}
|
74
|
+
},
|
75
|
+
2022 => {
|
76
|
+
1 => {
|
77
|
+
holidays: [3, 4, 5, 6, 7]
|
78
|
+
},
|
79
|
+
2 => {
|
80
|
+
holidays: [23]
|
81
|
+
},
|
82
|
+
3 => {
|
83
|
+
workdays: [5],
|
84
|
+
holidays: [7, 8]
|
85
|
+
},
|
86
|
+
5 => {
|
87
|
+
holidays: [2, 3, 9, 10]
|
88
|
+
},
|
89
|
+
6 => {
|
90
|
+
holidays: [13]
|
91
|
+
},
|
92
|
+
11 => {
|
93
|
+
holidays: [4]
|
94
|
+
}
|
50
95
|
}
|
51
96
|
}.freeze
|
52
97
|
|
@@ -76,6 +121,18 @@ module WorkCalendar
|
|
76
121
|
date
|
77
122
|
end
|
78
123
|
|
124
|
+
def first_workday_since(date = Time.zone.today)
|
125
|
+
return date if workday?(date)
|
126
|
+
|
127
|
+
_next_workday(date)
|
128
|
+
end
|
129
|
+
|
130
|
+
def last_workday_since(date = Time.zone.today)
|
131
|
+
return date if workday?(date)
|
132
|
+
|
133
|
+
_prev_workday(date)
|
134
|
+
end
|
135
|
+
|
79
136
|
private
|
80
137
|
|
81
138
|
def _next_workday(date)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: work_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Korenyushkin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- bin/setup
|
115
115
|
- lib/work_calendar.rb
|
116
116
|
- lib/work_calendar/version.rb
|
117
|
-
- work_calendar-0.1.0.gem
|
118
117
|
- work_calendar.gemspec
|
119
118
|
homepage: https://github.com/toughbyte/work_calendar
|
120
119
|
licenses:
|
@@ -137,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
136
|
- !ruby/object:Gem::Version
|
138
137
|
version: '0'
|
139
138
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.2.22
|
141
140
|
signing_key:
|
142
141
|
specification_version: 4
|
143
142
|
summary: Workday calculator
|
data/work_calendar-0.1.0.gem
DELETED
Binary file
|