Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/time/src/tests/isValidDate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {isValidDate} from '../utils/isValidDate';
describe('isValidDate', () => {
test('should return true for a valid date', () => {
expect(isValidDate(new Date())).toBe(true);
});
})

test('should return false for an invalid date', () => {
expect(isValidDate(new Date("invalid"))).toBe(false);
Expand All @@ -13,4 +13,4 @@ describe('isValidDate', () => {
test("should return false for null", () => {
expect(isValidDate(null)).toBe(false);
});
});
});
6 changes: 3 additions & 3 deletions packages/time/src/tests/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ describe('parse', () => {
});

test('should throw an error for an invalid date string', () => {
expect(() => parse('2021-15-37')).toThrowError('"2021-15-37" is an invalid RFC339 Internet Date Time string');
expect(() => parse('2021-15-37')).toThrowError('"2021-15-37" is an invalid RFC3339 Internet Date Time string');
});

test('should throw an error for an invalid time string', () => {
expect(() => parse('27:62')).toThrowError('"27:62" is an invalid RFC339 Internet Date Time string');
expect(() => parse('27:62')).toThrowError('"27:62" is an invalid RFC3339 Internet Date Time string');
});

test('should throw an error for an invalid time string', () => {
Expand All @@ -123,7 +123,7 @@ describe('parse', () => {
});

test('should throw an error for an invalid date string', () => {
expect(() => parse('2021-01-01T00:00:00.000')).toThrowError('"2021-01-01T00:00:00.000" is an invalid RFC339 Internet Date Time string');
expect(() => parse('2021-01-01T00:00:00.000')).toThrowError('"2021-01-01T00:00:00.000" is an invalid RFC3339 Internet Date Time string');
});

test('should throw an error for an invalid time string', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/time/src/utils/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function parseDateTimeString(value: string): Date {
`${year}-${month}-${day}T${hour}:${minute}:${second}.${millisecond}${timezone}`,
);
}
throw new Error(`"${value}" is an invalid RFC339 Internet Date Time string`);
throw new Error(`"${value}" is an invalid RFC3339 Internet Date Time string`);
}

/**
Expand Down