update tickets date according selected language

This commit is contained in:
Guillermo Giuliana 2021-11-18 01:17:31 -03:00
parent 536ad35631
commit b4a6e1986b
2 changed files with 11 additions and 9 deletions

View File

@ -1,14 +1,16 @@
import moment from 'moment';
import sessionStore from 'lib-app/session-store';
const stringDateFormat = 'YYYYMMDDHHmm';
const localUTCMins = new Date().getTimezoneOffset();
const language = sessionStore.getConfigs().language;
export default {
stringDateToMoment(date) {
return moment(`${date}`, stringDateFormat);
},
momentToStringDate(date) {
return date.format(stringDateFormat);
return date.locale(language).format(stringDateFormat);
},
UTCDateToLocalNumericDate(date) {
return JSON.parse(this.momentToStringDate(this.stringDateToMoment(date).subtract(localUTCMins, 'minutes')));
@ -26,9 +28,9 @@ export default {
},
transformToString(date, expressive = true, retrunShortcutDate = false) {
const momentDateLocal = this.stringDateToMoment(JSON.stringify(this.UTCDateToLocalNumericDate(date)));
if(expressive) momentDateLocal.format('D MMMM YYYY');
if(retrunShortcutDate) return momentDateLocal.format('D MMM YYYY, HH:mm');
return momentDateLocal.format('D MMMM YYYY, HH:mm');
if(expressive) momentDateLocal.locale(language).format('D MMMM YYYY');
if(retrunShortcutDate) return momentDateLocal.locale(language).format('D MMM YYYY, HH:mm');
return momentDateLocal.locale(language).format('D MMMM YYYY, HH:mm');
},
getDate(date) {
return date < 10 ? `0${date}` : `${date}`;

View File

@ -9,14 +9,14 @@ class Language extends DataStore {
'de',
'fr',
'pt',
'jp',
'jp',//ja
'ru',
'cn',
'in',
'cn',//zh-cn
'in',//hi
'tr',
'it',
'br',
'gr',
'br',//pt porque br = Breton
'gr',//el
'nl',
'pl'
];