-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor Timestamp component / extract parseDate helper
- Loading branch information
Showing
16 changed files
with
146 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { parseDate } from './date'; | ||
|
||
describe('parseDate', () => { | ||
const expectedDate = new Date('2022-12-02T16:53Z'); | ||
|
||
test('should parse ISO date string', () => { | ||
expect(parseDate('2022-12-02T16:53Z')).toEqual(expectedDate); | ||
}); | ||
|
||
test('should parse ISO-like date string missing tz offset', () => { | ||
expect(parseDate('2022-12-02T16:53')).toEqual(expectedDate); | ||
}); | ||
|
||
test('should parse JS-style numeric date value', () => { | ||
expect(parseDate(1669999980000)).toEqual(expectedDate); | ||
}); | ||
|
||
test('should parse JS-style numeric value provided as string', () => { | ||
expect(parseDate('1669999980000')).toEqual(expectedDate); | ||
}); | ||
|
||
test('should parse unix epoch numeric value', () => { | ||
expect(parseDate(1669999980)).toEqual(expectedDate); | ||
}); | ||
|
||
test('should parse unix epoch string value', () => { | ||
expect(parseDate(1669999980)).toEqual(expectedDate); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.