diff options
| author | zyoshoka <107108195+zyoshoka@users.noreply.github.com> | 2024-06-15 16:35:41 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-15 16:35:41 +0900 |
| commit | 379ce0145b9d0b74334b35fa57f2ef87366388f2 (patch) | |
| tree | 1749b00991eb2868e9e3d9333334ed0bd0ebd774 /packages/frontend/src/components/MkChart.vue | |
| parent | fix changelog (diff) | |
| download | misskey-379ce0145b9d0b74334b35fa57f2ef87366388f2.tar.gz misskey-379ce0145b9d0b74334b35fa57f2ef87366388f2.tar.bz2 misskey-379ce0145b9d0b74334b35fa57f2ef87366388f2.zip | |
fix(frontend): fix time on `MkChart`'s story (#13958)
Diffstat (limited to 'packages/frontend/src/components/MkChart.vue')
| -rw-r--r-- | packages/frontend/src/components/MkChart.vue | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/frontend/src/components/MkChart.vue b/packages/frontend/src/components/MkChart.vue index a823a0ec4b..3816bca348 100644 --- a/packages/frontend/src/components/MkChart.vue +++ b/packages/frontend/src/components/MkChart.vue @@ -77,6 +77,7 @@ const props = withDefaults(defineProps<{ stacked?: boolean; bar?: boolean; aspectRatio?: number | null; + nowForChromatic?: number; }>(), { args: undefined, limit: 90, @@ -84,6 +85,13 @@ const props = withDefaults(defineProps<{ stacked: false, bar: false, aspectRatio: null, + + /** + * @desc Overwrites current date to fix background lines of chart. + * @ignore Only used for Chromatic. Don't use this for production. + * @see https://github.com/misskey-dev/misskey/pull/13830#issuecomment-2155886151 + */ + nowForChromatic: undefined, }); const legendEl = shallowRef<InstanceType<typeof MkChartLegend>>(); @@ -106,7 +114,8 @@ const getColor = (i) => { return colorSets[i % colorSets.length]; }; -const now = new Date(); +// eslint-disable-next-line vue/no-setup-props-destructure +const now = props.nowForChromatic != null ? new Date(props.nowForChromatic) : new Date(); let chartInstance: Chart | null = null; let chartData: { series: { |