Skip to content

Commit cabc8a2

Browse files
authored
Merge pull request #2210 from nextcloud/feature/apply-users-timezone
Enhancement: Apply user's timezone to meta fields
2 parents a17128b + 78f8131 commit cabc8a2

7 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/modules/main/partials/ColumnInfoPopover.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export default {
7272
},
7373
methods: {
7474
relativeDateTime(v) {
75-
return moment(v).format('L') === moment().format('L') ? t('tables', 'Today') + ' ' + moment(v).format('LT') : moment(v).format('LLLL')
75+
const value = moment.utc(v).local()
76+
return value.format('L') === moment().format('L') ? t('tables', 'Today') + ' ' + value.format('LT') : value.format('LLLL')
7677
},
7778
},
7879
}

src/shared/components/ncTable/mixins/columnsTypes/datetime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default class DatetimeColumn extends AbstractDatetimeColumn {
1919
}
2020

2121
formatValue(value) {
22-
return Moment(value, 'YYYY-MM-DD HH:mm:ss').format('lll')
22+
return Moment.utc(value, 'YYYY-MM-DD HH:mm:ss').local().format('lll')
2323
}
2424

2525
sort(mode, nextSorts) {

src/shared/components/ncTable/mixins/columnsTypes/datetimeDate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class DatetimeDateColumn extends AbstractDatetimeColumn {
1515
}
1616

1717
formatValue(value) {
18-
return Moment(value, 'YYYY-MM-DD HH:mm:ss').format('ll')
18+
return Moment.utc(value, 'YYYY-MM-DD HH:mm:ss').local().format('ll')
1919
}
2020

2121
sort(mode, nextSorts) {

src/shared/components/ncTable/mixins/columnsTypes/datetimeTime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class DatetimeTimeColumn extends AbstractDatetimeColumn {
1515
}
1616

1717
formatValue(value) {
18-
return Moment(value, 'HH:mm:ss').format('LT')
18+
return Moment.utc(value, 'HH:mm:ss').local().format('LT')
1919
}
2020

2121
sort(mode, nextSorts) {

src/shared/components/ncTable/partials/TableCellDateTime.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export default {
171171
newValue = 'none'
172172
} else {
173173
const format = this.getDateFormat()
174-
newValue = Moment(this.editDateTimeValue).format(format)
174+
newValue = Moment(this.editDateTimeValue).utc().format(format)
175175
}
176176
177177
if (newValue === this.value) {

src/shared/components/ncTable/partials/rowTypePartials/DatetimeForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default {
5959
} else if (!v) {
6060
this.$emit('update:value', this.isMandatoryField ? null : 'none')
6161
} else {
62-
this.$emit('update:value', Moment(v).format('YYYY-MM-DD HH:mm'))
62+
this.$emit('update:value', Moment(v).utc().format('YYYY-MM-DD HH:mm'))
6363
}
6464
},
6565
},

src/shared/components/ncTable/partials/rowTypePartials/DatetimeTimeForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default {
6363
if (v === 'none') {
6464
this.$emit('update:value', v)
6565
} else if (v) {
66-
this.$emit('update:value', Moment(v).format('HH:mm'))
66+
this.$emit('update:value', Moment(v).utc().format('HH:mm'))
6767
}
6868
},
6969
},

0 commit comments

Comments
 (0)