Skip to content

Commit

Permalink
Fix verbose DOW specified with * DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymholt committed Jun 25, 2019
1 parent f795a7a commit 1d35ba4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/expressionDescriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ export class ExpressionDescriptor {
let offSetDays = lastDayOffSetMatches[1];
description = StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(), offSetDays);
break;
} else if (expression == "*" && this.expressionParts[5] != "*"){
// * dayOfMonth and dayOfWeek specified so use dayOfWeek verbiage instead
return "";
} else {
description = this.getSegmentDescription(
expression,
Expand Down
8 changes: 4 additions & 4 deletions test/cronstrue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ describe("Cronstrue", function() {
it("0 * ? * 2/1", function() {
assert.equal(construe.toString(this.test.title), "Every hour, Tuesday through Saturday");
});

it("0 52 13 ? * 3/1", function() {
assert.equal(construe.toString(this.test.title), "At 01:52 PM, Wednesday through Saturday");
});
});

describe("ranges", function() {
Expand Down Expand Up @@ -482,6 +478,10 @@ describe("Cronstrue", function() {
it("30 4 1 * *", function() {
assert.equal(construe.toString(this.test.title, { verbose: true }), "At 04:30 AM, on day 1 of the month");
});

it("0 13 * * 1", function() {
assert.equal(construe.toString(this.test.title, { verbose: true}), "At 01:00 PM, only on Monday");
});
});

describe("errors", function() {
Expand Down

0 comments on commit 1d35ba4

Please sign in to comment.