Validate entries in personal access token "expires at" field

When creating a personal access token that expires on an invalid date (i.e., 999999), the access tokens settings becomes inaccesible.

https://sentry.gitlab.net/gitlab/gitlabcom/issues/630010/

PG::DatetimeFieldOverflow: ERROR:  date out of range for timestamp

  peek/views/pg.rb:17:in `async_exec'
    super(*args)
  peek/views/pg.rb:17:in `async_exec'
    super(*args)
  active_record/connection_adapters/postgresql_adapter.rb:600:in `block in exec_no_cache'
    log(sql, name, binds, type_casted_binds) { @connection.async_exec(sql, type_casted_binds) }
  active_record/connection_adapters/abstract_adapter.rb:590:in `block in log'
    connection_id:     object_id) { yield }
  active_support/notifications/instrumenter.rb:21:in `instrument'
    yield payload
...
(195 additional frame(s) were not displayed)

ActiveRecord::StatementInvalid: PG::DatetimeFieldOverflow: ERROR:  date out of range for timestamp
: SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."user_id" = 3170304 AND "personal_access_tokens"."impersonation" = 'f' AND (revoked = false AND (expires_at >= NOW() OR expires_at IS NULL)) ORDER BY "personal_access_tokens"."expires_at" ASC
ActionView::Template::Error: PG::DatetimeFieldOverflow: ERROR:  date out of range for timestamp
: SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."user_id" = 3170304 AND "personal_access_tokens"."impersonation" = 'f' AND (revoked = false AND (expires_at >= NOW() OR expires_at IS NULL)) ORDER BY "personal_access_tokens"."expires_at" ASC

ActionView::Template::Error: PG::DatetimeFieldOverflow: ERROR:  date out of range for timestamp
: SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."user_id" = 3170304 AND "personal_access_tokens"."impersonation" = 'f' AND (revoked = false AND (expires_at >= NOW() OR expires_at IS NULL)) ORDER BY "personal_access_tokens"."expires_at" ASC
Assignee Loading
Time tracking Loading