fix: handle undefined dateString

This commit is contained in:
phamhieu authored and Hieu Pham committed 2022-05-18 20:14:20 +07:00
1 parent e2c42a0c7a
commit 415bd9989c
1 file changed
+2 -2
@@ -14,10 +14,10 @@ import { detectBrowser } from 'lib/helpers'
* this util here for now. But if it does happen elsewhere i'll bring it
* to lib/helpers
*/
export const formatUserDateString = (dateString: string) => {
export const formatUserDateString = (dateString?: string) => {
const browser = detectBrowser()
if (browser === 'Safari') {
return dateString.replace(' ', 'T')
return dateString?.replace(' ', 'T')
} else {
return dateString
}