Skip to content

Commit f8b4ef0

Browse files
committed
v 0.22.1
Bug Fixes - Added work log time begins at submitted time
1 parent e97b3e8 commit f8b4ef0

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.22.1
2+
3+
### Bug Fixes
4+
5+
- Added work log time begins at submitted time
6+
17
## 0.22.0
28

39
### Features

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "jira-plugin",
33
"displayName": "Jira Plugin",
44
"description": "Manage your on-premises/cloud Jira in vscode",
5-
"version": "0.22.0",
5+
"version": "0.22.1",
66
"publisher": "gioboa",
77
"icon": "images/icons/icon.png",
88
"galleryBanner": {

src/commands/issue-add-worklog.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as vscode from 'vscode';
2-
import { logger, store } from '../services';
2+
import { logger, store, utilities } from '../services';
33
import { NO_WORKING_ISSUE } from '../shared/constants';
44
import openIssue from './open-issue';
55

@@ -8,10 +8,13 @@ export default async function issueAddWorklog(issueKey: string, timeSpentSeconds
88
if (issueKey !== NO_WORKING_ISSUE.key) {
99
if (store.canExecuteJiraAPI()) {
1010
// call Jira API
11+
const actualTimeSpentSeconds = Math.ceil(timeSpentSeconds / 60) * 60;
12+
const startedTime = new Date(Date.now() - actualTimeSpentSeconds * 1000);
1113
const response = await store.state.jira.addWorkLog({
1214
issueKey,
13-
timeSpentSeconds: Math.ceil(timeSpentSeconds / 60) * 60,
14-
comment
15+
timeSpentSeconds: actualTimeSpentSeconds,
16+
comment,
17+
started: utilities.dateToLocalISO(startedTime),
1518
});
1619
const action = await vscode.window.showInformationMessage(`Worklog added`, 'Open in browser');
1720
if (action === 'Open in browser') {

src/services/http.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export interface IAddWorkLog {
113113
issueKey: string;
114114
timeSpentSeconds: number;
115115
comment?: string;
116+
started: string;
116117
}
117118

118119
export interface IIssueType {

src/services/utilities.service.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default class UtilitiesService {
1111
addStatusIcon(status: string, withDescription: boolean): string {
1212
let icon = STATUS_ICONS.DEFAULT.icon;
1313
if (!!status) {
14-
Object.values(STATUS_ICONS).forEach(value => {
14+
Object.values(STATUS_ICONS).forEach((value) => {
1515
if (status.toUpperCase().indexOf(value.text.toUpperCase()) !== -1) {
1616
icon = value.icon;
1717
}
@@ -80,7 +80,7 @@ export default class UtilitiesService {
8080
insertWorkingIssueComment() {
8181
const editor = vscode.window.activeTextEditor;
8282
if (editor && store.state.workingIssue) {
83-
editor.edit(edit => {
83+
editor.edit((edit) => {
8484
const workingIssue = store.state.workingIssue;
8585
edit.insert(editor.selection.active, `// ${workingIssue.issue.key} - ${workingIssue.issue.fields.summary}`);
8686
});
@@ -113,4 +113,15 @@ export default class UtilitiesService {
113113
}
114114
return projects;
115115
}
116+
117+
dateToLocalISO(date: Date): string {
118+
const off = date.getTimezoneOffset();
119+
const absoff = Math.abs(off);
120+
return (
121+
new Date(date.getTime() - off * 60 * 1000).toISOString().substr(0, 23) +
122+
(off > 0 ? '-' : '+') +
123+
(absoff / 60).toFixed(0).padStart(2, '0') +
124+
(absoff % 60).toString().padStart(2, '0')
125+
);
126+
}
116127
}

0 commit comments

Comments
 (0)