all dates in gui are in market time zone (even start/stop)
This commit is contained in:
@ -1150,7 +1150,7 @@
|
||||
|
||||
<!-- <script src="/static/js/utils.js?v=1.01"></script> -->
|
||||
<!-- new util structure and exports and colors -->
|
||||
<script src="/static/js/utils/utils.js?v=1.04"></script>
|
||||
<script src="/static/js/utils/utils.js?v=1.05"></script>
|
||||
<script src="/static/js/utils/exports.js?v=1.04"></script>
|
||||
<script src="/static/js/utils/colors.js?v=1.04"></script>
|
||||
|
||||
@ -1160,13 +1160,13 @@
|
||||
|
||||
<!-- <script src="/static/js/archivetables.js?v=1.05"></script> -->
|
||||
<!-- archiveTables split into separate files -->
|
||||
<script src="/static/js/tables/archivetable/init.js?v=1.10"></script>
|
||||
<script src="/static/js/tables/archivetable/init.js?v=1.11"></script>
|
||||
<script src="/static/js/tables/archivetable/functions.js?v=1.09"></script>
|
||||
<script src="/static/js/tables/archivetable/modals.js?v=1.07"></script>
|
||||
<script src="/static/js/tables/archivetable/handlers.js?v=1.07"></script>
|
||||
|
||||
<!-- Runmanager functionality -->
|
||||
<script src="/static/js/tables/runmanager/init.js?v=1.10"></script>
|
||||
<script src="/static/js/tables/runmanager/init.js?v=1.1"></script>
|
||||
<script src="/static/js/tables/runmanager/functions.js?v=1.08"></script>
|
||||
<script src="/static/js/tables/runmanager/modals.js?v=1.07"></script>
|
||||
<script src="/static/js/tables/runmanager/handlers.js?v=1.07"></script>
|
||||
|
||||
@ -70,30 +70,32 @@ function initialize_archiveRecords() {
|
||||
{
|
||||
targets: [5],
|
||||
render: function ( data, type, row ) {
|
||||
now = new Date(data)
|
||||
if (type == "sort") {
|
||||
return new Date(data).getTime();
|
||||
}
|
||||
//data = "2024-02-26T19:29:13.400621-05:00"
|
||||
// Create a date object from the string, represents given moment in time in UTC time
|
||||
var date = new Date(data);
|
||||
|
||||
tit = date.toLocaleString('cs-CZ', {
|
||||
timeZone: 'America/New_York',
|
||||
})
|
||||
|
||||
if (isToday(now)) {
|
||||
if (isToday(date)) {
|
||||
console.log("volame isToday s", date)
|
||||
//return local time only
|
||||
return '<div title="'+tit+'">'+ 'dnes ' + format_date(data,false,true)+'</div>'
|
||||
return '<div title="'+tit+'">'+ 'dnes ' + format_date(data,true,true)+'</div>'
|
||||
}
|
||||
else
|
||||
{
|
||||
//return local datetime
|
||||
return '<div title="'+tit+'">'+ format_date(data,false,false)+'</div>'
|
||||
return '<div title="'+tit+'">'+ format_date(data,true,false)+'</div>'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
targets: [6],
|
||||
render: function ( data, type, row ) {
|
||||
now = new Date(data)
|
||||
if (type == "sort") {
|
||||
return new Date(data).getTime();
|
||||
}
|
||||
@ -102,14 +104,14 @@ function initialize_archiveRecords() {
|
||||
timeZone: 'America/New_York',
|
||||
})
|
||||
|
||||
if (isToday(now)) {
|
||||
if (isToday(date)) {
|
||||
//return local time only
|
||||
return '<div title="'+tit+'" class="token level comment">'+ 'dnes ' + format_date(data,false,true)+'</div>'
|
||||
return '<div title="'+tit+'" class="token level comment">'+ 'dnes ' + format_date(data,true,true)+'</div>'
|
||||
}
|
||||
else
|
||||
{
|
||||
//return local datetime
|
||||
return '<div title="'+tit+'" class="token level number">'+ format_date(data,false,false)+'</div>'
|
||||
return '<div title="'+tit+'" class="token level number">'+ format_date(data,true,false)+'</div>'
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@ -168,7 +168,6 @@ function initialize_runmanagerRecords() {
|
||||
targets: [15,17, 18, 8, 9], //start, stop, valid_from, valid_to, bt_from, bt_to, last_proccessed
|
||||
render: function ( data, type, row ) {
|
||||
if (!data) return data
|
||||
now = new Date(data)
|
||||
if (type == "sort") {
|
||||
return new Date(data).getTime();
|
||||
}
|
||||
|
||||
@ -990,12 +990,26 @@ JSON.safeStringify = (obj, indent = 2) => {
|
||||
return retVal;
|
||||
};
|
||||
|
||||
function isToday(someDate) {
|
||||
const today = new Date()
|
||||
return someDate.getDate() == today.getDate() &&
|
||||
someDate.getMonth() == today.getMonth() &&
|
||||
someDate.getFullYear() == today.getFullYear()
|
||||
}
|
||||
|
||||
function isToday(someDate) {
|
||||
// Convert input date to Eastern Time
|
||||
var dateInEastern = new Date(someDate.toLocaleString('en-US', { timeZone: 'America/New_York' }));
|
||||
console.log("vstupuje ",someDate)
|
||||
console.log("americky ",dateInEastern)
|
||||
// Get today's date in Eastern Time
|
||||
var todayInEastern = new Date(new Date().toLocaleString('en-US', { timeZone: 'America/New_York' }));
|
||||
|
||||
return dateInEastern.getDate() === todayInEastern.getDate() &&
|
||||
dateInEastern.getMonth() === todayInEastern.getMonth() &&
|
||||
dateInEastern.getFullYear() === todayInEastern.getFullYear();
|
||||
}
|
||||
// function isToday(someDate) {
|
||||
|
||||
// const today = new Date()
|
||||
// return someDate.getDate() == today.getDate() &&
|
||||
// someDate.getMonth() == today.getMonth() &&
|
||||
// someDate.getFullYear() == today.getFullYear()
|
||||
// }
|
||||
|
||||
//https://www.w3schools.com/jsref/jsref_tolocalestring.asp
|
||||
function format_date(datum, markettime = false, timeonly = false) {
|
||||
|
||||
Reference in New Issue
Block a user