@wmfs/tymly-schedule-plugin 1.3.1 → 1.5.0

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.
@@ -10,7 +10,7 @@ jobs:
10
10
  TZ: "Europe/London"
11
11
  PG_CONNECTION_STRING: postgres://postgres:postgres@localhost:5432/circle_test
12
12
  TIMEOUT: 15000
13
- - image: cimg/postgres:13.4-postgis
13
+ - image: cimg/postgres:15.1-postgis
14
14
  auth:
15
15
  username: $DOCKERHUB_USERNAME
16
16
  password: $DOCKERHUB_PASSWORD
package/.version CHANGED
@@ -1 +1 @@
1
- VERSION=1.3.1
1
+ VERSION=1.5.0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ # [1.5.0](https://github.com/wmfs/tymly-schedule-plugin/compare/v1.4.0...v1.5.0) (2023-02-17)
2
+
3
+
4
+ ### 🛠 Builds
5
+
6
+ * **deps-dev:** update dependency mocha to v10.2.0 ([d7d7747](https://github.com/wmfs/tymly-schedule-plugin/commit/d7d77477e929b95cade480db82d37454517122d1))
7
+ * **deps-dev:** update dependency semantic-release to v20 ([dd51685](https://github.com/wmfs/tymly-schedule-plugin/commit/dd51685b8ba3a42146c9feec11b7b83ea6097f4c))
8
+ * **deps-dev:** update dependency semantic-release to v20.0.1 ([36ed615](https://github.com/wmfs/tymly-schedule-plugin/commit/36ed6153d3b8b43d56c4beef50a0e86e9f5dc8fd))
9
+ * **deps-dev:** update dependency semantic-release to v20.0.2 ([272c053](https://github.com/wmfs/tymly-schedule-plugin/commit/272c053596098645f47aefab2efddc59546bab2c))
10
+ * **deps-dev:** update dependency semantic-release to v20.0.3 ([2f96e3c](https://github.com/wmfs/tymly-schedule-plugin/commit/2f96e3cac10e8c69c52ec8ad8b52db7dadd59d92))
11
+ * **deps-dev:** update dependency semantic-release to v20.0.4 ([15597ed](https://github.com/wmfs/tymly-schedule-plugin/commit/15597edd8483cff4118fadc50529a8b7d0a28540))
12
+ * **deps-dev:** update dependency semantic-release to v20.1.0 ([6b744c4](https://github.com/wmfs/tymly-schedule-plugin/commit/6b744c4cce7dc2fb8df1c724c3fe789e2c3f69b1))
13
+ * **deps:** update dependency node-schedule to v2.1.1 ([cf7f73f](https://github.com/wmfs/tymly-schedule-plugin/commit/cf7f73f00566666bc99d151115eadb6ec408879d))
14
+
15
+
16
+ ### ⚙️ Continuous Integrations
17
+
18
+ * **circle:** CircleCI update PostgreSQL image to 15 0 [sc-18659] ([f9d9bd9](https://github.com/wmfs/tymly-schedule-plugin/commit/f9d9bd9d9a5edcfc8311be7561f5ba48ca051974))
19
+ * **circle:** update postgres to 15.1-postgis ([dc635d7](https://github.com/wmfs/tymly-schedule-plugin/commit/dc635d78b81fdb17f63f23d7164a643c0f70591e))
20
+
21
+ # [1.4.0](https://github.com/wmfs/tymly-schedule-plugin/compare/v1.3.1...v1.4.0) (2022-12-06)
22
+
23
+
24
+ ### ✨ Features
25
+
26
+ * commiting progress ([26d8ed1](https://github.com/wmfs/tymly-schedule-plugin/commit/26d8ed1b5fdbbb0a8a85e0a40308e9c8fb8d4339))
27
+
28
+
29
+ ### 🐛 Bug Fixes
30
+
31
+ * issues with conflict ([37af828](https://github.com/wmfs/tymly-schedule-plugin/commit/37af82807d1b4b20c57f9a5ebc8396394790b2d9))
32
+
33
+
34
+ ### 🛠 Builds
35
+
36
+ * **deps-dev:** update dependency [@semantic-release](https://github.com/semantic-release)/changelog to v6.0.2 ([908350d](https://github.com/wmfs/tymly-schedule-plugin/commit/908350d9c5d5a28848018e49504d8d0efb8f2fc2))
37
+ * **deps-dev:** update dependency [@wmfs](https://github.com/wmfs)/tymly-pg-plugin to v1.276.0 ([c1d33c2](https://github.com/wmfs/tymly-schedule-plugin/commit/c1d33c24891d1bdea789bb7ebc362fd46c2c288b))
38
+ * **deps-dev:** update dependency [@wmfs](https://github.com/wmfs)/tymly-test-helpers to v1.22.2 ([7ce3a0d](https://github.com/wmfs/tymly-schedule-plugin/commit/7ce3a0d358b642dd9b3b48aa1458459e4b266dc7))
39
+ * **deps-dev:** update dependency chai to v4.3.7 ([0ba95fa](https://github.com/wmfs/tymly-schedule-plugin/commit/0ba95fa34087c7efafe4d5da6f3f709c9d014a5d))
40
+
1
41
  ## [1.3.1](https://github.com/wmfs/tymly-schedule-plugin/compare/v1.3.0...v1.3.1) (2022-11-29)
2
42
 
3
43
 
@@ -1,14 +1,16 @@
1
+ const moment = require('moment')
2
+
1
3
  module.exports = function (datetime) {
2
4
  if (!(datetime instanceof Date)) {
3
5
  datetime = new Date()
4
6
  }
5
7
 
6
8
  return {
7
- year: datetime.getFullYear(),
8
- month: datetime.getMonth(),
9
- date: datetime.getDate(),
10
- hour: datetime.getHours(),
11
- minute: datetime.getMinutes(),
12
- second: datetime.getSeconds()
9
+ year: moment(datetime).year(),
10
+ month: moment(datetime).month(),
11
+ date: moment(datetime).date(),
12
+ hour: moment(datetime).hour(),
13
+ minute: moment(datetime).minute(),
14
+ second: moment(datetime).second()
13
15
  }
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wmfs/tymly-schedule-plugin",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "description": "Provides state machine scheduling for the Tymly framework",
5
5
  "homepage": "https://github.com/wmfs/tymly-schedule-plugin#readme",
6
6
  "author": "West Midlands Fire Service",
@@ -22,25 +22,25 @@
22
22
  },
23
23
  "main": "./lib/index.js",
24
24
  "dependencies": {
25
- "node-schedule": "2.1.0",
25
+ "node-schedule": "2.1.1",
26
26
  "uuid": "^9.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@semantic-release/changelog": "6.0.1",
29
+ "@semantic-release/changelog": "6.0.2",
30
30
  "@semantic-release/exec": "6.0.3",
31
31
  "@semantic-release/git": "10.0.1",
32
32
  "@wmfs/tymly": "1.242.0",
33
- "@wmfs/tymly-pg-plugin": "1.269.0",
34
- "@wmfs/tymly-test-helpers": "1.22.1",
35
- "chai": "4.3.6",
33
+ "@wmfs/tymly-pg-plugin": "1.276.0",
34
+ "@wmfs/tymly-test-helpers": "1.22.2",
35
+ "chai": "4.3.7",
36
36
  "codecov": "3.8.3",
37
37
  "conventional-changelog-metahub": "4.0.1",
38
38
  "cz-conventional-changelog": "3.3.0",
39
39
  "dirty-chai": "2.0.1",
40
- "mocha": "10.1.0",
40
+ "mocha": "10.2.0",
41
41
  "moment": "2.29.4",
42
42
  "nyc": "15.1.0",
43
- "semantic-release": "19.0.5",
43
+ "semantic-release": "20.1.0",
44
44
  "standard": "17.0.0"
45
45
  },
46
46
  "scripts": {
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schedule-plugin",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "label": "Tymly Schedule Plugin",
5
5
  "author": "WMFS",
6
6
  "organisation": "West Midlands Fire Service",
@@ -2,6 +2,7 @@
2
2
 
3
3
  const expect = require('chai').expect
4
4
 
5
+ const moment = require('moment')
5
6
  const ruleToDatetime = require('../lib/components/services/schedule/utils/rule-to-datetime')
6
7
  const datetimeToRule = require('../lib/components/services/schedule/utils/datetime-to-rule')
7
8
 
@@ -75,29 +76,58 @@ describe('Rule to datetime tests', function () {
75
76
 
76
77
  describe('Datetime to rule tests', function () {
77
78
  it('No options, should default to now', () => {
78
- const now = new Date()
79
+ const now = moment()
79
80
  const rule = datetimeToRule()
80
81
 
81
- expect(rule.year).to.eql(now.getFullYear())
82
- expect(rule.month).to.eql(now.getMonth())
83
- expect(rule.date).to.eql(now.getDate())
84
- expect(rule.hour).to.eql(now.getHours())
85
- expect(rule.minute).to.eql(now.getMinutes())
86
- expect(rule.second).to.eql(now.getSeconds())
82
+ expect(rule.year).to.eql(now.year())
83
+ expect(rule.month).to.eql(now.month())
84
+ expect(rule.date).to.eql(now.date())
85
+ expect(rule.hour).to.eql(now.hour())
86
+ expect(rule.minute).to.eql(now.minute())
87
+ expect(rule.second).to.eql(now.second())
87
88
  })
88
89
 
89
90
  it('Specific year, the rest should default to now', () => {
90
- const datetime = new Date()
91
+ let datetime = new Date()
91
92
  const year = datetime.getFullYear() + 2
92
93
  datetime.setFullYear(year)
93
94
 
94
95
  const rule = datetimeToRule(datetime)
96
+ datetime = moment(datetime)
95
97
 
96
98
  expect(rule.year).to.eql(year)
97
- expect(rule.month).to.eql(datetime.getMonth())
98
- expect(rule.date).to.eql(datetime.getDate())
99
- expect(rule.hour).to.eql(datetime.getHours())
100
- expect(rule.minute).to.eql(datetime.getMinutes())
101
- expect(rule.second).to.eql(datetime.getSeconds())
99
+ expect(rule.month).to.eql(datetime.month())
100
+ expect(rule.date).to.eql(datetime.date())
101
+ expect(rule.hour).to.eql(datetime.hour())
102
+ expect(rule.minute).to.eql(datetime.minute())
103
+ expect(rule.second).to.eql(datetime.second())
104
+ })
105
+
106
+ it('DST test, should change time by +1 hour', () => {
107
+ const currentDateTime = new Date('Sunday March 27 2022 00:59:00')
108
+
109
+ // 2022-03-27T02:00:00+01:00
110
+ const startDSTDateTime = moment(currentDateTime).add(1, 'minutes')
111
+
112
+ // adding 1 min and setting as Date object
113
+ const rule = datetimeToRule(new Date(currentDateTime.getTime() + (60 * 1000)))
114
+
115
+ expect(rule.date).to.eql(startDSTDateTime.date())
116
+ expect(rule.hour).to.eql(startDSTDateTime.hour())
117
+ expect(rule.minute).to.eql(startDSTDateTime.minute())
118
+ })
119
+
120
+ it('DST test, should change time by -1 hour', () => {
121
+ const currentDateTime = new Date('Sunday October 30 2022 01:59:00')
122
+
123
+ // 2022-10-30T01:00:00+00:00
124
+ const endDSTDateTime = moment(currentDateTime).add(1, 'minutes')
125
+
126
+ // adding 1 min and setting as Date object
127
+ const rule = datetimeToRule(new Date(currentDateTime.getTime() + (60 * 1000)))
128
+
129
+ expect(rule.date).to.eql(endDSTDateTime.date())
130
+ expect(rule.hour).to.eql(endDSTDateTime.hour())
131
+ expect(rule.minute).to.eql(endDSTDateTime.minute())
102
132
  })
103
133
  })