Sha256: ac97348e06030775ca89c31bd355561c49baacba73d012638374711606fc5777

Contents?: true

Size: 533 Bytes

Versions: 5

Compression:

Stored size: 533 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

5 entries across 5 versions & 1 rubygems

Version Path
toggl-jobcan-0.5.0 lib/toggl/jobcan/toggl_support.rb
toggl-jobcan-0.4.3 lib/toggl/jobcan/toggl_support.rb
toggl-jobcan-0.4.2 lib/toggl/jobcan/toggl_support.rb
toggl-jobcan-0.4.1 lib/toggl/jobcan/toggl_support.rb
toggl-jobcan-0.4.0 lib/toggl/jobcan/toggl_support.rb