Skip to content

Commit

Permalink
added fractional offset support
Browse files Browse the repository at this point in the history
  • Loading branch information
rharshit82 committed Aug 12, 2023
1 parent 9dbe962 commit 0673fc6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ function CronTime(luxon) {
: this.utcOffset;
offset = parseInt(offset);

const remainderMins = Math.abs(this.utcOffset - offset * 60);

let utcZone = 'UTC';
if (offset < 0) {
utcZone += offset;
} else if (offset > 0) {
utcZone += `+${offset}`;
if (offset < 0 || remainderMins > 0) {
utcZone += `${offset}:${remainderMins}`;
} else if (offset > 0 || remainderMins > 0) {
utcZone += `+${offset}:${remainderMins}`;
}

date = date.setZone(utcZone);
Expand Down

0 comments on commit 0673fc6

Please sign in to comment.