timestring
Advanced tools
Comparing version 4.0.0 to 5.0.0
# Changelog | ||
## 5.0.0 | ||
- Add `daysPerYear` configuration option | ||
- Use `daysPerYear` configuration option to convert months or years to seconds | ||
## 4.0.0 | ||
@@ -4,0 +9,0 @@ |
@@ -19,3 +19,4 @@ 'use strict' | ||
weeksPerMonth: 4, | ||
monthsPerYear: 12 | ||
monthsPerYear: 12, | ||
daysPerYear: 365.25 | ||
} | ||
@@ -92,4 +93,4 @@ | ||
unitValues.w = opts.daysPerWeek * unitValues.d | ||
unitValues.mth = opts.weeksPerMonth * unitValues.w | ||
unitValues.y = opts.monthsPerYear * unitValues.mth | ||
unitValues.mth = (opts.daysPerYear / opts.monthsPerYear) * unitValues.d | ||
unitValues.y = opts.daysPerYear * unitValues.d | ||
@@ -96,0 +97,0 @@ return unitValues |
{ | ||
"name": "timestring", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Parse a human readable time string into a time based value", | ||
@@ -32,4 +32,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"chai": "^3.4.1", | ||
"codeclimate-test-reporter": "^0.4.0", | ||
"chai": "^4.0.1", | ||
"codeclimate-test-reporter": "^0.5.0", | ||
"coveralls": "^2.11.2", | ||
@@ -36,0 +36,0 @@ "istanbul": "^0.4.1", |
@@ -114,2 +114,3 @@ # timestring | ||
4. There are 12 months per year | ||
5. There are 365.25 days per year | ||
@@ -124,2 +125,3 @@ These options can be changed by passing an options object as an argument to `timestring`. | ||
4. `monthsPerYear` | ||
5. `daysPerYear` | ||
@@ -143,3 +145,3 @@ ```js | ||
*Example - Employees of my company work 7.5 hours a day, and only work 5 days a week. In my time tracking app, when they type `1d` i want 7.5 hours to be tracked. When they type `1w` i want 5 days to be tracked etc.* | ||
*Example - Employees of my company work 7.5 hours a day, and only work 5 days a week. In my time tracking app, when they type `1d` i want 7.5 hours to be tracked. When they type `1w` i want 5 days to be tracked etc.* | ||
@@ -160,1 +162,3 @@ ```js | ||
``` | ||
It is important to note that the `daysPerYear` configuration option will be used to convert a month or year to seconds, so if you are using custom configuration options make sure that you adjust this value to suit if you expect to be parsing timestrings containing months or years. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10960
115
161