Skip to content

Commit

Permalink
fixed tzOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingeek committed Dec 9, 2021
1 parent 0535692 commit 07fa7c4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flyingeek/lidojs",
"version": "1.6.23",
"version": "1.6.24",
"description": "convert Lido OFP text files",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion src/modules/iata2icao.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function tzOffset(iata, isoString) {
if (offset === 0) {
return "+0";
}
let res = (offset >= 0) ? '+' : '-';
let res = (offset >= 0) ? '+' : '';
res += offset.toFixed(1)
return (res.endsWith('.0')) ? res.slice(0, -2) : res;
}
Expand Down
1 change: 1 addition & 0 deletions test/iata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ test('tzOffset', () => {
expect(tzOffset('CDG', '2021-08-01T14:00Z')).toBe('+2');
expect(tzOffset('CDG', '2021-12-01T14:00Z')).toBe('+1');
expect(tzOffset('DEL', '2021-12-01T14:00Z')).toBe('+5.5');
expect(tzOffset('IAD', '2021-12-01T14:00Z')).toBe('-5');
});

0 comments on commit 07fa7c4

Please sign in to comment.