Skip to content

Conversation

@AbhishekA1509
Copy link
Member

@AbhishekA1509 AbhishekA1509 commented Dec 1, 2025

Description

This pull request refactors the way expiration dates are handled for API tokens, moving from using moment and custom types to a more standardized approach with dayjs and shared types from the common library. The changes improve type safety, maintainability, and UI consistency for selecting and displaying expiration dates.

Expiration date handling and UI improvements:

  • Replaced moment and custom date types with dayjs and standardized types (ExpirationDateSelectOptionType) throughout API token components, including CreateAPIToken, EditAPIToken, and RegenerateModal. [1] [2] [3] [4] [5] [6] [7]
  • Updated the expiration date picker to use the shared DateTimePicker component and improved option handling with typed values, enhancing the UI and code reliability. [1] [2] [3]
  • Standardized date formatting across the API token list and edit screens using DATE_TIME_FORMATS from the common library, ensuring consistent display of dates. [1] [2] [3] [4] [5]
  • Improved type safety for expiration date selection and custom date handling in state and props, replacing loose objects and numbers with explicit types. [1] [2] [3] [4]

Dependency cleanup:

  • Removed unused react-dates and its type definitions from package.json, as date handling is now done via shared components and libraries. [1] [2]

Fixes https://github.com/devtron-labs/sprint-tasks/issues/2714

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

- Introduced a new DateTimePicker component to replace the existing SingleDatePicker and DayPickerRangeController.
- Updated DeploymentMetrics and CustomLogsModal to utilize the new DateTimePicker for date selection.
- Removed unused styles and components related to the old date picker implementation.
- Added utility functions for generating date range options for the new date picker.
- Cleaned up imports and adjusted type definitions to accommodate the new date handling logic.
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP }404).\n

@github-actions github-actions bot added the PR:Issue-verification-failed PR:Issue-verification-failed label Dec 1, 2025
@AbhishekA1509 AbhishekA1509 changed the title feat: Refactor date picker components and remove deprecated code feat: refactor date picker components and remove deprecated code Dec 1, 2025
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP }404).\n

@github-actions github-actions bot added PR:Ready-to-Review PR:Ready-to-Review and removed PR:Issue-verification-failed PR:Issue-verification-failed labels Dec 1, 2025
…, GraphModal, and DeploymentMetrics components
startDate: startStr,
endDate: 'now',
})
const str = getCalendarValue(startStr, 'now')
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to check if now-5m and now - 5m are same?

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR:Ready-to-Review PR:Ready-to-Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants