Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

IE11向けに日付フォーマットを調整 #5181

Merged
merged 2 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions components/DashedRectangleTimeBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
fontColor: '#808080',
maxRotation: 0,
callback: (label: string) => {
return label.split('/')[1]
return dayjs(label).format('D')
},
},
// #2384: If you set "type" to "time", make sure that the bars at both ends are not hidden.
Expand All @@ -313,7 +313,6 @@ const options: ThisTypedComponentOptionsWithRecordProps<
type: 'time',
time: {
unit: 'month',
parser: 'M/D',
displayFormats: {
month: 'MMM',
},
Expand Down
1 change: 0 additions & 1 deletion components/SevereCaseBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ const options: ThisTypedComponentOptionsWithRecordProps<
type: 'time',
time: {
unit: 'month',
parser: 'M/D',
displayFormats: {
month: 'MMM',
},
Expand Down
1 change: 0 additions & 1 deletion components/TimeBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ const options: ThisTypedComponentOptionsWithRecordProps<
type: 'time',
time: {
unit: 'month',
parser: 'M/D',
displayFormats: {
month: 'MMM',
},
Expand Down
1 change: 0 additions & 1 deletion components/TimeStackedBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ const options: ThisTypedComponentOptionsWithRecordProps<
type: 'time',
time: {
unit: 'month',
parser: 'M/D',
displayFormats: {
month: 'MMM',
},
Expand Down
2 changes: 1 addition & 1 deletion components/cards/HospitalizedNumberCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:chart-data="patientsGraph"
:date="positiveStatus.date"
:unit="$t('人')"
:dashed-rectangle-range="'5/11'"
:dashed-rectangle-range="'2020-05-11'"
:added-value="200"
:table-labels="tableLabels"
>
Expand Down
4 changes: 2 additions & 2 deletions components/cards/SevereCaseCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<script>
import Data from '@/data/positive_status.json'
import SevereCaseBarChart from '@/components/SevereCaseBarChart.vue'
import { convertDateToISO8601Format } from '@/utils/formatDate.ts'

export default {
components: {
Expand All @@ -51,11 +52,10 @@ export default {
Data.data
.filter((d) => new Date(d.date) > new Date('2020-04-26'))
.forEach((d) => {
const date = new Date(d.date)
const subTotal = d.severe_case
if (!isNaN(subTotal)) {
graphData.push({
label: `${date.getMonth() + 1}/${date.getDate()}`,
label: convertDateToISO8601Format(d.date),
transition: subTotal,
})
}
Expand Down
5 changes: 4 additions & 1 deletion components/cards/TestedNumberCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import Data from '@/data/data.json'
import { getDayjsObject } from '@/utils/formatDate'
import TimeStackedBarChart from '@/components/TimeStackedBarChart.vue'
dayjs.extend(duration)

Expand All @@ -73,7 +74,9 @@ export default {
this.$t('健康安全研究センターが行った検査件数'),
this.$t('医療機関等が行った検査件数'),
]
const inspectionsLabels = Data.inspections_summary.labels
const inspectionsLabels = Data.inspections_summary.labels.map((d) => {
return getDayjsObject(d).format('YYYY-MM-DD')
})
const inspectionsDataLabels = [
this.$t('健康安全研究センターが行った検査件数'),
this.$t('医療機関等が行った検査件数'),
Expand Down
7 changes: 4 additions & 3 deletions utils/formatGraph.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { convertDateToISO8601Format } from '@/utils/formatDate'

type DataType = {
日付: Date
日付: string
小計: number
}

Expand All @@ -21,12 +23,11 @@ export default (data: DataType[]) => {
data
.filter((d) => new Date(d['日付']) < today)
.forEach((d) => {
const date = new Date(d['日付'])
const subTotal = d['小計']
if (!isNaN(subTotal)) {
patSum += subTotal
graphData.push({
label: `${date.getMonth() + 1}/${date.getDate()}`,
label: convertDateToISO8601Format(d['日付']),
transition: subTotal,
cumulative: patSum,
})
Expand Down