The React SDK Components repo is used to create the @pega/react-sdk-components and @pega/react-sdk-overrides npm packages used by the Pega Constellation React SDK. These packages provide the initial set of components used by the React SDK to render DX Components with a design system other than Pega Constellation design system.
The getDateObject function in @pega/react-sdk-components/src/components/helpers/formatters/index.ts interprets DateTime strings (such as "20240814T080200.000 GMT") in the local user timezone, despite the value provided clearly being in GMT.
To Reproduce
Steps to reproduce the behavior:
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
console.log(format('20240814T080200.000 GMT', 'DateTime', {timezone: 'Europe/Amsterdam'}));
// The expected output (in Europe/Amsterdam timezone) would be:
// "Aug 14, 2024 10:02 AM"
// The actual result is
// "Aug 14, 2024 12:02 PM"
Note that, the "actual result" will differ if you run this code from a different timezone, because the input string is parsed in your local timezone regardless of all other things.
Expected behavior
See above
Screenshots
Not applicable
Desktop (please complete the following information):
OS: MacOS 14.3.1 (23D60)
Browser: Chrome
Version: 126.0.6478.183
(this is not relevant)
Smartphone (please complete the following information):
Not relevant
Additional context
I will create a pull request to fix this
Describe the bug https://github.com/pegasystems/react-sdk-components/blob/e4b31d449f0d9e36afc0058b5ee5bd905ffc5365/packages/react-sdk-components/src/components/helpers/formatters/index.ts#L12
The getDateObject function in
@pega/react-sdk-components/src/components/helpers/formatters/index.ts
interprets DateTime strings (such as"20240814T080200.000 GMT"
) in the local user timezone, despite the value provided clearly being in GMT.To Reproduce Steps to reproduce the behavior:
Note that, the "actual result" will differ if you run this code from a different timezone, because the input string is parsed in your local timezone regardless of all other things.
Expected behavior See above
Screenshots Not applicable
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context I will create a pull request to fix this