mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-30 11:42:22 -04:00
Add luxor.js and use it to format datetimes
This commit is contained in:
@@ -973,10 +973,12 @@ function xhtmlFooter() {
|
||||
), true );
|
||||
?>
|
||||
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
|
||||
<script src="skins/<?php echo $skin ?>/js/luxon-3.4.4.min.js"></script>
|
||||
<?php
|
||||
?>
|
||||
<script nonce="<?php echo $cspNonce; ?>">
|
||||
var $j = jQuery.noConflict();
|
||||
var DateTime = luxon.DateTime;
|
||||
<?php
|
||||
if ( $skinJsPhpFile ) {
|
||||
require_once( $skinJsPhpFile );
|
||||
|
||||
1
web/skins/classic/js/luxon-3.4.4.min.js
vendored
Normal file
1
web/skins/classic/js/luxon-3.4.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -90,6 +90,17 @@ function processRows(rows) {
|
||||
const date = new Date(0); // Have to init it fresh. setSeconds seems to add time, not set it.
|
||||
date.setSeconds(row.Length);
|
||||
row.Length = date.toISOString().substr(11, 8);
|
||||
if (ZM_DATETIME_FORMAT_PATTERN) {
|
||||
if (window.DateTime) {
|
||||
row.StartDateTime = DateTime.fromSQL(row.StartDateTime).setZone(ZM_TIMEZONE).toFormat(ZM_DATETIME_FORMAT_PATTERN);
|
||||
if (row.EndDateTime)
|
||||
row.EndDateTime = DateTime.fromSQL(row.EndDateTime).setZone(ZM_TIMEZONE).toFormat(ZM_DATETIME_FORMAT_PATTERN);
|
||||
} else {
|
||||
console.log("DateTime is not defined");
|
||||
}
|
||||
} else {
|
||||
console.log("No ZM_DATETIME_FORMAT_PATTERN");
|
||||
}
|
||||
|
||||
if ( WEB_LIST_THUMBS ) row.Thumbnail = '<div class="thumbnail" style="height: '+row.imgHeight+'px;"><a href="?view=event&eid=' + eid + filterQuery + sortQuery + '&page=1">' + row.imgHtml + '</a></div>';
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ var params =
|
||||
// Called by bootstrap-table to retrieve zm event data
|
||||
function ajaxRequest(params) {
|
||||
// Maintain legacy behavior by statically setting these parameters
|
||||
var data = params.data;
|
||||
const data = params.data;
|
||||
data.order = 'desc';
|
||||
data.limit = maxDisplayEvents;
|
||||
data.sort = 'Id';
|
||||
@@ -45,7 +45,7 @@ function ajaxRequest(params) {
|
||||
|
||||
$j.getJSON(thisUrl, data)
|
||||
.done(function(data) {
|
||||
var rows = processRows(data.rows);
|
||||
const rows = processRows(data.rows);
|
||||
params.success(rows);
|
||||
})
|
||||
.fail(logAjaxFail);
|
||||
@@ -67,6 +67,17 @@ function processRows(rows) {
|
||||
} else if ( row.Notes != 'Forced Web: ' ) {
|
||||
row.Notes = '<div class="small text-muted">' + row.Notes + '</div>';
|
||||
}
|
||||
if (ZM_DATETIME_FORMAT_PATTERN) {
|
||||
if (window.DateTime) {
|
||||
row.StartDateTime = DateTime.fromSQL(row.StartDateTime).setZone(ZM_TIMEZONE).toFormat(ZM_DATETIME_FORMAT_PATTERN);
|
||||
if (row.EndDateTime)
|
||||
row.EndDateTime = DateTime.fromSQL(row.EndDateTime).setZone(ZM_TIMEZONE).toFormat(ZM_DATETIME_FORMAT_PATTERN);
|
||||
} else {
|
||||
console.log("DateTime is not defined");
|
||||
}
|
||||
} else {
|
||||
console.log("No ZM_DATETIME_FORMAT_PATTERN");
|
||||
}
|
||||
});
|
||||
|
||||
return rows;
|
||||
|
||||
Reference in New Issue
Block a user