Skip to content

Commit

Permalink
fix(design-system): timezone differences
Browse files Browse the repository at this point in the history
Signed-off-by: Roy Scheeren <[email protected]>
  • Loading branch information
royscheeren committed Jan 15, 2024
1 parent 2fce3a9 commit c1f9fbb
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 129 deletions.
1 change: 1 addition & 0 deletions apps/design-system/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable */
process.env.TZ = 'GMT'
export default {
displayName: 'design-system',
preset: '../../jest.preset.js',
Expand Down
12 changes: 8 additions & 4 deletions apps/design-system/src/common/utils/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-disable no-global-assign */
/* eslint-disable no-native-reassign */

import '@testing-library/jest-dom'

import * as SUT from './utils'
Expand Down Expand Up @@ -48,6 +51,7 @@ describe('common/utils', () => {
['1970-01-01T00:00:00Z', 'January 1, 1970'],
['2021-09-27T10:26:14Z', 'September 27, 2021'],
])('should, with value %s, return %s as expected', (date, result) => {

// when ... we provide a value
// then ... it should return as expected
expect(SUT.formatDate(date)).toEqual(result)
Expand All @@ -67,10 +71,10 @@ describe('common/utils', () => {

describe('formatDateTime', () => {
it.each([
['1970-01-01T00:00:00Z', 'January 1, 1970 at 01:00 AM'],
['2021-09-27T10:26:14Z', 'September 27, 2021 at 12:26 PM'],
['2022-01-11 16:13:50', 'January 11, 2022 at 05:13 PM'],
['2022-01-11T16:13:50Z', 'January 11, 2022 at 05:13 PM'],
['1970-01-01T00:00:00Z', 'January 1, 1970 at 12:00 AM'],
['2021-09-27T10:26:14Z', 'September 27, 2021 at 10:26 AM'],
['2022-01-11 16:13:50', 'January 11, 2022 at 04:13 PM'],
['2022-01-11T16:13:50Z', 'January 11, 2022 at 04:13 PM'],
])('should, with value %s, return %s as expected', (date, result) => {
// when ... we provide a value
// then ... it should return as expected
Expand Down
4 changes: 0 additions & 4 deletions apps/design-system/src/common/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import { parseJSON } from 'date-fns'
import {
__,
compose,
concat,
divide,
equals,
flip,
gt,
join,
lt,
pipe,
prepend,
propSatisfies,
replace,
splitEvery,
subtract,
take,
takeLast,
toString,
when,
} from 'ramda'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@testing-library/react'
import { render } from '@testing-library/react'

import { noop } from '../../../common/utils'
import { ColorScheme } from '../../../types'
Expand Down
169 changes: 49 additions & 120 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c1f9fbb

Please sign in to comment.