date-format 4.0.2 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +3 -6
  2. package/package.json +13 -4
package/lib/index.js CHANGED
@@ -21,12 +21,8 @@ function offset(timezoneOffset) {
21
21
  var os = Math.abs(timezoneOffset);
22
22
  var h = String(Math.floor(os / 60));
23
23
  var m = String(os % 60);
24
- if (h.length === 1) {
25
- h = "0" + h;
26
- }
27
- if (m.length === 1) {
28
- m = "0" + m;
29
- }
24
+ h = ("0" + h).slice(-2);
25
+ m = ("0" + m).slice(-2);
30
26
  return timezoneOffset === 0 ? "Z" : (timezoneOffset < 0 ? "+" : "-") + h + ":" + m;
31
27
  }
32
28
 
@@ -208,6 +204,7 @@ function parse(pattern, str, missingValuesDate) {
208
204
  /**
209
205
  * Used for testing - replace this function with a fixed date.
210
206
  */
207
+ // istanbul ignore next
211
208
  function now() {
212
209
  return new Date();
213
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "date-format",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "Formatting Date objects as strings since 2013",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  "scripts": {
17
17
  "lint": "eslint lib/* test/*",
18
18
  "pretest": "eslint lib/* test/*",
19
- "test": "mocha"
19
+ "test": "nyc --check-coverage mocha"
20
20
  },
21
21
  "keywords": [
22
22
  "date",
@@ -28,9 +28,18 @@
28
28
  "readmeFilename": "README.md",
29
29
  "gitHead": "bf59015ab6c9e86454b179374f29debbdb403522",
30
30
  "devDependencies": {
31
- "eslint": "^8.6.0",
31
+ "eslint": "^8.7.0",
32
32
  "eslint-plugin-mocha": "^10.0.3",
33
- "mocha": "^9.1.3",
33
+ "mocha": "^9.1.4",
34
+ "nyc": "^15.1.0",
34
35
  "should": "^13.2.3"
36
+ },
37
+ "nyc": {
38
+ "include": [
39
+ "lib/**"
40
+ ],
41
+ "branches": 100,
42
+ "lines": 100,
43
+ "functions": 100
35
44
  }
36
45
  }