Skip to content

Commit

Permalink
[UPDATED]-Time zones updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ndasanayaka committed Jun 18, 2024
1 parent dd9187f commit 6acaf88
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
33 changes: 15 additions & 18 deletions src/views/AdminJobs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,25 @@
return
this.loading = true
this.jobs = await PreferenceAPI.filter_jobs(this.filters.status, this.filters.username, this.filters.start, this.filters.jobname)
const options = {
timeZone: 'Australia/Brisbane',
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
fractionalSecondDigits: 3, // to include milliseconds
};
for(let i = 0; i< this.jobs.length; i++){
let job = this.jobs[i]
if(job.start) {
if(job.submitted) {
// convert to local timezone
console.log("job.start")
console.log(job.start)
job.start = new Date(Date.parse(job.start) + new Date().getTimezoneOffset())
console.log(job.start)
// ot string
job.start = job.start.toLocaleString()
console.log(job.start)
let utctime = new Date(job.submitted)
this.jobs[i].submitted = utctime.toLocaleString('en-AU', options)
}
if(job.end){
console.log("job.end")
console.log(job.end)
job.end = new Date(Date.parse(job.end) + new Date().getTimezoneOffset())
console.log(job.end)
job.end = job.end.toLocaleString()
console.log(job.end)
}
}
}
this.loading = false
},
async applyFilter(){
Expand Down
24 changes: 23 additions & 1 deletion src/views/Jobshistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,29 @@
this.loading = true
// only list running and submitted jobs
this.jobs = await PreferenceAPI.list_jobs(false)
// console.log(this.jobs)
const options = {
timeZone: 'Australia/Brisbane',
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
fractionalSecondDigits: 3, // to include milliseconds
};
for(let i=0; i<this.jobs.length; i++) {
let job = this.jobs[i]
if(job.submitted) {
let utctime = new Date(job.submitted)
this.jobs[i].submitted = utctime.toLocaleString('en-AU', options)
}
}
console.log("this.jobs")
console.log(this.jobs)
let response = await RemoteJobAPI.list_jobs()
Vue.$log.debug("Remote jobs response :")
Vue.$log.debug(response)
Expand Down

0 comments on commit 6acaf88

Please sign in to comment.