@@ -305,4 +305,34 @@ def test_filter_options
305305 "is not null" ,
306306 ]
307307 end
308+
309+ def test_table_displays_time_in_local_timezone
310+ FactoryBot . create ( :log_item , :request_at => Time . parse ( "2015-01-16T06:06:28.816Z" ) . utc , :request_method => "OPTIONS" )
311+ FactoryBot . create ( :log_item , :request_at => Time . parse ( "2015-01-16T08:23:31.273Z" ) . utc , :request_method => "OPTIONS" )
312+ FactoryBot . create ( :log_item , :request_at => Time . parse ( "2015-01-16T19:02:43.902Z" ) . utc , :request_method => "OPTIONS" )
313+ LogItem . refresh_indices!
314+
315+ admin_login
316+ visit "/admin/#/stats/logs?search=&start_at=2015-01-12&end_at=2015-01-18&interval=day"
317+ refute_selector ( ".busy-blocker" )
318+
319+ assert_equal ( "2015-01-16 12:02:43 PM MST" , find ( "#results_table table tbody tr:nth-child(1) td:first-child" ) . text )
320+ assert_equal ( "2015-01-16 1:23:31 AM MST" , find ( "#results_table table tbody tr:nth-child(2) td:first-child" ) . text )
321+ assert_equal ( "2015-01-15 11:06:28 PM MST" , find ( "#results_table table tbody tr:nth-child(3) td:first-child" ) . text )
322+ end
323+
324+ def test_table_displays_time_in_local_timezone_during_dst
325+ FactoryBot . create ( :log_item , :request_at => Time . parse ( "2015-07-16T06:06:28.816Z" ) . utc , :request_method => "OPTIONS" )
326+ FactoryBot . create ( :log_item , :request_at => Time . parse ( "2015-07-16T08:23:31.273Z" ) . utc , :request_method => "OPTIONS" )
327+ FactoryBot . create ( :log_item , :request_at => Time . parse ( "2015-07-16T19:02:43.902Z" ) . utc , :request_method => "OPTIONS" )
328+ LogItem . refresh_indices!
329+
330+ admin_login
331+ visit "/admin/#/stats/logs?search=&start_at=2015-07-12&end_at=2015-07-18&interval=day"
332+ refute_selector ( ".busy-blocker" )
333+
334+ assert_equal ( "2015-07-16 1:02:43 PM MDT" , find ( "#results_table table tbody tr:nth-child(1) td:first-child" ) . text )
335+ assert_equal ( "2015-07-16 2:23:31 AM MDT" , find ( "#results_table table tbody tr:nth-child(2) td:first-child" ) . text )
336+ assert_equal ( "2015-07-16 12:06:28 AM MDT" , find ( "#results_table table tbody tr:nth-child(3) td:first-child" ) . text )
337+ end
308338end
0 commit comments