Files
freeplanet/src/store/Modules/toolsext.ts
Paolo Arena c39f0d8486 - Enable Edit Event into dialog form ... (and save to the db)
- Event: enabled drag and drop (date)
- Q-Select components in every table field external: Where, Operators, etc...
- CMyEditor: Add HTML Editor to the details field !
- Added button Color for change font color to the text.
- Complete insert Events Site
2019-10-23 23:47:12 +02:00

79 lines
1.7 KiB
TypeScript

import { UserStore } from '@store'
import { date } from 'quasar'
export const toolsext = {
getLocale(vero?: boolean) {
if (UserStore) {
if (UserStore.state) {
return UserStore.state.lang
}
}
return process.env.LANG_DEFAULT
},
isLang(whichlang) {
const loc = func_tools.getLocale()
return (loc === whichlang)
}
}
export const func_tools = {
getLocale(vero?: boolean) {
if (UserStore) {
if (UserStore.state) {
return UserStore.state.lang
}
}
return ''
},
getDateStr(mydate) {
const DateFormatter = new Intl.DateTimeFormat(func_tools.getLocale() || void 0, {
weekday: 'short',
day: 'numeric',
month: 'long',
year: 'numeric'
// timeZone: 'UTC'
})
try {
console.log('mydate', mydate, DateFormatter)
if (DateFormatter) {
const date1 = new Date(mydate)
return DateFormatter.format(date1)
}
return mydate
}catch (e) {
return ''
}
},
getMinutesDuration(mydatestart, mydateend) {
return date.getDateDiff(mydateend, mydatestart, 'minutes')
},
getDateTimeShortStr(mydate) {
const DateFormatter = new Intl.DateTimeFormat(func_tools.getLocale() || void 0, {
hour: 'numeric',
minute: 'numeric',
day: 'numeric',
month: 'short'
// timeZone: 'UTC'
})
if (DateFormatter) {
const date = new Date(mydate)
return DateFormatter.format(date)
}
return mydate
}
}
// export const costanti_tools = {
// DateFormatter: new Intl.DateTimeFormat(func_tools.getLocale() || void 0, {
// weekday: 'long',
// day: 'numeric',
// month: 'long',
// year: 'numeric'
// // timeZone: 'UTC'
// })
// }