Skip to content

Commit

Permalink
fix: specify TZ=Asia/Shanghai (#5776)
Browse files Browse the repository at this point in the history
  • Loading branch information
pearmini committed Nov 9, 2023
1 parent b7e9055 commit e6ab2fe
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 76 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<div
xmlns="http://www.w3.org/1999/xhtml"
class="g2-tooltip"
style="pointer-events: none; position: absolute; visibility: visible; z-index: 8; transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1); background-color: rgba(255, 255, 255, 0.96); box-shadow: 0 6px 12px 0 rgba(0, 0, 0, 0.12); border-radius: 4px; color: rgba(0, 0, 0, 0.65); font-size: 12px; line-height: 20px; padding: 12px; min-width: 120px; max-width: 360px; font-family: Roboto-Regular; left: 210px; top: 310px;"
>
<div
class="g2-tooltip-title"
style="color: rgba(0, 0, 0, 0.45); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"
>
2008-06-22 08:00:00
</div>
<ul
class="g2-tooltip-list"
style="margin: 0px; list-style-type: none; padding: 0px;"
>
<li
class="g2-tooltip-list-item"
data-index="0"
style="list-style-type: none; display: flex; line-height: 2em; align-items: center; justify-content: space-between; white-space: nowrap;"
>
<span
class="g2-tooltip-list-item-name"
style="display: flex; align-items: center; max-width: 216px;"
>
<span
class="g2-tooltip-list-item-marker"
style="background: rgb(23, 131, 255); width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px;"
/>
<span
class="g2-tooltip-list-item-name-label"
title="close"
style="flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"
>
close
</span>
</span>
<span
class="g2-tooltip-list-item-value"
title="173.16"
style="display: inline-block; float: right; flex: 1; text-align: right; min-width: 28px; margin-left: 30px; color: rgba(0, 0, 0, 0.85); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"
>
173.16
</span>
</li>
</ul>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<div>
<dv>
<h2>Tue, 22 Apr 2014 00:00:00 GMT</h2>
<h2>2014-04-22 08:00:00</h2>
<span>(200, 300)</span>
<ul style="padding-left: 1em">
<li style="color: #00C9C9">AMZN: 1.2450190713009308</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<div>
<dv>
<h2>Fri, 02 Jan 2015 00:00:00 GMT</h2>
<h2>2015-01-02 08:00:00</h2>
<span>(300, 300)</span>
<ul style="padding-left: 1em">
<li style="color: #00C9C9">AMZN: 1.1663830378290787</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class="g2-tooltip-title"
style="color: rgba(0, 0, 0, 0.45); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"
>
Tue, 22 Apr 2014 00:00:00 GMT
2014-04-22 08:00:00
</div>
<ul
class="g2-tooltip-list"
Expand Down
11 changes: 0 additions & 11 deletions __tests__/plots/static/aapl-interval-date-encode-x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,3 @@ export function aaplIntervalDateEncodeX(): G2Spec {
},
};
}

let toString;

aaplIntervalDateEncodeX.before = () => {
toString = Date.prototype.toString;
Date.prototype.toString = Date.prototype.toUTCString;
};

aaplIntervalDateEncodeX.after = () => {
Date.prototype.toString = toString;
};
11 changes: 0 additions & 11 deletions __tests__/plots/static/aapl-line-missing-data-trial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,3 @@ export function aaplLineMissingDataTrial(): G2Spec {
style: { shape: 'trail' },
};
}

// Make the local ci and online ci covert Date object to consistent string.
let toString;
aaplLineMissingDataTrial.before = () => {
toString = Date.prototype.toString;
Date.prototype.toString = Date.prototype.toUTCString;
};

aaplLineMissingDataTrial.after = () => {
Date.prototype.toString = toString;
};
11 changes: 0 additions & 11 deletions __tests__/plots/static/mock-line-small-interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,3 @@ export function mockLineSmallInterval(): G2Spec {
coordinate: { transform: [{ type: 'transpose' }] },
};
}

let toString;

mockLineSmallInterval.before = () => {
toString = Date.prototype.toString;
Date.prototype.toString = Date.prototype.toUTCString;
};

mockLineSmallInterval.after = () => {
Date.prototype.toString = toString;
};
15 changes: 1 addition & 14 deletions __tests__/plots/tooltip/indices-line-custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ export async function indicesLineCustom(): Promise<G2Spec> {
{
type: 'line',
data,
axis: {
y: { labelAutoRotate: false },
},
axis: { y: { labelAutoRotate: false } },
transform: [{ type: 'normalizeY', basis: 'first', groupBy: 'color' }],
legend: false,
encode: {
Expand All @@ -35,14 +33,3 @@ export async function indicesLineCustom(): Promise<G2Spec> {
}

indicesLineCustom.steps = seriesTooltipSteps([200, 300], [300, 300]);

// Make the local ci and online ci covert Date object to consistent string.
let toString;
indicesLineCustom.before = () => {
toString = Date.prototype.toString;
Date.prototype.toString = Date.prototype.toUTCString;
};

indicesLineCustom.after = () => {
Date.prototype.toString = toString;
};
11 changes: 0 additions & 11 deletions __tests__/plots/tooltip/indices-line-formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,3 @@ export async function indicesLineFormatter(): Promise<G2Spec> {
}

indicesLineFormatter.steps = seriesTooltipSteps([200, 300]);

// Make the local ci and online ci covert Date object to consistent string.
let toString;
indicesLineFormatter.before = () => {
toString = Date.prototype.toString;
Date.prototype.toString = Date.prototype.toUTCString;
};

indicesLineFormatter.after = () => {
Date.prototype.toString = toString;
};
11 changes: 0 additions & 11 deletions __tests__/plots/tooltip/indices-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,3 @@ export async function indicesLine(): Promise<G2Spec> {
}

indicesLine.steps = seriesTooltipSteps([200, 300]);

// Make the local ci and online ci covert Date object to consistent string.
let toString;
indicesLine.before = () => {
toString = Date.prototype.toString;
Date.prototype.toString = Date.prototype.toUTCString;
};

indicesLine.after = () => {
Date.prototype.toString = toString;
};
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
"dist"
],
"scripts": {
"dev": "vite",
"dev": "TZ=Asia/Shanghai vite",
"dev:link": "cross-env LINK=1 vite",
"clean": "rimraf lib esm dist",
"lint-staged": "lint-staged",
"size": "limit-size",
"lint": "eslint ./src ./__tests__ && prettier ./src ./__tests__ --check ",
"fix": "eslint ./src ./__tests__ --fix && prettier ./src ./__tests__ --write ",
"test": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/ --coverage -i --logHeapUsage",
"test:unit": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/unit/ --coverage -i --logHeapUsage",
"test:integration": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/integration/ --coverage -i --logHeapUsage",
"test": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/ --coverage -i --logHeapUsage",
"test:unit": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/unit/ --coverage -i --logHeapUsage",
"test:integration": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/integration/ --coverage -i --logHeapUsage",
"preview": "vite preview",
"build:umd": "rimraf ./dist && node --expose-gc --max-old-space-size=4096 node_modules/rollup/dist/bin/rollup -c && npm run size",
"build:cjs": "rimraf ./lib && tsc --module commonjs --outDir lib",
Expand Down

0 comments on commit e6ab2fe

Please sign in to comment.