@@ -242,6 +242,9 @@ def get_milestone(milestone_name:)
242242 it 'computes the correct dates when the due date is on the verge of a DST day change' do
243243 # Europe DST starts on the last Sunday of March, and ends on the last Sunday of October
244244 Time . use_zone ( 'Europe/London' ) do
245+ # March 27th, 2022 is the exact day that London switches to the DST (+1h)
246+ # If the due date is too close to the next day, a day change will happen
247+ # So, 2022-03-27 23:00:00Z will be exactly 2022-03-28 00:00:00 +0100 at the DST change
245248 due_date = Time . zone . parse ( '2022-03-27 23:00:00Z' )
246249 options = {
247250 due_on : '2022-03-28T12:00:00Z' ,
@@ -256,6 +259,25 @@ def get_milestone(milestone_name:)
256259 it 'computes the correct dates when the due date is on DST but has no day change' do
257260 # Europe DST starts on the last Sunday of March, and ends on the last Sunday of October
258261 Time . use_zone ( 'Europe/London' ) do
262+ # March 27th, 2022 is the exact day that London switches to the DST (+1h)
263+ # If the due date is not close enough at the day change, nothing will occur.
264+ # So, 2022-03-27 22:00:00Z will be exactly 2022-03-27 23:00:00 +0100 at the DST change.
265+ due_date = Time . zone . parse ( '2022-03-27 22:00:00Z' )
266+ options = {
267+ due_on : '2022-03-27T12:00:00Z' ,
268+ description : "Code freeze: March 27, 2022\n App Store submission: March 29, 2022\n Release: March 30, 2022\n "
269+ }
270+
271+ expect ( client ) . to receive ( :create_milestone ) . with ( test_repo , test_milestone_number , options )
272+ create_milestone ( due_date : due_date , days_until_submission : 2 , days_until_release : 3 )
273+ end
274+ end
275+
276+ it 'computes the correct dates when the due date is one day before a DST change' do
277+ # Europe DST starts on the last Sunday of March, and ends on the last Sunday of October
278+ Time . use_zone ( 'Europe/London' ) do
279+ # As London changes to DST on March 27th, the date shouldn't be changed
280+ # So, 2022-03-26 23:00:00Z will be exactly 2022-03-26 23:00:00 +0000 at this Timezone.
259281 due_date = Time . zone . parse ( '2022-03-26 23:00:00Z' )
260282 options = {
261283 due_on : '2022-03-26T12:00:00Z' ,
0 commit comments