Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-238932: Validate maxDate and minDate before running command #2794

Merged
merged 8 commits into from Mar 22, 2024

Conversation

blva
Copy link
Contributor

@blva blva commented Mar 21, 2024

Proposed changes

Jira ticket: CLOUDP-238932

closes #2793

❯ atlasdev  events projects list --output json --projectId  5efda6aea3f2ed2e7dd6ce05 --maxDate 2024-03-18T15:00:03+00:00Z --minDate 2024-03-18T14:40:03+00:00Z --limit 1 --page 1
Error: parsing time "2024-03-18T15:00:03+00:00Z" as "2006-01-02T15:04:05-0700": cannot parse "+00:00Z" as "-0700", supported timestamp formats examples: 2006-01-02T15:04:05Z07:00, 2006-01-02T15:04:05-0700

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have updated test/README.md (if an e2e test has been added)
  • I have run make fmt and formatted my code

Further comments

@blva blva marked this pull request as ready for review March 21, 2024 17:49
@blva blva requested a review from a team as a code owner March 21, 2024 17:49
@blva blva linked an issue Mar 21, 2024 that may be closed by this pull request
internal/cli/atlas/events/orgs_list.go Outdated Show resolved Hide resolved
Comment on lines 82 to 84
if p.MaxDate, err = opts.ParseDate(opts.MaxDate); err != nil {
return p, err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if p.MaxDate, err = opts.ParseDate(opts.MaxDate); err != nil {
return p, err
}
if opts.MaxDate != "" {
if p.MaxDate, err = opts.ParseDate(opts.MaxDate); err != nil {
return nil, err
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see ParseDate is now empty safe, then this may not be needed

internal/cli/atlas/events/orgs_list.go Outdated Show resolved Hide resolved
internal/cli/atlas/events/orgs_list.go Outdated Show resolved Hide resolved
internal/cli/atlas/events/orgs_list_test.go Outdated Show resolved Hide resolved
internal/cli/atlas/events/projects_list.go Outdated Show resolved Hide resolved
@blva blva requested a review from gssbzn March 22, 2024 11:28
internal/cli/atlas/events/list.go Outdated Show resolved Hide resolved
internal/cli/atlas/events/list.go Outdated Show resolved Hide resolved
@blva blva requested a review from gssbzn March 22, 2024 11:47
gssbzn
gssbzn previously approved these changes Mar 22, 2024
Copy link
Collaborator

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@@ -54,7 +54,7 @@ func TestEvents(t *testing.T) {
orgEntity,
"list",
"--omitCount",
"--minDate="+time.Now().Add(-time.Hour*time.Duration(24)).Format("2006-01-02"),
"--minDate="+time.Now().Add(-time.Hour*time.Duration(24)).Format("2006-01-02T15:04:05-0700"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙃

@blva blva merged commit 869f069 into master Mar 22, 2024
17 checks passed
@blva blva deleted the CLOUDP-238932 branch March 22, 2024 13:09
@fmenezes fmenezes mentioned this pull request Apr 5, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date range filter not working
2 participants