diff --git a/web/pgadmin/browser/server_groups/servers/roles/__init__.py b/web/pgadmin/browser/server_groups/servers/roles/__init__.py index 126def1af..eda02c4f7 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/roles/__init__.py @@ -133,6 +133,20 @@ class RoleView(PGChildNodeView): _("Name must be specified.") ) + if u'rolvaliduntil' in data: + # Make date explicit so that it works with every + # postgres database datestyle format + try: + if data[u'rolvaliduntil'] is not None: + date = datetime.datetime.strptime( + data[u'rolvaliduntil'], '%m/%d/%Y' + ) + data[u'rolvaliduntil'] = date.strftime("%d-%B-%Y") + except Exception as e: + return precondition_required( + _("Date format is invalid.") + ) + if u'rolconnlimit' in data: if data[u'rolconnlimit'] is not None: data[u'rolconnlimit'] = int(data[u'rolconnlimit']) diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/role/js/role.js b/web/pgadmin/browser/server_groups/servers/roles/templates/role/js/role.js index 1b73536bd..48cd940f7 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/templates/role/js/role.js +++ b/web/pgadmin/browser/server_groups/servers/roles/templates/role/js/role.js @@ -403,10 +403,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { return false; } },{ - id: 'rolvaliduntil', disabled: 'readonly', type: 'date', + id: 'rolvaliduntil', disabled: 'readonly', type: 'text', group: '{{ _('Definition') }}', label: '{{ _('Account Expires') }}', cell: 'string', mode: ['properties', 'edit', 'create'], retype: true, - deps: ['rolcanlogin'], options: {} + deps: ['rolcanlogin'], options: {}, control: 'datepicker' },{ id: 'rolconnlimit', type: 'int', group: '{{ _('Definition') }}', label: '{{ _('Connection Limit') }}', cell: 'number',