Skip to content
This repository was archived by the owner on May 7, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit baca7fc

Browse files
authoredApr 28, 2019
Merge pull request #167 from ProgrammingLab/fukusan/fix-achievement-time-zone
UTCとの変換を書いた
2 parents 56ea08f + 2df9f09 commit baca7fc

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed
 

‎package-lock.json‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"dependencies": {
1111
"ajv": "^5.5.2",
1212
"axios": "^0.18.0",
13+
"moment": "^2.24.0",
1314
"rxjs": "^6.5.1",
1415
"vue": "^2.6.10",
1516
"vue-analytics": "^5.16.4",

‎src/components/EditAchievement.vue‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
<script>
112112
import { mapState, mapActions } from 'vuex';
113113
import { debounceTime } from 'rxjs/operators';
114+
import moment from 'moment';
114115
import ErrorMessage from '@/components/ErrorMessage.vue';
115116
import Multiselect from 'vue-multiselect';
116117
import ImageSelector from '@/components/ImageSelector.vue';
@@ -151,11 +152,11 @@ export default {
151152
if (!this.achievement.happened_at) {
152153
return null;
153154
}
154-
const date = this.achievement.happened_at.substring(0, '2019-01-01'.length);
155-
return date;
155+
return moment(this.achievement.happened_at).local().format('YYYY-MM-DD');
156156
},
157157
set(newValue) {
158-
this.achievement.happened_at = `${newValue}T00:00:00Z`;
158+
const UTCDate = moment(newValue).utc().format('YYYY-MM-DD[T]HH:mm:ss[Z]');
159+
this.achievement.happened_at = UTCDate;
159160
},
160161
},
161162
isImageTooLarge() {

0 commit comments

Comments
 (0)
This repository has been archived.