Removed dep on API
[ninja.git] / application / views / command / js / schedule_downtime.js
blobf59ad7b28022a621df5919a492b53ce6898276d1
1 $(function() {
2 $('#command_form').submit(function(ev) {
3 if(!$('#field_fixed:checked').length) {
4 return;
6 var form = $(this);
7 var timestamp = new Date($('#field_start_time').val());
8 var grace_time_in_ms = grace_time_in_s * 1000;
9 var js_utc_offset = new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000;
10 if(timestamp.getTime() < (js_utc_offset + (_server_utc_offset*1000) - grace_time_in_ms)) {
11 return confirm("Since you submitted a starting time that's more than "+grace_time_in_s+" seconds old, this will be a retroactively scheduled downtime and thus it will show up separately in logs.\n\nIf this is a mistake, choose 'cancel' and correct the value.");
13 });
14 });