Skip to content

Commit

Permalink
migrated from momentjs to luxon
Browse files Browse the repository at this point in the history
  • Loading branch information
godfryd committed Mar 20, 2021
1 parent 23f8646 commit 37c4c17
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion agent/kraken/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def main():
if not srv.srv_addr:
print('There is missing server address.')
print('Run agent with -s parameter or start agent container')
print('with KRAKEN_SERVER_ADDR env variable set properly')
print('with KRAKEN_SERVER_ADDR env variable set properly.')
sys.exit(1)

host_info = collect_host_info()
Expand Down
13 changes: 5 additions & 8 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"chartjs-plugin-error-bars": "^1.2.3",
"codemirror": "^5.60.0",
"font-awesome": "^4.7.0",
"moment": "^2.29.1",
"moment-timezone": "^0.5.33",
"luxon": "^1.26.0",
"primeflex": "^2.0.0",
"primeicons": "^4.1.0",
"primeng": "^11.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h2 style="padding-left: 7px;">{{ project.name }}</h2>
<table *ngIf="flows.flows.length > 0" >
<tr *ngFor="let flow of flows.flows" style="padding: 3px 6px;">
<td style="vertical-align: top; width: 3em;"><b><a routerLink="/flows/{{ flow.id }}">{{ flow.id }}</a>.</b></td>
<td style="vertical-align: top;"><a routerLink="/flows/{{ flow.id }}" style="color: black;">{{ flow.created | localtime:'YYYY-MM-DD HH:mm' }}</a></td>
<td style="vertical-align: top;"><a routerLink="/flows/{{ flow.id }}" style="color: black;">{{ flow.created | localtime:'yyyy-LL-dd HH:mm' }}</a></td>
<td style="vertical-align: top;">
<span *ngIf="flow.tests_total > 0"
[ngStyle]="{'border-radius': '4px', 'background-color': flow.tests_color, 'padding': '1px 3px', 'margin-right': '2px'}">{{ flow.tests_pass_ratio }}%&nbsp;pass</span>
Expand Down
13 changes: 6 additions & 7 deletions ui/src/app/utils.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
// import moment from 'moment';
import moment from 'moment-timezone'
import { DateTime } from "luxon";

export function datetimeToLocal(d, fmt) {
try {
let tz = Intl.DateTimeFormat().resolvedOptions().timeZone
if (!tz) {
tz = moment.tz.guess()
tz = DateTime.local().zoneName
}
if (tz) {
d = moment(d).tz(tz)
d = DateTime.fromISO(d).setZone(tz)
tz = ''
} else {
d = moment(d)
d = DateTime.fromISO(d)
tz = ' UTC'
}

if (!fmt) {
fmt = 'YYYY-MM-DD HH:mm:ss'
fmt = 'yyyy-LL-dd HH:mm:ss'
}

return d.format(fmt) + tz
return d.toFormat(fmt) + tz
} catch (e) {
return d
}
Expand Down

0 comments on commit 37c4c17

Please sign in to comment.