mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2024-11-27 06:38:40 -05:00
Fix #19
This commit is contained in:
parent
14407ef0a3
commit
e0a455e0ea
@ -69,13 +69,16 @@ Template::render_header(_("Dashboard"), true);
|
||||
<i class="glyphicon glyphicon-info-sign"></i>
|
||||
</div>
|
||||
<div class="panel-heading clearfix">
|
||||
<input type="text" name="title" id="title" placeholder="<?php echo _("Title");?>" value="<?php echo (isset($_POST['title'])?htmlspecialchars($_POST['title']):''); ?>" required> <span id="time"><input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo (isset($_POST['time'])?htmlspecialchars($_POST['time']):''); ?>" class="pull-right" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="<?php echo _("Time");?>"></span>
|
||||
<input type="text" name="title" id="title" placeholder="<?php echo _("Title");?>" value="<?php echo (isset($_POST['title'])?htmlspecialchars($_POST['title']):''); ?>" required> <span id="time"><input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo (isset($_POST['time'])?htmlspecialchars($_POST['time']):''); ?>" class="pull-right" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="<?php echo _("Time");?>">
|
||||
<input id="time_input_js" name="time_js" type="hidden" class="pull-right">
|
||||
</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<textarea name="text" placeholder="<?php echo _("Here goes your text...");?>" required><?php echo (isset($_POST['text'])?htmlspecialchars($_POST['text']):''); ?></textarea>
|
||||
</div>
|
||||
<div class="panel-footer clearfix">
|
||||
<small><?php echo _("Posted by");?>: <?php echo $user->get_username();?> <span class="pull-right" id="end_time_wrapper"><?php echo _("Ending");?>: <input id="end_time" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="end_time" class="pull-right" placeholder="<?php echo _("End time");?>" value="<?php echo (isset($_POST['end_time'])?htmlspecialchars($_POST['end_time']):''); ?>"></span></small>
|
||||
<input id="end_time_js" name="end_time_js" type="hidden" class="pull-right">
|
||||
</div>
|
||||
</div>
|
||||
<select class="form-control pull-left" id="type" name="type">
|
||||
|
@ -118,8 +118,10 @@ class Incident implements JsonSerializable
|
||||
}
|
||||
|
||||
if (!empty($_POST['time'])){
|
||||
$time = strtotime($_POST['time']);
|
||||
$end_time = strtotime($_POST['end_time']);
|
||||
$input_time = (isset($_POST['time_js'])?$_POST['time_js']: $_POST['time']);
|
||||
$input_end_time = (isset($_POST['end_time_js'])?$_POST['end_time_js']: $_POST['end_time']);
|
||||
$time = strtotime($input_time);
|
||||
$end_time = strtotime($input_end_time);
|
||||
if (!$time)
|
||||
{
|
||||
$message = _("Start date format is not recognized. Please use ISO 8601 format.");
|
||||
|
@ -1,9 +1,9 @@
|
||||
(function(){
|
||||
$("#time_input").flatpickr({enableTime:true, minDate: "today",time_24hr:true, formatDate: function(date, format) {
|
||||
return date.toISOString();
|
||||
$("#time_input").flatpickr({enableTime:true, minDate: "today",time_24hr:true, onChange: function(date, dateStr, instance) {
|
||||
$("#time_input_js").val(date[0].toISOString());
|
||||
}});
|
||||
$("#end_time").flatpickr({enableTime:true, minDate: "today",time_24hr:true, formatDate: function(date, format) {
|
||||
return date.toISOString(); // iso date str
|
||||
$("#end_time").flatpickr({enableTime:true, minDate: "today",time_24hr:true, onChange: function(date, dateStr, instance) {
|
||||
$("#end_time_js").val(date[0].toISOString()); // iso date str
|
||||
}});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user