-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
Description
Example response from BBB (0.8) has this information:
<startTime>Mon Apr 09 17:40:55 YEKT 2012</startTime>but :startTime param will have this value:
1.9.3-p0 :023 > t=$bigbluebutton_api.get_recordings(:meetingID=>meeting.id)[:recordings][0][:startTime]
=> Mon, 09 Apr 2012 17:40:55 +0000I wrote small monkey patch for this issue:
module BigBlueButton
class BigBlueButtonFormatter
# converts a value in the @hash to DateTime
def to_datetime(key)
unless @hash.has_key?(key) and @hash[key]
nil
else
# BBB >= 0.8 uses the unix epoch for all time related values
# older versions use strings
# a number but in a String class
if (@hash[key].class == String && @hash[key].to_i.to_s == @hash[key])
value = @hash[key].to_i
else
value = @hash[key]
end
if value.is_a?(Numeric)
result = value == 0 ? nil : DateTime.parse(Time.at(value/1000.0).to_s)
else
if value.downcase == "null"
result = nil
else
result = Time.parse(value).to_datetime #this line has been changed
end
end
@hash[key] = result
end
end
end
endAnd now:
1.9.3-p0 :002 > t=$bigbluebutton_api.get_recordings(:meetingID=>meeting.id)[:recordings][0][:startTime]
=> Mon, 09 Apr 2012 17:40:55 +0600