Skip to content

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hmalik88 committed Dec 13, 2024
1 parent e6cb6aa commit 0e85a3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/snaps-rpc-methods/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ module.exports = deepmerge(baseConfig, {
],
coverageThreshold: {
global: {
branches: 92.8,
functions: 97.35,
lines: 97.35,
statements: 96.93,
branches: 92.83,
functions: 97.36,
lines: 97.92,
statements: 97.47,
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const ScheduleBackgroundEventsParametersStruct = object({
date: refine(string(), 'date', (val) => {
const date = DateTime.fromISO(val);
if (date.isValid) {
if (!val.endsWith('Z') || date.offset === 0) {
// luxon doesn't have a reliable way to check if timezone info was not provided
const count = val.split('').filter((char) => char === '-').length;
if (count !== 3 && !val.includes('+') && !val.endsWith('Z')) {
return 'ISO8601 string must have timezone information';
}
return true;
Expand Down

0 comments on commit 0e85a3d

Please sign in to comment.