rubyredrick-ri_cal 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +19 -2
- data/Manifest.txt +6 -3
- data/README.txt +130 -44
- data/Rakefile +1 -1
- data/copyrights.txt +1 -2
- data/lib/ri_cal/component/alarm.rb +1 -2
- data/lib/ri_cal/component/calendar.rb +25 -9
- data/lib/ri_cal/component/event.rb +1 -2
- data/lib/ri_cal/component/freebusy.rb +1 -2
- data/lib/ri_cal/component/journal.rb +1 -2
- data/lib/ri_cal/component/t_z_info_timezone.rb +1 -2
- data/lib/ri_cal/component/timezone/daylight_period.rb +1 -2
- data/lib/ri_cal/component/timezone/standard_period.rb +1 -2
- data/lib/ri_cal/component/timezone/timezone_period.rb +1 -2
- data/lib/ri_cal/component/timezone.rb +5 -2
- data/lib/ri_cal/component.rb +22 -7
- data/lib/ri_cal/core_extensions/date/conversions.rb +8 -7
- data/lib/ri_cal/core_extensions/date_time.rb +4 -2
- data/lib/ri_cal/core_extensions/object/conversions.rb +1 -1
- data/lib/ri_cal/core_extensions/string/conversions.rb +37 -6
- data/lib/ri_cal/core_extensions/time/conversions.rb +11 -7
- data/lib/ri_cal/core_extensions/time/tzid_access.rb +37 -0
- data/lib/ri_cal/core_extensions/time.rb +3 -1
- data/lib/ri_cal/floating_timezone.rb +32 -0
- data/lib/ri_cal/invalid_property_value.rb +8 -0
- data/lib/ri_cal/invalid_timezone_identifer.rb +2 -2
- data/lib/ri_cal/occurrence_enumerator.rb +5 -3
- data/lib/ri_cal/parser.rb +8 -8
- data/lib/ri_cal/properties/alarm.rb +8 -8
- data/lib/ri_cal/properties/event.rb +60 -60
- data/lib/ri_cal/properties/freebusy.rb +16 -16
- data/lib/ri_cal/properties/journal.rb +58 -58
- data/lib/ri_cal/properties/timezone_period.rb +23 -23
- data/lib/ri_cal/properties/todo.rb +63 -64
- data/lib/ri_cal/property_value/array.rb +10 -2
- data/lib/ri_cal/property_value/cal_address.rb +1 -2
- data/lib/ri_cal/property_value/date.rb +15 -3
- data/lib/ri_cal/property_value/date_time/additive_methods.rb +34 -33
- data/lib/ri_cal/property_value/date_time/time_machine.rb +175 -174
- data/lib/ri_cal/property_value/date_time/timezone_support.rb +70 -52
- data/lib/ri_cal/property_value/date_time.rb +47 -77
- data/lib/ri_cal/property_value/duration.rb +6 -3
- data/lib/ri_cal/property_value/geo.rb +1 -2
- data/lib/ri_cal/property_value/integer.rb +1 -2
- data/lib/ri_cal/property_value/occurrence_list.rb +79 -26
- data/lib/ri_cal/property_value/period.rb +23 -3
- data/lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/enumerator.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/numbered_span.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/validations.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule.rb +3 -4
- data/lib/ri_cal/property_value/text.rb +1 -2
- data/lib/ri_cal/property_value/uri.rb +1 -2
- data/lib/ri_cal/property_value/utc_offset.rb +1 -2
- data/lib/ri_cal/property_value.rb +42 -11
- data/lib/ri_cal/required_timezones.rb +1 -2
- data/lib/ri_cal.rb +1 -2
- data/ri_cal.gemspec +6 -4
- data/spec/ri_cal/component/alarm_spec.rb +1 -2
- data/spec/ri_cal/component/calendar_spec.rb +1 -2
- data/spec/ri_cal/component/event_spec.rb +168 -13
- data/spec/ri_cal/component/freebusy_spec.rb +1 -2
- data/spec/ri_cal/component/journal_spec.rb +1 -2
- data/spec/ri_cal/component/t_z_info_timezone_spec.rb +1 -2
- data/spec/ri_cal/component/timezone_spec.rb +1 -2
- data/spec/ri_cal/component/todo_spec.rb +4 -5
- data/spec/ri_cal/component_spec.rb +30 -18
- data/spec/ri_cal/core_extensions/string/conversions_spec.rb +78 -0
- data/spec/ri_cal/core_extensions/time/calculations_spec.rb +1 -2
- data/spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb +1 -2
- data/spec/ri_cal/occurrence_enumerator_spec.rb +23 -2
- data/spec/ri_cal/parser_spec.rb +6 -7
- data/spec/ri_cal/property_value/date_spec.rb +1 -2
- data/spec/ri_cal/property_value/date_time_spec.rb +54 -119
- data/spec/ri_cal/property_value/duration_spec.rb +12 -2
- data/spec/ri_cal/property_value/occurrence_list_spec.rb +67 -0
- data/spec/ri_cal/property_value/period_spec.rb +1 -2
- data/spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb +1 -2
- data/spec/ri_cal/property_value/recurrence_rule_spec.rb +1 -2
- data/spec/ri_cal/property_value/text_spec.rb +1 -2
- data/spec/ri_cal/property_value/utc_offset_spec.rb +1 -2
- data/spec/ri_cal/property_value_spec.rb +19 -8
- data/spec/ri_cal/required_timezones_spec.rb +1 -2
- data/spec/ri_cal_spec.rb +1 -2
- data/spec/spec_helper.rb +2 -7
- data/tasks/ri_cal.rake +20 -13
- data/tasks/spec.rake +1 -1
- metadata +8 -5
- data/lib/ri_cal/core_extensions/date_time/conversions.rb +0 -27
- data/lib/ri_cal/time_with_floating_timezone.rb +0 -59
@@ -1,179 +1,180 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
3
|
+
class DateTime
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
|
+
#
|
6
|
+
# Methods for DateTime which support getting values at different point in time.
|
7
|
+
module TimeMachine
|
8
|
+
def compute_change(d, options) # :nodoc:
|
9
|
+
::DateTime.civil(
|
10
|
+
options[:year] || d.year,
|
11
|
+
options[:month] || d.month,
|
12
|
+
options[:day] || d.day,
|
13
|
+
options[:hour] || d.hour,
|
14
|
+
options[:min] || (options[:hour] ? 0 : d.min),
|
15
|
+
options[:sec] || ((options[:hour] || options[:min]) ? 0 : d.sec),
|
16
|
+
options[:offset] || d.offset,
|
17
|
+
options[:start] || d.start
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def compute_advance(d, options) # :nodoc:
|
22
|
+
d = d >> options[:years] * 12 if options[:years]
|
23
|
+
d = d >> options[:months] if options[:months]
|
24
|
+
d = d + options[:weeks] * 7 if options[:weeks]
|
25
|
+
d = d + options[:days] if options[:days]
|
26
|
+
datetime_advanced_by_date = compute_change(@date_time_value, :year => d.year, :month => d.month, :day => d.day)
|
27
|
+
seconds_to_advance = (options[:seconds] || 0) + (options[:minutes] || 0) * 60 + (options[:hours] || 0) * 3600
|
28
|
+
seconds_to_advance == 0 ? datetime_advanced_by_date : datetime_advanced_by_date + Rational(seconds_to_advance.round, 86400)
|
29
|
+
end
|
30
|
+
|
31
|
+
def advance(options) # :nodoc:
|
32
|
+
PropertyValue::DateTime.new(timezone_finder,
|
33
|
+
:value => compute_advance(@date_time_value, options),
|
34
|
+
:tzid => @tzid,
|
35
|
+
:params =>(params ? params.dup : nil)
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def change(options) # :nodoc:
|
40
|
+
PropertyValue::DateTime.new(timezone_finder,
|
41
|
+
:value => compute_change(@date_time_value, options),
|
42
|
+
:tzid => @tzid,
|
43
|
+
:params => (params ? params.dup : nil)
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
def change_sec(new_sec) #:nodoc:
|
48
|
+
PropertyValue::DateTime.civil(self.year, self.month, self.day, self.hour, self.min, sec, self.offset, self.start, params)
|
49
|
+
end
|
50
|
+
|
51
|
+
def change_min(new_min) #:nodoc:
|
52
|
+
PropertyValue::DateTime.civil(self.year, self.month, self.day, self.hour, new_min, self.sec, self.offset, self.start, params)
|
53
|
+
end
|
54
|
+
|
55
|
+
def change_hour(new_hour) #:nodoc:
|
56
|
+
PropertyValue::DateTime.civil(self.year, self.month, self.day, new_hour, self.min, self.sec, self.offset, self.start, params)
|
57
|
+
end
|
58
|
+
|
59
|
+
def change_day(new_day) #:nodoc:
|
60
|
+
PropertyValue::DateTime.civil(self.year, self.month, new_day, self.hour, self.min, self.sec, self.offset, self.start, params)
|
61
|
+
end
|
62
|
+
|
63
|
+
def change_month(new_month) #:nodoc:
|
64
|
+
PropertyValue::DateTime.civil(self.year, new_month, self.day, self.hour, self.min, self.sec, self.offset, self.start, params)
|
65
|
+
end
|
66
|
+
|
67
|
+
def change_year(new_year) #:nodoc:
|
68
|
+
PropertyValue::DateTime.civil(new_year, self.month, self.day, self.hour, self.min, self.sec, self.offset, self.start, params)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Return a DATE-TIME property representing the receiver on a different day (if necessary) so that
|
72
|
+
# the result is within the 7 days starting with date
|
73
|
+
def in_week_starting?(date)
|
74
|
+
wkst_jd = date.jd
|
75
|
+
@date_time_value.jd.between?(wkst_jd, wkst_jd + 6)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Return a DATE-TIME property representing the receiver on a different day (if necessary) so that
|
79
|
+
# the result is the first day of the ISO week starting on the wkst day containing the receiver.
|
80
|
+
def at_start_of_week_with_wkst(wkst)
|
81
|
+
date = @date_time_value.start_of_week_with_wkst(wkst)
|
82
|
+
change(:year => date.year, :month => date.month, :day => date.day)
|
83
|
+
end
|
84
|
+
# Return a DATE_TIME value representing the first second of the minute containing the receiver
|
85
|
+
def start_of_minute
|
86
|
+
change(:sec => 0)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Return a DATE_TIME value representing the last second of the minute containing the receiver
|
90
|
+
def end_of_minute
|
91
|
+
change(:sec => 59)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Return a DATE_TIME value representing the first second of the hour containing the receiver
|
95
|
+
def start_of_hour
|
96
|
+
change(:min => 0, :sec => 0)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Return a DATE_TIME value representing the last second of the hour containing the receiver
|
100
|
+
def end_of_hour
|
101
|
+
change(:min => 59, :sec => 59)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Return a DATE_TIME value representing the first second of the day containing the receiver
|
105
|
+
def start_of_day
|
106
|
+
change(:hour => 0, :min => 0, :sec => 0)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Return a DATE_TIME value representing the last second of the day containing the receiver
|
110
|
+
def end_of_day
|
111
|
+
change(:hour => 23, :min => 59, :sec => 59)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Return a Ruby Date representing the first day of the ISO week starting with wkst containing the receiver
|
115
|
+
def start_of_week_with_wkst(wkst)
|
116
|
+
@date_time_value.start_of_week_with_wkst(wkst)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Return a DATE_TIME value representing the last second of the ISO week starting with wkst containing the receiver
|
120
|
+
def end_of_week_with_wkst(wkst)
|
121
|
+
date = at_start_of_week_with_wkst(wkst).advance(:days => 6).end_of_day
|
122
|
+
end
|
123
|
+
|
124
|
+
# Return a DATE_TIME value representing the first second of the month containing the receiver
|
125
|
+
def start_of_month
|
126
|
+
change(:day => 1, :hour => 0, :min => 0, :sec => 0)
|
127
|
+
end
|
128
|
+
|
129
|
+
# Return a DATE_TIME value representing the last second of the month containing the receiver
|
130
|
+
def end_of_month
|
131
|
+
change(:day => days_in_month, :hour => 23, :min => 59, :sec => 59)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Return a DATE_TIME value representing the first second of the month containing the receiver
|
135
|
+
def start_of_year
|
136
|
+
change(:month => 1, :day => 1, :hour => 0, :min => 0, :sec => 0)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Return a DATE_TIME value representing the last second of the month containing the receiver
|
140
|
+
def end_of_year
|
141
|
+
change(:month => 12, :day => 31, :hour => 23, :min => 59, :sec => 59)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Return a DATE_TIME value representing the same time on the first day of the ISO year with weeks
|
145
|
+
# starting on wkst containing the receiver
|
146
|
+
def at_start_of_iso_year(wkst)
|
147
|
+
start_of_year = @date_time_value.iso_year_start(wkst)
|
148
|
+
change(:year => start_of_year.year, :month => start_of_year.month, :day => start_of_year.day)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Return a DATE_TIME value representing the same time on the last day of the ISO year with weeks
|
152
|
+
# starting on wkst containing the receiver
|
153
|
+
def at_end_of_iso_year(wkst)
|
154
|
+
num_weeks = @date_time_value.iso_weeks_in_year(wkst)
|
155
|
+
at_start_of_iso_year(wkst).advance(:weeks => (num_weeks - 1), :days => 6)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Return a DATE_TIME value representing the same time on the first day of the ISO year with weeks
|
159
|
+
# starting on wkst after the ISO year containing the receiver
|
160
|
+
def at_start_of_next_iso_year(wkst)
|
161
|
+
num_weeks = @date_time_value.iso_weeks_in_year(wkst)
|
162
|
+
at_start_of_iso_year(wkst).advance(:weeks => num_weeks)
|
163
|
+
end
|
164
|
+
|
165
|
+
# Return a DATE_TIME value representing the last second of the last day of the ISO year with weeks
|
166
|
+
# starting on wkst containing the receiver
|
167
|
+
def end_of_iso_year(wkst)
|
168
|
+
at_end_of_iso_year(wkst).end_of_day
|
169
|
+
end
|
170
|
+
|
171
|
+
# Return a DATE-TIME representing the same time, on the same day of the month in month.
|
172
|
+
# If the month of the receiver has more days than the target month the last day of the target month
|
173
|
+
# will be used.
|
174
|
+
def in_month(month)
|
175
|
+
first = change(:day => 1, :month => month)
|
176
|
+
first.change(:day => [first.days_in_month, day].min)
|
177
|
+
end
|
177
178
|
end
|
178
179
|
end
|
179
180
|
end
|
@@ -1,63 +1,81 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
class DateTime
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
|
+
#
|
6
|
+
# Time zone related methods for DateTime
|
7
|
+
module TimezoneSupport
|
8
|
+
# Return the timezone id of the receiver, or nil if it is a floating time
|
9
|
+
def tzid
|
10
|
+
@tzid == :floating ? nil : @tzid
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def tzid=(timezone_id) #:nodoc:
|
14
|
+
timezone_id = default_tzid if timezone_id == :default
|
15
|
+
@tzid = timezone_id
|
16
|
+
@timezone = nil
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
tzid && tzid != "UTC"
|
25
|
-
end
|
26
|
-
|
27
|
-
# Return the receiver if it has a floating time zone already,
|
28
|
-
# otherwise return a DATETIME property with the same time as the receiver but with a floating time zone
|
29
|
-
def with_floating_timezone
|
30
|
-
if @tzid == nil
|
31
|
-
self
|
32
|
-
else
|
33
|
-
@date_time_value.with_floating_timezone.to_ri_cal_date_time_value
|
19
|
+
def find_timezone #:nodoc:
|
20
|
+
if @tzid == :floating
|
21
|
+
FloatingTimezone
|
22
|
+
else
|
23
|
+
timezone_finder.find_timezone(@tzid)
|
24
|
+
end
|
34
25
|
end
|
35
|
-
end
|
36
26
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
27
|
+
def timezone #:nodoc:
|
28
|
+
@timezone ||= find_timezone
|
29
|
+
end
|
30
|
+
|
31
|
+
# Determine if the receiver has a local time zone, i.e. it is not a floating time or a UTC time
|
32
|
+
def has_local_timezone?
|
33
|
+
tzid && tzid.upcase != "UTC"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Return the receiver if it has a floating time zone already,
|
37
|
+
# otherwise return a DATETIME property with the same time as the receiver but with a floating time zone
|
38
|
+
def with_floating_timezone
|
39
|
+
if @tzid == nil
|
40
|
+
self
|
41
|
+
else
|
42
|
+
@date_time_value.with_floating_timezone.to_ri_cal_date_time_value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns a instance that represents the time in UTC.
|
47
|
+
def utc
|
48
|
+
if has_local_timezone?
|
49
|
+
timezone.local_to_utc(self)
|
50
|
+
else # Already local or a floating time
|
51
|
+
self
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def rational_tz_offset #:nodoc:
|
56
|
+
if has_local_timezone?
|
57
|
+
timezone.rational_utc_offset(@date_time_value)
|
58
|
+
else
|
59
|
+
Rational(0,24)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Predicate indicating whether or not the instance represents a ZULU time
|
64
|
+
def utc?
|
65
|
+
tzid == "UTC"
|
43
66
|
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# Predicate indicating whether or not the instance represents a ZULU time
|
47
|
-
def utc?
|
48
|
-
tzid == "UTC"
|
49
|
-
end
|
50
67
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
68
|
+
# Returns the simultaneous time in the specified zone.
|
69
|
+
def in_time_zone(new_zone)
|
70
|
+
new_zone = timezone_finder.find_timezone(new_zone)
|
71
|
+
return self if tzid == new_zone.identifier
|
72
|
+
if has_local_timezone?
|
73
|
+
new_zone.utc_to_local(utc)
|
74
|
+
elsif utc?
|
75
|
+
new_zone.utc_to_local(self)
|
76
|
+
else # Floating time
|
77
|
+
DateTime.new(timezone_finder, :value => @date_time_value, :tzid => new_zone.identifier)
|
78
|
+
end
|
61
79
|
end
|
62
80
|
end
|
63
81
|
end
|