fix: various fixes to things + simply app proxy sentry setup
This commit is contained in:
@@ -219,6 +219,37 @@ describe('Fluxer Markdown Parser', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test('timestamp at max js date boundary parses', () => {
|
||||
const input = '<t:8640000000000>';
|
||||
const parser = new Parser(input, 0);
|
||||
const {nodes: ast} = parser.parse();
|
||||
|
||||
expect(ast).toEqual([
|
||||
{
|
||||
type: NodeType.Timestamp,
|
||||
timestamp: 8640000000000,
|
||||
style: TimestampStyle.ShortDateTime,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test('timestamp above max js date boundary does not parse', () => {
|
||||
const input = '<t:8640000000001>';
|
||||
const parser = new Parser(input, 0);
|
||||
const {nodes: ast} = parser.parse();
|
||||
|
||||
expect(ast).toEqual([{type: NodeType.Text, content: input}]);
|
||||
});
|
||||
|
||||
test('timestamp that overflows to infinity does not parse', () => {
|
||||
const largeDigits = '9'.repeat(400);
|
||||
const input = `<t:${largeDigits}>`;
|
||||
const parser = new Parser(input, 0);
|
||||
const {nodes: ast} = parser.parse();
|
||||
|
||||
expect(ast).toEqual([{type: NodeType.Text, content: input}]);
|
||||
});
|
||||
|
||||
test('timestamp with leading zeros', () => {
|
||||
const input = '<t:0001618953630>';
|
||||
const flags = 0;
|
||||
|
||||
@@ -58,6 +58,15 @@ export function parseTimestamp(text: string): ParserResult | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
const timestampMillis = timestamp * 1000;
|
||||
if (!Number.isFinite(timestampMillis)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Number.isNaN(new Date(timestampMillis).getTime())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let style: TimestampStyle;
|
||||
if (stylePart !== undefined) {
|
||||
if (stylePart === '') {
|
||||
|
||||
Reference in New Issue
Block a user