active-icalendar-events 0.1.3 → 0.1.4

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: aec07e1857f72267287393b71a8d3cf600a8ad92814ef862c99b8693890e473e
4
- data.tar.gz: 95720ab414ecd1df386c6f7c1c9f7664313c1efb3437b65d464616c18c9b3a68
3
+ metadata.gz: ee9cc0c47ee4498afaf37e853db464fca142261bbf29aaa17439f66508c2610c
4
+ data.tar.gz: a3e5972072dbb410c1949cc2d53a7e7db741e55d9619ed628cc97c2ed2a3d1bf
5
5
  SHA512:
6
- metadata.gz: bf9a2bd544578257b52702aaaa71900116cf4a97ecc1b02e35a326d2550806350956fb4dcf17b5dd9e2ca66b8deef33e6a43197db8412a87198ba4f49aaaee76
7
- data.tar.gz: ca6940f8a84da10a6f2c9477ee525507a105b8691afabc3e113999ab2b3584ddb8a95f918109cc6018d440fee7375c28dbb78242e49820f554bdd4c7b1de63b3
6
+ metadata.gz: 4f9dbc20940280b719b5d4770e2e2de94544d5671a4b9aa1b6eceb41a126077d44e8d101eabd599f9885de7112d658000b199d8e305900d730b1f173565e94f8
7
+ data.tar.gz: f269876565330984d37d22c592dbef52102d774c387399698af734136347bb90387bea64a6dd25e6b0f64745a946e48d1efb593576966d31e7ec281d3e17cf34
@@ -251,6 +251,11 @@ module ActiveIcalendarEvents
251
251
  false
252
252
  end
253
253
 
254
+ # Get the beginning of the month, maintaining the timestamp
255
+ def beginning_of_month(datetime)
256
+ datetime - (datetime.day - 1).days
257
+ end
258
+
254
259
  def get_nth_day_in_month(datetime, day)
255
260
  matches = day.match /^([0-9]+)([A-Z]+)$/
256
261
  if matches.nil?
@@ -278,7 +283,7 @@ module ActiveIcalendarEvents
278
283
  raise RuntimeError, "Unexpected day code used"
279
284
  end
280
285
 
281
- target_day = datetime.beginning_of_month
286
+ target_day = beginning_of_month(datetime)
282
287
 
283
288
  if target_day.strftime("%^a").chop != day_code
284
289
  target_day = target_day.next_occurring(day_label)
@@ -326,7 +331,7 @@ module ActiveIcalendarEvents
326
331
  event_end_considered = event_end_considered + interval.month
327
332
  else
328
333
  event_start_considered =
329
- get_nth_day_in_month(event_start_considered.beginning_of_month + interval.month,
334
+ get_nth_day_in_month(beginning_of_month(event_start_considered) + interval.month,
330
335
  by_day.first)
331
336
  event_end_considered = event_start_considered + (event_end.to_time - event_start.to_time).seconds
332
337
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-icalendar-events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Starling