-
Notifications
You must be signed in to change notification settings - Fork 2k
Conversation
chartData: Object, | ||
date: { | ||
type: String, | ||
default: '' | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
親コンポーネントからデータを渡されているのにも関わらず使用していなかったため追加。
.text-nowrap { | ||
white-space: nowrap; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
表の中で変に日付が改行されしまうので、改行されないようにする共通のスタイルを追加。
ja: dateTimeFormatsCommon, | ||
en: dateTimeFormatsCommon, | ||
'zh-cn': dateTimeFormatsCommon, | ||
'zh-tw': dateTimeFormatsCommon, | ||
ko: dateTimeFormatsCommon, | ||
'ja-basic': dateTimeFormatsCommon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
いったん全ての言語で共通の設定とした。
utils/formatData.ts
Outdated
export const getComplementedDate = (dateString: string): string => { | ||
const dates = dateString.split('/') | ||
if (dates.length !== 2) { | ||
return dateString | ||
} | ||
const month = Number(dates[0]) | ||
const date = Number(dates[1]) | ||
const today = new Date() | ||
const currentMonth = today.getMonth() + 1 | ||
const currentDate = today.getDate() | ||
let targetYear = today.getFullYear() | ||
|
||
if (currentMonth <= month && currentDate <= date) { | ||
targetYear = -1 | ||
} | ||
|
||
return `${targetYear}/${month}/${date}` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
日付が3/10
と言った形式だとDateオブジェクト取得する際に年が不明になってまい閏年などで日付がずれてしまう可能性があるため、以下のロジックで年を補完する処理を作成した。
- 年を含まないデータは1年以上データを保持しない。
- 1年以上保持しないのであれば、現在より古い日付のデータは去年のデータと推測できる。
- 最新のデータは翌日以降に取得するので、現在と同じ日付のデータも去年のものと考えられる。
- 一部だけ年を含むデータが入ってくることを考慮し、
/
によりsplitした結果が�長さ2の配列にならない場合はそのままデータを返すようにした。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。
ファイル名なのですが formatDate.ts
があるのでそちらに統合する形がいいかなと思います。
また、こちらの処理について、この関数を使うか元データの方で年部分まで保持する形にするか、一度検討してみたいと思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaySoMusician formatDate.ts
に統合しました!
@y-chan ご確認いただきありがとうございます! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMです。
@MaySoMusician コンフリクトしていたようなので修正しておきました。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応ありがとうございます!
最近追加された「モニタリング指標」関連については別途issueを立てる形にしようかなと思います
@MaySoMusician かしこまりました! |
👏 解決する issue / Resolved Issues
📝 関連する issue / Related Issues
⛏ 変更内容 / Details of Changes
日付に関連するところを全て多言語対応しまいた。
📸 スクリーンショット / Screenshots
※全画面キャプチャすると多くなるので一部抜粋。