@neovici/cosmoz-utils 6.10.0 → 6.10.1

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/dist/date.js +6 -6
  2. package/package.json +1 -1
package/dist/date.js CHANGED
@@ -1,19 +1,19 @@
1
1
  const getValUnitDiff = (date1, date2) => {
2
2
  const msDiff = date1.getTime() - date2.getTime(), secDiff = msDiff / 1000, minDiff = secDiff / 60, hourDiff = minDiff / 60, dayDiff = hourDiff / 24, monthDiff = dayDiff / 30, yearDiff = monthDiff / 12;
3
3
  if (Math.abs(yearDiff) >= 1) {
4
- return [yearDiff, 'year'];
4
+ return [Math.ceil(yearDiff), 'year'];
5
5
  }
6
6
  if (Math.abs(monthDiff) >= 1) {
7
- return [monthDiff, 'month'];
7
+ return [Math.ceil(monthDiff), 'month'];
8
8
  }
9
9
  if (Math.abs(dayDiff) >= 1) {
10
- return [dayDiff, 'day'];
10
+ return [Math.ceil(dayDiff), 'day'];
11
11
  }
12
12
  if (Math.abs(hourDiff) >= 1) {
13
- return [hourDiff, 'hour'];
13
+ return [Math.ceil(hourDiff), 'hour'];
14
14
  }
15
15
  if (Math.abs(minDiff) >= 1) {
16
- return [minDiff, 'minute'];
16
+ return [Math.ceil(minDiff), 'minute'];
17
17
  }
18
18
  return [secDiff, 'second'];
19
19
  }, rules = { isoBasic: /^\d{4}-\d{2}-\d{2}$/iu }, parse = (val) => {
@@ -78,7 +78,7 @@ isoDT = (date) => {
78
78
  hour: 'numeric',
79
79
  minute: 'numeric',
80
80
  second: 'numeric',
81
- hourCycle: 'h23'
81
+ hourCycle: 'h23',
82
82
  });
83
83
  },
84
84
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-utils",
3
- "version": "6.10.0",
3
+ "version": "6.10.1",
4
4
  "description": "Date, money and template management functions commonly needed in Cosmoz views.",
5
5
  "keywords": [
6
6
  "polymer",