refs #527 Change time format according to settings
This commit is contained in:
parent
46dc719666
commit
ab54cbac53
|
@ -4,6 +4,7 @@ export default {
|
|||
value: 0
|
||||
},
|
||||
Relative: {
|
||||
name: 'preferences.general.time_format.relative'
|
||||
name: 'preferences.general.time_format.relative',
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,10 +72,12 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import moment from 'moment'
|
||||
import { shell } from 'electron'
|
||||
import { findAccount, findLink, isTag } from '../../../../utils/link'
|
||||
import emojify from '~/src/renderer/utils/emojify'
|
||||
import TimeFormat from '~/src/constants/timeFormat'
|
||||
|
||||
export default {
|
||||
name: 'favourite',
|
||||
|
@ -104,6 +106,10 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
displayNameStyle: state => state.App.displayNameStyle,
|
||||
timeFormat: state => state.App.timeFormat
|
||||
}),
|
||||
shortcutEnabled: function () {
|
||||
return this.focused && !this.overlaid
|
||||
}
|
||||
|
@ -135,7 +141,12 @@ export default {
|
|||
}
|
||||
},
|
||||
parseDatetime (datetime) {
|
||||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
switch (this.timeFormat) {
|
||||
case TimeFormat.Absolute.value:
|
||||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
case TimeFormat.Relative.value:
|
||||
return moment(datetime).fromNow()
|
||||
}
|
||||
},
|
||||
tootClick (e) {
|
||||
if (isTag(e.target)) {
|
||||
|
|
|
@ -72,10 +72,12 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import moment from 'moment'
|
||||
import { shell } from 'electron'
|
||||
import { findAccount, findLink, isTag } from '../../../../utils/link'
|
||||
import emojify from '~/src/renderer/utils/emojify'
|
||||
import TimeFormat from '~/src/constants/timeFormat'
|
||||
|
||||
export default {
|
||||
name: 'reblog',
|
||||
|
@ -104,6 +106,9 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
timeFormat: state => state.App.timeFormat
|
||||
}),
|
||||
shortcutEnabled: function () {
|
||||
return this.focused && !this.overlaid
|
||||
}
|
||||
|
@ -135,7 +140,12 @@ export default {
|
|||
}
|
||||
},
|
||||
parseDatetime (datetime) {
|
||||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
switch (this.timeFormat) {
|
||||
case TimeFormat.Absolute.value:
|
||||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
case TimeFormat.Relative.value:
|
||||
return moment(datetime).fromNow()
|
||||
}
|
||||
},
|
||||
tootClick (e) {
|
||||
if (isTag(e.target)) {
|
||||
|
|
|
@ -120,6 +120,7 @@ import { shell, clipboard } from 'electron'
|
|||
import { mapState } from 'vuex'
|
||||
import { findAccount, findLink, isTag } from '../../../utils/link'
|
||||
import DisplayStyle from '~/src/constants/displayStyle'
|
||||
import TimeFormat from '~/src/constants/timeFormat'
|
||||
import emojify from '~/src/renderer/utils/emojify'
|
||||
|
||||
export default {
|
||||
|
@ -150,7 +151,8 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
displayNameStyle: state => state.App.displayNameStyle
|
||||
displayNameStyle: state => state.App.displayNameStyle,
|
||||
timeFormat: state => state.App.timeFormat
|
||||
}),
|
||||
shortcutEnabled: function () {
|
||||
return this.focused && !this.overlaid
|
||||
|
@ -210,7 +212,12 @@ export default {
|
|||
}
|
||||
},
|
||||
parseDatetime (datetime) {
|
||||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
switch (this.timeFormat) {
|
||||
case TimeFormat.Absolute.value:
|
||||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
case TimeFormat.Relative.value:
|
||||
return moment(datetime).fromNow()
|
||||
}
|
||||
},
|
||||
tootClick (e) {
|
||||
if (isTag(e.target)) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import { LightTheme, DarkTheme } from '../utils/theme'
|
|||
import Visibility from '~/src/constants/visibility'
|
||||
import DisplayStyle from '~/src/constants/displayStyle'
|
||||
import Theme from '~/src/constants/theme'
|
||||
import TimeFormat from '~/src/constants/timeFormat'
|
||||
|
||||
const App = {
|
||||
namespaced: true,
|
||||
|
@ -17,7 +18,8 @@ const App = {
|
|||
reblog: true,
|
||||
favourite: true,
|
||||
follow: true
|
||||
}
|
||||
},
|
||||
timeFormat: TimeFormat.Absolute.value
|
||||
},
|
||||
mutations: {
|
||||
updateTheme (state, themeKey) {
|
||||
|
@ -44,6 +46,9 @@ const App = {
|
|||
},
|
||||
updateNotify (state, notify) {
|
||||
state.notify = notify
|
||||
},
|
||||
updateTimeFormat (state, format) {
|
||||
state.timeFormat = format
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
@ -69,6 +74,7 @@ const App = {
|
|||
commit('updateFontSize', conf.general.fontSize)
|
||||
commit('updateTootVisibility', conf.general.tootVisibility)
|
||||
commit('updateNotify', conf.notification.notify)
|
||||
commit('updateTimeFormat', conf.general.timeFormat)
|
||||
resolve(conf)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue