question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

next() and prev() are not symmetrical; prev() is skipping a day that next() includes.

See original GitHub issue

Expected Behavior

A call to next() is symmetrical with a call to prev().

Actual Behavior

A call to next() produces Sat whereas a call to prev() skips Sat and instead produces Fri.

var cronParser = require("cron-parser")

const options = {
    currentDate: new Date("Tue 03 Jan 2017 00:00:00 UTC"),
    utc: true
};
 
const interval = cronParser.parseExpression("0 30 15 * * 1-6", options);

console.log(interval.prev().toDate().toUTCString()); // Mon 
console.log(interval.prev().toDate().toUTCString()); // Fri
console.log(interval.next().toDate().toUTCString()); // Sat
console.log(interval.next().toDate().toUTCString()); // Mon
console.log(interval.prev().toDate().toUTCString()); // Fri

https://runkit.com/5912594388e92a00122cb663/5912594388e92a00122cb664

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
santigimenocommented, Jun 30, 2017
1reaction
faazshiftcommented, Jun 19, 2017

@harrisiirak @santigimeno I’ve meant to work on this, but life has been pretty hectic. To me this bug still seems to exist, both on master and on #99. I’ll try to dig into this sometime this week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to skip span element using jQuery next function?
1. If you know the span is always there, you could just do next().next('.prev') . The selector for the next operates as a...
Read more >
Difference between next() and nextLine() methods in Java
In this article, the difference between these two methods is discussed. next() Method: The next() method in java is present in the Scanner...
Read more >
Statistics: Power from Data! Organizing data: Stem and leaf plots
A stem and leaf plot looks something like a bar graph. Each number in the data is broken down into a stem and...
Read more >
PROGRESS BASIC QUERY COURSE - Maine.gov
The WHERE clause limits record retrieval based on a condition (expression). FIND [FIRST/NEXT/PREV/LAST] table-name WHERE condition. NO-LOCK. EXAMPLE 7:.
Read more >
Bug descriptions — spotbugs 4.7.3 documentation
Examples include hash code and equals problems, cloneable idiom, dropped exceptions, ... However, its next() method is not capable of throwing java.util.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found