@projectcaluma/ember-core 11.0.0-beta.3 → 11.0.0-beta.4

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@projectcaluma/ember-core-v11.0.0-beta.4](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.3...@projectcaluma/ember-core-v11.0.0-beta.4) (2022-02-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **core:** remove usage of moment and remove momentAttr for models ([92f3651](https://github.com/projectcaluma/ember-caluma/commit/92f365114900fe9f9ad5b49c9e9eed97b25991b5))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * **core:** The `momentAttr` decorator for models was replaced with
12
+ a `dateAttr` that returns a plain JS date object. Predefined date
13
+ attributes on models are now JS dates instead of moment objects.
14
+
1
15
  # [@projectcaluma/ember-core-v11.0.0-beta.3](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.2...@projectcaluma/ember-core-v11.0.0-beta.3) (2022-02-03)
2
16
 
3
17
 
@@ -1,15 +1,15 @@
1
1
  import { inject as service } from "@ember/service";
2
2
 
3
3
  import CalumaQueryModel, {
4
- momentAttr,
4
+ dateAttr,
5
5
  } from "@projectcaluma/ember-core/caluma-query/models/index";
6
6
 
7
7
  export default class CaseModel extends CalumaQueryModel {
8
8
  @service intl;
9
9
 
10
- @momentAttr createdAt;
11
- @momentAttr modifiedAt;
12
- @momentAttr closedAt;
10
+ @dateAttr createdAt;
11
+ @dateAttr modifiedAt;
12
+ @dateAttr closedAt;
13
13
 
14
14
  get status() {
15
15
  return this.intl.t(`caluma.caluma-query.case.status.${this.raw.status}`);
@@ -1,5 +1,4 @@
1
1
  import cloneDeep from "lodash.clonedeep";
2
- import moment from "moment";
3
2
 
4
3
  import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
5
4
 
@@ -11,15 +10,15 @@ export function uuidAttr(target, name) {
11
10
  };
12
11
  }
13
12
 
14
- export function momentAttr(target, name) {
13
+ export function dateAttr(target, name) {
15
14
  return {
16
15
  get() {
17
- const date = moment(this.raw[name]);
16
+ const date = new Date(this.raw[name]);
18
17
 
19
- return date.isValid() ? date : null;
18
+ return !isNaN(date) ? date : null;
20
19
  },
21
20
  set(value) {
22
- if (value.isValid()) {
21
+ if (!isNaN(value)) {
23
22
  this.raw[name] = value.toISOString();
24
23
  }
25
24
  },
@@ -1,16 +1,16 @@
1
1
  import { inject as service } from "@ember/service";
2
2
 
3
3
  import CalumaQueryModel, {
4
- momentAttr,
4
+ dateAttr,
5
5
  } from "@projectcaluma/ember-core/caluma-query/models/index";
6
6
 
7
7
  export default class WorkItemModel extends CalumaQueryModel {
8
8
  @service intl;
9
9
 
10
- @momentAttr createdAt;
11
- @momentAttr modifiedAt;
12
- @momentAttr closedAt;
13
- @momentAttr deadline;
10
+ @dateAttr createdAt;
11
+ @dateAttr modifiedAt;
12
+ @dateAttr closedAt;
13
+ @dateAttr deadline;
14
14
 
15
15
  get status() {
16
16
  return this.intl.t(
@@ -10,6 +10,6 @@ module.exports = {
10
10
  { name: "ember-intl" },
11
11
  { name: "ember-uikit" },
12
12
  ],
13
- }).then(() => this.addPackagesToProject([{ name: "moment" }]));
13
+ });
14
14
  },
15
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-core",
3
- "version": "11.0.0-beta.3",
3
+ "version": "11.0.0-beta.4",
4
4
  "description": "Ember core addon for working with Caluma.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -24,12 +24,11 @@
24
24
  "ember-fetch": "^8.1.1",
25
25
  "ember-inflector": "^4.0.2",
26
26
  "ember-intl": "^5.7.2",
27
- "ember-resources": "^4.2.0",
27
+ "ember-resources": "^4.3.1",
28
28
  "graphql": "^15.8.0",
29
29
  "graphql-tag": "^2.12.6",
30
30
  "jexl": "^2.3.0",
31
31
  "lodash.clonedeep": "^4.5.0",
32
- "moment": "^2.29.1",
33
32
  "slugify": "^1.6.5"
34
33
  },
35
34
  "devDependencies": {
@@ -39,7 +38,7 @@
39
38
  "@embroider/test-setup": "1.0.0",
40
39
  "@faker-js/faker": "6.0.0-alpha.5",
41
40
  "@glimmer/component": "1.0.4",
42
- "@projectcaluma/ember-testing": "11.0.0-beta.1",
41
+ "@projectcaluma/ember-testing": "11.0.0-beta.2",
43
42
  "broccoli-asset-rev": "3.0.0",
44
43
  "ember-cli": "3.28.5",
45
44
  "ember-cli-code-coverage": "1.0.3",