Pass the app timezone for conversions
This commit is contained in:
parent
706f0637f4
commit
d49cef2201
|
|
@ -1727,9 +1727,11 @@ this.$el.one('dispose-control',this.proxy(this.dispose))}
|
|||
DateTimeConverter.prototype.initDefaults=function(){if(!this.options.timezone){this.options.timezone=$('meta[name="backend-timezone"]').attr('content')}
|
||||
if(!this.options.locale){this.options.locale=$('meta[name="backend-locale"]').attr('content')}
|
||||
if(!this.options.format){this.options.format='llll'}
|
||||
if(this.options.formatAlias){this.options.format=this.getFormatFromAlias(this.options.formatAlias)}}
|
||||
if(this.options.formatAlias){this.options.format=this.getFormatFromAlias(this.options.formatAlias)}
|
||||
this.appTimezone=$('meta[name="app-timezone"]').attr('content')
|
||||
if(!this.appTimezone){this.appTimezone='UTC'}}
|
||||
DateTimeConverter.prototype.getDateTimeValue=function(){this.datetime=this.$el.attr('datetime')
|
||||
var momentObj=moment(this.datetime),result
|
||||
var momentObj=moment.tz(this.datetime,this.appTimezone),result
|
||||
if(this.options.locale){moment.locale(this.options.locale)}
|
||||
if(this.options.timezone){momentObj=momentObj.tz(this.options.timezone)}
|
||||
if(this.options.timeSince){result=momentObj.fromNow()}
|
||||
|
|
|
|||
|
|
@ -67,11 +67,17 @@
|
|||
if (this.options.formatAlias) {
|
||||
this.options.format = this.getFormatFromAlias(this.options.formatAlias)
|
||||
}
|
||||
|
||||
this.appTimezone = $('meta[name="app-timezone"]').attr('content')
|
||||
if (!this.appTimezone) {
|
||||
this.appTimezone = 'UTC'
|
||||
}
|
||||
}
|
||||
|
||||
DateTimeConverter.prototype.getDateTimeValue = function() {
|
||||
this.datetime = this.$el.attr('datetime')
|
||||
var momentObj = moment(this.datetime),
|
||||
|
||||
var momentObj = moment.tz(this.datetime, this.appTimezone),
|
||||
result
|
||||
|
||||
if (this.options.locale) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=0, minimal-ui">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="app-timezone" content="<?= e(Config::get('app.timezone')) ?>">
|
||||
<meta name="backend-base-path" content="<?= Backend::baseUrl() ?>">
|
||||
<meta name="backend-timezone" content="<?= e(Backend\Models\Preferences::get('timezone')) ?>">
|
||||
<meta name="backend-locale" content="<?= e(Backend\Models\Preferences::get('locale')) ?>">
|
||||
|
|
|
|||
Loading…
Reference in New Issue