FIX: use iso8601 time format for logs url time range.

FIX: use iso8601 time format for logs url time range.

diff --git a/app/jobs/concerns/alert_post_mixin.rb b/app/jobs/concerns/alert_post_mixin.rb
index 0fef3fb..a126039 100644
--- a/app/jobs/concerns/alert_post_mixin.rb
+++ b/app/jobs/concerns/alert_post_mixin.rb
@@ -120,7 +120,7 @@ module AlertPostMixin
     begin_t = Time.parse(alert['starts_at'])
     end_t   = Time.parse(alert['ends_at']) rescue Time.zone.now
 
-    "#{url}?_g=(time:(from:'#{begin_t}',mode:absolute,to:'#{end_t}'))"
+    "#{url}?_g=(time:(from:'#{begin_t.to_s(:iso8601)}',mode:absolute,to:'#{end_t.to_s(:iso8601)}'))"
   end
 
   def prev_topic_link(topic_id)
diff --git a/spec/integration/discourse_prometheus_alert_receiver/receiver_controller_spec.rb b/spec/integration/discourse_prometheus_alert_receiver/receiver_controller_spec.rb
index e6e20ee..b68bae1 100644
--- a/spec/integration/discourse_prometheus_alert_receiver/receiver_controller_spec.rb
+++ b/spec/integration/discourse_prometheus_alert_receiver/receiver_controller_spec.rb
@@ -883,6 +883,7 @@ RSpec.describe DiscoursePrometheusAlertReceiver::ReceiverController do
                 'id' => 'somethingfunny',
                 'starts_at' => "2020-01-02T03:04:05.12345678Z",
                 'graph_url' => "http://alerts.example.com/graph?g0.expr=lolrus",
+                'logs_url' => "http://logs.example.com/app",
                 'status' => 'firing',
                 'datacenter' => datacenter
               },
@@ -890,6 +891,7 @@ RSpec.describe DiscoursePrometheusAlertReceiver::ReceiverController do
                 'id' => 'somethingnotfunny',
                 'starts_at' => "2020-01-02T03:04:05.12345678Z",
                 'graph_url' => "http://alerts.example.com/graph?g0.expr=lolrus",
+                'logs_url' => "http://logs.example.com/app",
                 'status' => 'firing',
                 'datacenter' => datacenter
               },
@@ -948,6 +950,7 @@ RSpec.describe DiscoursePrometheusAlertReceiver::ReceiverController do
                 'starts_at' => "2020-01-02T03:04:05.12345678Z",
                 'ends_at' => "2020-01-02T09:08:07.09876543Z",
                 'graph_url' => "http://alerts.example.com/graph?g0.expr=lolrus",
+                'logs_url' => "http://logs.example.com/app",
                 'status' => 'resolved',
                 'description' => 'some description',
                 'datacenter' => datacenter,
@@ -957,6 +960,7 @@ RSpec.describe DiscoursePrometheusAlertReceiver::ReceiverController do
                 'id' => 'somethingnotfunny',
                 'starts_at' => "2020-01-02T03:04:05.12345678Z",
                 'graph_url' => "http://alerts.example.com/graph?g0.expr=lolrus",
+                'logs_url' => "http://logs.example.com/app",
                 'status' => 'firing',
                 'datacenter' => datacenter
               }
@@ -976,6 +980,10 @@ RSpec.describe DiscoursePrometheusAlertReceiver::ReceiverController do
           )
 
           expect(raw).to match(/somethingfunny.*date=2020-01-02 time=09:08:07/)
+
+          expect(raw).to include(
+            "[:file_folder:](http://logs.example.com/app#/discover?_g=(time:(from:'2020-01-02T03:04:05Z',mode:absolute,to:'2020-01-02T09:08:07Z')))"
+          )
         end
       end

GitHub sha: 95bbd19e