Migrate from deprecated moment to luxon

This commit is contained in:
Haelwenn (lanodan) Monnier 2022-08-14 17:58:56 +02:00
parent 1d7edf2f4b
commit fbc293b995
7 changed files with 16 additions and 19 deletions

View file

@ -48,7 +48,7 @@
"lodash": "4.17.21",
"lodash.debounce": "4.0.8",
"marked": "0.8.2",
"moment": "2.29.4",
"luxon": "3.0.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"numeral": "2.0.6",

View file

@ -51,8 +51,7 @@
</template>
<script>
import moment from 'moment'
import { DateTime } from 'luxon'
export default {
name: 'ChatMessage',
props: {
@ -79,7 +78,7 @@ export default {
return account[property]
},
parseTimestamp(timestamp) {
return moment(timestamp).format('YYYY-MM-DD HH:mm')
return DateTime.fromISO(timestamp).toFormat('yyyy-MM-dd HH:mm')
},
deleteMessage() {
this.$confirm('Are you sure you want to delete this message?', 'Warning', {

View file

@ -135,8 +135,7 @@
</template>
<script>
import moment from 'moment'
import { DateTime } from 'luxon'
export default {
name: 'Status',
props: {
@ -233,7 +232,7 @@ export default {
return +(pollOption.votes_count / allVotes * 100).toFixed(1)
},
parseTimestamp(timestamp) {
return moment(timestamp).format('YYYY-MM-DD HH:mm')
return DateTime.fromISO(timestamp).toFormat('yyyy-MM-dd HH:mm')
},
propertyExists(account, property, _secondProperty) {
if (_secondProperty) {

View file

@ -61,7 +61,7 @@
</template>
<script>
import moment from 'moment'
import { DateTime } from 'luxon'
import _ from 'lodash'
import debounce from 'lodash.debounce'
import RebootButton from '@/components/RebootButton'
@ -128,7 +128,7 @@ export default {
this.$store.dispatch('FetchModerationLog', filters)
},
normalizeTimestamp(timestamp) {
return moment(timestamp * 1000).format('YYYY-MM-DD HH:mm')
return DateTime.fromSeconds(timestamp).toFormat('yyyy-MM-dd HH:mm')
},
propertyExists(account, property) {
return account[property]

View file

@ -29,8 +29,7 @@
</template>
<script>
import moment from 'moment'
import { DateTime } from 'luxon'
export default {
name: 'NoteCard',
props: {
@ -63,7 +62,7 @@ export default {
})
},
parseTimestamp(timestamp) {
return moment(timestamp).format('YYYY-MM-DD HH:mm')
return DateTime.fromISO(timestamp).toFormat('yyyy-MM-dd HH:mm')
},
propertyExists(account, property) {
return account[property]

View file

@ -50,7 +50,7 @@
</template>
<script>
import moment from 'moment'
import { DateTime } from 'luxon'
import ModerateUserDropdown from './ModerateUserDropdown'
import ReportContent from './ReportContent'
@ -98,7 +98,7 @@ export default {
this.$store.dispatch('FetchReports', page)
},
parseTimestamp(timestamp) {
return moment(timestamp).format('L HH:mm')
return DateTime.fromISO(timestamp).toFormat('yyyy-MM-dd HH:mm')
},
propertyExists(account, property, _secondProperty) {
if (_secondProperty) {

View file

@ -6919,6 +6919,11 @@ lru-cache@^5.1.1:
dependencies:
yallist "^3.0.2"
luxon@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.0.1.tgz#6901111d10ad06fd267ad4e4128a84bef8a77299"
integrity sha512-hF3kv0e5gwHQZKz4wtm4c+inDtyc7elkanAsBq+fundaCdUBNJB1dHEGUZIM6SfSBUlbVFduPwEtNjFK8wLtcw==
make-dir@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c"
@ -7216,11 +7221,6 @@ mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.6, mkdirp@~
dependencies:
minimist "^1.2.6"
moment@2.29.4:
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"