-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inclusive dates #29
Comments
Hi @Zeeshan-Siddhu will you be able to share with me an example with the expected output? You want to calculate the time difference in a single timezone, UTC for instance. Depending on your use case, a slight margin of error won't be a problem. |
Hi @tmlee I'm currently working on the issues raised above too (along with more accurate depiction of months). There's two parts to this request, and I believe that they both stem from the use of Date as the originating part of the requests. InclusivityTime Differences are often used to calculate the period of time that is for what I would term "volumetric" purposes, such as a Billing use case. This is distinct from a relative distance purpose. For example:
To get around this you could pass to the query a start / finish combination that is not a date (which represents a discrete period of time with a rising edge, falling edge and duration) but rather an explicit point in time (a Time object). Timezone supportWhen working with time ranges across DST the number of seconds in the range is dependent on the TZ. # Returns the time in seconds
#
# @return
def time_in_seconds(time)
time.to_time.to_f
end Has no support to specify the timezone. Further, calling #to_time on a time object passed in will result in it using the locally set timezone. E.g. my timezone is 2.5.1 :001 > require './lib/time_difference'
=> true
2.5.1 :002 > Time.parse('2018-01-01T00:00:00+01:00')
=> 2018-01-01 00:00:00 +0100
2.5.1 :003 > Time.parse('2018-01-01T00:00:00+01:00').to_time
=> 2018-01-01 10:00:00 +1100 |
Can we use this gem when we want end date as inclusive? and does it handle the time zones and DST changes?? I want to use it as billing duration?
The text was updated successfully, but these errors were encountered: