Skip to content

Commit e142de3

Browse files
authored
Remove support for tzOffset option (#347)
1 parent 901f3d7 commit e142de3

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

src/expressionDescriptor.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export class ExpressionDescriptor {
3939
monthStartIndexZero = false,
4040
use24HourTimeFormat,
4141
locale = null,
42-
tzOffset = 0,
4342
}: Options = {}
4443
): string {
4544
// We take advantage of Destructuring Object Parameters (and defaults) in TS/ES6 and now we will reassemble back to
@@ -52,11 +51,10 @@ export class ExpressionDescriptor {
5251
monthStartIndexZero: monthStartIndexZero,
5352
use24HourTimeFormat: use24HourTimeFormat,
5453
locale: locale,
55-
tzOffset: tzOffset,
5654
};
5755

5856
if (options.tzOffset) {
59-
console.warn(`'tzOffset' option has been deprecated and will be removed in a future release.`);
57+
console.warn(`'tzOffset' option has been deprecated and is no longer supported.`);
6058
}
6159

6260
let descripter = new ExpressionDescriptor(expression, options);
@@ -328,22 +326,6 @@ export class ExpressionDescriptor {
328326
}
329327

330328
let parsedExp = parseInt(exp);
331-
if (this.options.tzOffset) {
332-
const hourExpression = this.expressionParts[2];
333-
let hour: number = parseInt(hourExpression) + (this.options.tzOffset ? this.options.tzOffset : 0);
334-
if (hour >= 24) {
335-
parsedExp++;
336-
} else if (hour < 0) {
337-
parsedExp--;
338-
}
339-
340-
if (parsedExp > 6) {
341-
parsedExp = 0;
342-
} else if (parsedExp < 0) {
343-
parsedExp = 6;
344-
}
345-
}
346-
347329
let description = this.i18n.daysOfTheWeekInCase
348330
? this.i18n.daysOfTheWeekInCase(form)[parsedExp]
349331
: daysOfWeekNames[parsedExp];
@@ -667,16 +649,6 @@ export class ExpressionDescriptor {
667649
let hourOffset: number = 0;
668650
let minuteOffset: number = 0;
669651

670-
if (this.options.tzOffset) {
671-
hourOffset = this.options.tzOffset > 0 ? Math.floor(this.options.tzOffset) : Math.ceil(this.options.tzOffset);
672-
673-
minuteOffset = parseFloat((this.options.tzOffset % 1).toFixed(2));
674-
675-
if (minuteOffset != 0) {
676-
minuteOffset *= 60;
677-
}
678-
}
679-
680652
let hour: number = parseInt(hourExpression) + hourOffset;
681653
let minute: number = parseInt(minuteExpression) + minuteOffset;
682654

src/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface Options {
77
locale?: string | null;
88

99
/**
10-
* @deprecated Timezone offset in minutes.
10+
* @deprecated (DEPRECATED DO NOT USE) Timezone offset in minutes.
1111
*/
1212
tzOffset?: number;
1313
}

0 commit comments

Comments
 (0)