brave / ads-ui

Self-service ads UI
Mozilla Public License 2.0
23 stars 11 forks source link

chore: replace date-fns and moment with dayjs #1134

Closed tackley closed 6 months ago

tackley commented 6 months ago

Remove date-fns and moment, replacing with dayjs.

A couple of annoyances resolved at the same time:

Both cluttered the console log which made proving this was working more annoying than it should be.

Resolves #1126

github-actions[bot] commented 6 months ago

[puLL-Merge] - brave/ads-ui@1134

Description

This Pull Request (PR) introduces several significant changes, primarily focusing on replacing the moment, date-fns, and date-fns-tz libraries with dayjs for handling dates and times across the project. This transition involves adjustments in the usage of date and time functions, formatting, and parsing throughout various components and utilities. Additionally, the PR includes updates to package dependencies and enhancements in data grid display configurations such as customizable page size options. Another notable change is the removal of the version logging from the App.tsx component to the index.tsx setup, applying a structured approach to log the application's version information upon initialization.

Changes ### Changes #### `package.json` - Removed dependencies: `@date-io/moment`, `date-fns`, `date-fns-tz`, `moment` - Added `dayjs` dependency and adjusted the version of `npm-audit-resolver` #### Various Components and Utilities (`*.tsx`, `*.ts`) - Migrated from `moment` and `date-fns` to `dayjs` for date handling, affecting multiple files across the project. Modifications entail updating import statements, replacing date manipulation, parsing, and formatting functions with equivalent `dayjs` implementations. - Enhanced data grids by adding `pageSizeOptions` configuration in several components, allowing adjustable display of data entries. #### Configuration and Initialization Files - Added a new file `src/init_dayjs.ts` that imports `dayjs` and its plugins, setting up the extended functionality such as timezone support and advanced formatting capabilities globally. - Moved version logging from `App.tsx` to `index.tsx`, standardizing the approach to include revision and build time information. Adjustments involve utilizing the `VERSION` object exported from `util/version.ts`.

Security Hotspots