Skip to content

Commit 4479c80

Browse files
authored
Fix the start dates for job and pipeline runs (#1427)
## Changes Fix the start dates for job and pipeline runs ## Tests Unit
1 parent 1c35e51 commit 4479c80

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import {expect} from "chai";
2+
import {toString, toDateString, toTimeString} from "./DateUtils";
3+
4+
describe("DateUtils", () => {
5+
describe("toString", () => {
6+
it("should return the correct date and time string", () => {
7+
const date = new Date("2023-10-05T14:48:00");
8+
const result = toString(date);
9+
// Fallback to a different locale check so we can run these tests on different machines
10+
try {
11+
expect(result).to.equal("5 Oct, 2023 14:48:00");
12+
} catch (e) {
13+
expect(result).to.equal("5 Oct, 2023 2:48:00 PM");
14+
}
15+
});
16+
});
17+
18+
describe("toDateString", () => {
19+
it("should return the correct date string", () => {
20+
const date = new Date("2023-10-05T14:48:00");
21+
const result = toDateString(date);
22+
expect(result).to.equal("5 Oct, 2023");
23+
});
24+
});
25+
26+
describe("toTimeString", () => {
27+
it("should return the correct time string", () => {
28+
const date = new Date("2023-10-05T14:48:00");
29+
const result = toTimeString(date);
30+
try {
31+
expect(result).to.equal("14:48:00");
32+
} catch (e) {
33+
expect(result).to.equal("2:48:00 PM");
34+
}
35+
});
36+
});
37+
});

packages/databricks-vscode/src/utils/DateUtils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ export function toString(date: Date): string {
33
}
44

55
export function toDateString(date: Date): string {
6-
const day = date.getDay();
6+
const day = date.getDate();
77
const month = date.toLocaleString("default", {month: "short"});
88
const year = date.getFullYear();
9-
109
return `${day} ${month}, ${year}`;
1110
}
1211

0 commit comments

Comments
 (0)