Change internal storage to number instead of Date

Summary: per title, for reasons see next diff :)

Reviewed By: passy

Differential Revision: D29327501

fbshipit-source-id: 548d943e90769af478232d3031d916fb399a067a
This commit is contained in:
Michel Weststrate
2021-06-29 08:02:53 -07:00
committed by Facebook GitHub Bot
parent d02c560150
commit aff02b2ca1
5 changed files with 24 additions and 18 deletions

View File

@@ -7,7 +7,7 @@
* @format
*/
import type {Crash, CrashLog} from './index';
import type {CrashLog} from './index';
import fs from 'fs';
import os from 'os';
import path from 'path';
@@ -29,7 +29,9 @@ export function parseIosCrash(content: string) {
const tmp1 = dateRegex2.exec(dateString);
const extractedDateString: string | null =
tmp1 && tmp1[0].length ? tmp1[0] : null;
const date = extractedDateString ? new Date(extractedDateString) : new Date();
const date = extractedDateString
? new Date(extractedDateString).getTime()
: Date.now();
const crash: CrashLog = {
callstack: content,
@@ -64,7 +66,7 @@ export function parsePath(content: string): string | null {
export function addFileWatcherForiOSCrashLogs(
serial: string,
reportCrash: (payload: CrashLog | Crash) => void,
reportCrash: (payload: CrashLog) => void,
) {
const dir = path.join(os.homedir(), 'Library', 'Logs', 'DiagnosticReports');
if (!fs.existsSync(dir)) {