mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
update tickets date according selected language
This commit is contained in:
parent
536ad35631
commit
b4a6e1986b
@ -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}`;
|
||||
|
@ -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'
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user