Date Counter to Epoch Time Array in Ruby
In this guide you will learn how to convert a hash of dates with count values into an array of epoch timestamps with date multiplied by its respective value.
Guide Tasks
  • Read Tutorial
  • Complete the Exercise

Summary

Build out a method that will use the hash_date_counter_converter(date_hash).

Exercise Description

"Define a method that will convert a hash of dates with count values into an array of epoch timestamps with date multiplied by it respective value."

Example Data

'date_hash = {
      (Date.new(2015, 10, 1)) => 2,
      (Date.new(2017, 07, 30)) => 1,
      (Date.new(2016, 03, 5)) => 1,
    }'
->  expect(hash_date_counter_converter(date_hash)).to eq(
      [1443657600, 1443657600, 1501372800, 1457136000]
    )

Real World Usage

This exercise will help you learn how to convert dates with count values into an array of epoch timestamps.

Test Cases

Code File