Skip to main content

Day 62: It's Monday, ok?

I'm getting tired of trying to figure out what day of quarantine it is, especially since I've been busy lately and haven't been getting around to posting my dailies until a day or two later. So here's some simple Ruby code to help figure out what day it is:

require 'date'

def what_day_is_it(arg)
  day_zero = Date.parse('2020-03-17')
  if arg.is_a?(Numeric)
    puts day_zero += arg
  elsif arg.is_a?(String)
    puts (Date.parse(arg) - day_zero).to_i
  end
end

Then if you want to know what day of quarantine is is/will be on a certain date you can do this:

what_day_is_it('2020-05-18')
  62

Or vice versa:

what_day_is_it(62)
  2020-05-18

Yes, yes, I know that I have way too many parentheses. I've been writing Python for the past few weeks, and switching back and forth is hard on my brain.

Comments

Popular posts from this blog

Day 91: Cleanliness

73. ✅  Clear out the flower bed in the front yard Two words: scorched earth. Garden hoe: loosen the dirt. (Broke that hoe.) Shovel: remove the dirt. Sieve: Filter out all the crap in the dirt. What was left was a smooth patch of barren soil. I'm sure there are undesirables lurking beneath the surface, so I'll let it lie for a few days before I do anything else with it. 51.  ✅  Deal with the shred pile This took days. I've been accumulating junk mail, old bills, and literally anything with my name, a family member's name, or our address on it for several months resulting in a two-foot tall stack of papers. It couldn't be done all at once, because (A) the shredder kept overheating, and (B) I kept running out of places to store the shreds. (They take up considerably more room than the unshredded sheets of paper.) 75  ✅  Clean off the workbench Getting rid of the shred pile was the main roadblock in completing this task, but it's done. And now there's a bike up ...