Sha256: cce4fc89e2a4d28357edeff7e7b96d95e4f8bb3fa72a35db0fb107019e5b6b27

Contents?: true

Size: 532 Bytes

Versions: 3

Compression:

Stored size: 532 Bytes

Contents

# frozen_string_literal: true

module Toggl
  module Jobcan
    # Provides support methods for Toggl
    module TogglSupport
      def fetch_toggl_worktime(date)
        @toggl.merge!(date.year, date.month, date.day)
        @toggl.work_time
      end

      def toggl_time_format(date, timestamp)
        same_day = date == timestamp.to_date
        return timestamp.strftime('%H%M') if same_day
        hour = timestamp.hour + 24
        minute = timestamp.min
        format('%02d%02d', hour, minute)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
toggl-jobcan-0.3.1 lib/toggl/jobcan/toggl_support.rb
toggl-jobcan-0.3.0 lib/toggl/jobcan/toggl_support.rb
toggl-jobcan-0.2.0 lib/toggl/jobcan/toggl_support.rb