fix: 修复时间兼容firefox

This commit is contained in:
jym503558564
2020-07-07 18:40:07 +08:00
parent 37cce2effd
commit dac04cfa61
7 changed files with 23 additions and 9 deletions

View File

@@ -157,3 +157,10 @@ export function setUrlParam(url, name, value) {
}
return url
}
export function getDayFuture(days, now) {
if (!now) {
now = new Date()
}
return new Date(now.getTime() + 3600 * 1000 * 24 * days)
}

View File

@@ -6,6 +6,7 @@
import { GenericCreateUpdatePage } from '@/layout/components'
import AssetPermissionFormActionField from './components/AssetPermissionFormActionField'
import AssetSelect from '@/components/AssetSelect'
import { getDayFuture } from '@/utils/common'
export default {
components: {
@@ -24,8 +25,8 @@ export default {
initial: {
is_active: true,
actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file'],
date_start: this.$moment().format('YYYY-MM-DD HH:mm:ss ZZ'),
date_expired: '2099-12-31 00:00:00 +0800',
date_start: new Date().toISOString(),
date_expired: getDayFuture(36500, new Date()).toISOString(),
nodes: nodesInitial,
assets: assetsInitial
},

View File

@@ -4,6 +4,8 @@
<script>
import { GenericCreateUpdatePage } from '@/layout/components'
import { getDayFuture } from '@/utils/common'
export default {
components: {
GenericCreateUpdatePage
@@ -12,8 +14,8 @@ export default {
return {
initial: {
is_active: true,
date_start: this.$moment().format('YYYY-MM-DD HH:mm:ss ZZ'),
date_expired: '2099-12-31 00:00:00 +0800'
date_start: new Date().toISOString(),
date_expired: getDayFuture(36500, new Date()).toISOString()
},
fields: [
[this.$t('common.' + 'Basic'), ['name']],

View File

@@ -4,6 +4,8 @@
<script>
import { GenericCreateUpdatePage } from '@/layout/components'
import { getDayFuture } from '@/utils/common'
export default {
components: {
GenericCreateUpdatePage
@@ -12,8 +14,8 @@ export default {
return {
initial: {
is_active: true,
date_start: this.$moment().format('YYYY-MM-DD HH:mm:ss ZZ'),
date_expired: '2099-12-31 00:00:00 +0800'
date_start: new Date().toISOString(),
date_expired: getDayFuture(36500, new Date()).toISOString()
},
fields: [
[this.$t('common.Basic'), ['name']],

View File

@@ -5,6 +5,7 @@
<script>
import { GenericCreateUpdatePage } from '@/layout/components'
import UserPassword from '@/components/UserPassword'
import { getDayFuture } from '@/utils/common'
export default {
components: {
@@ -17,7 +18,7 @@ export default {
mfa_level: 0,
source: 'local',
role: 'User',
date_expired: '2099-12-31 00:00:00 +0800'
date_expired: getDayFuture(36500, new Date()).toISOString()
},
fields: [
[this.$t('users.Account'), ['name', 'username', 'email', 'groups']],

View File

@@ -14,6 +14,7 @@ import { mapGetters } from 'vuex'
import { GenericListPage } from '@/layout/components'
import { GenericUpdateFormDialog } from '@/layout/components'
import { createSourceIdCache } from '@/api/common'
import { getDayFuture } from '@/utils/common'
export default {
components: {
@@ -123,7 +124,7 @@ export default {
},
formSetting: {
initial: {
date_expired: '2099-12-31 00:00:00 +0800'
date_expired: getDayFuture(36500, new Date()).toISOString()
},
fields: [
'groups', 'date_expired', 'comment'