Fix timezone issue in expense item form

Dates being added with 00:00 time still carry the timezone set for the
OS/browser, and thus get changed to the previous day when in a positive
offset zone. This change removes the timezone offset entirely when
adding the line item, so that the chosen date is always assumed to be in
UTC time.

fixes #204
This commit is contained in:
Râu Cao
2022-12-30 22:20:16 +07:00
parent 08bedda288
commit f8cc453d7e
+4 -1
View File
@@ -63,7 +63,10 @@ export default class AddExpenseItemComponent extends Component {
let dateInput = (this.date instanceof Array) ?
this.date[0] : this.date;
const [ date ] = dateInput.toISOString().split('T');
const [ date ] = moment(dateInput).utcOffset(0, true)
.toISOString()
.split('T');
const isValid = this.validateForm();
if (!isValid) return false;