Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Aug 17, 2020
1 parent c5b45ef commit cf26c25
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
10 changes: 7 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## This project is no longer being maintained. It should be treated as sample code on one technique to calculate future instances of complex schedules. If you are looking to fire a task every 1 minute, use a cron scheduler instead.
## This project is a maintained fork of Later

# [Later](http://bunkat.github.io/later/) [![Build Status](https://travis-ci.org/bunkat/later.svg)](https://travis-ci.org/bunkat/later)

Expand All @@ -17,11 +17,11 @@ Types of schedules supported by _Later_:
## Installation
Using npm:

$ npm install later
$ npm install @breejs/later

Using bower:

$ bower install later
$ bower install @breejs/later

## Building

Expand Down Expand Up @@ -55,6 +55,10 @@ Have a bug or a feature request? [Please open a new issue](https://github.com/bu

## Change Log

### @breejs/later v2.0.0

* feat: merged https://github.com/bunkat/later/pull/208 and https://github.com/bunkat/later/pull/188

### Later v1.2.0
* Implemented predefined scheduling definitions for cron
- @yearly, @annually, @monthly, @weekly, @daily, and @hourly are now parsed correctly
Expand Down
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ globals.forEach(function(g) {
if (g in global) globalValues[g] = global[g];
});

require(process.env['LATER_COV'] ? "./later-cov" : "./later");
// <https://github.com/bunkat/later/pull/208>
if (process && process.env['LATER_COV']) {
require("./later.cov");
} else {
require("./later");
}

module.exports = later;

globals.forEach(function(g) {
if (g in globalValues) global[g] = globalValues[g];
else delete global[g];
});
});
11 changes: 9 additions & 2 deletions later.js
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,14 @@ later = function() {
var output = str;
switch (tokenType) {
case TOKENTYPES.time:
var parts = str.split(/(:|am|pm)/), hour = parts[3] === "pm" && parts[0] < 12 ? parseInt(parts[0], 10) + 12 : parts[0], min = parts[2].trim();
// <https://github.com/bunkat/later/pull/188>
var parts = str.split(/(:|am|pm)/), hour = parseInt(parts[0], 10), min = parts[2].trim();
if (parts[3] === "pm" && hour < 12) {
hour += 12;
} else if (parts[3] === "am" && hour === 12) {
hour -= 12;
}
hour = "" + hour;
output = (hour.length === 1 ? "0" : "") + hour + ":" + min;
break;

Expand All @@ -1546,4 +1553,4 @@ later = function() {
return parseScheduleExpr(str.toLowerCase());
};
return later;
}();
}();
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "later",
"name": "@breejs/later",
"version": "1.2.0",
"description": "Determine later (or previous) occurrences of recurring schedules",
"description": "Maintained fork of later. Determine later (or previous) occurrences of recurring schedules",
"keywords": [
"schedule",
"occurrences",
Expand All @@ -11,7 +11,7 @@
"author": "BunKat <[email protected]>",
"repository": {
"type": "git",
"url": "git://github.com/bunkat/later.git"
"url": "git://github.com/breejs/later.git"
},
"main": "index.js",
"browserify": "index-browserify.js",
Expand Down

0 comments on commit cf26c25

Please sign in to comment.