alex35mil / sourcebuster-js

Track the sources of your traffic
https://alexfedoseev.github.io/sbjs
MIT License
412 stars 92 forks source link

Patch timezone offset handling for UTC #37

Open dtflowers opened 3 years ago

dtflowers commented 3 years ago

This issue was first identified here: https://github.com/alexfedoseev/sourcebuster-js/issues/7 and was partially patched in this commit: https://github.com/alexfedoseev/sourcebuster-js/commit/d06a5dc1bb64597521e7d81df80e5d294ea95d62

Currently, however, if you pass 0 as an integer as the timezone_offset to try to standardize for UTC, the validation still fails to accept it because, as mentioned in the thread above, 0 is falsy and thus, the checkInt validation fails. (This line: https://github.com/alexfedoseev/sourcebuster-js/blob/master/src/js/params.js#L107)

This PR should at least be on the right track towards patching this, it seems to work for us.