@onehat/data 1.19.25 → 1.19.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/data",
3
- "version": "1.19.25",
3
+ "version": "1.19.26",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -27,10 +27,8 @@ export default function useOneHatData(schemaName, uniqueRepository = false) {
27
27
 
28
28
  useEffect(() => {
29
29
 
30
- let repository;
31
- const onChangeData = () => {
32
- setEntities(repository.entities); // Set new state in component
33
- };
30
+ let repository,
31
+ onChangeData = () => {};
34
32
  (async () => {
35
33
 
36
34
  if (uniqueRepository) {
@@ -45,6 +43,9 @@ export default function useOneHatData(schemaName, uniqueRepository = false) {
45
43
  } else {
46
44
  repository = oneHatData.getRepository(schemaName); // Get bound Repository for this schema
47
45
  }
46
+ onChangeData = () => {
47
+ setEntities(repository.entities); // Set new state in component
48
+ };
48
49
 
49
50
  setRepository(repository);
50
51
  setEntities(repository.entities);
@@ -69,9 +69,9 @@ class Formatters {
69
69
  // See http://stackoverflow.com/questions/2587345/javascript-date-parse?rq=1
70
70
  // If accuracy is absolutely needed and format is known, use a regex to
71
71
  // manually parse, then pass in arguments to new Date().
72
- let date = moment(value, 'YYYY-MM-DD');
72
+ let date = moment(value, 'YYYY-MM-DD', true);
73
73
  if (!date) {
74
- date = moment(value, 'YYYY-MM-DD HH:mm:ss');
74
+ date = moment(value, 'YYYY-MM-DD HH:mm:ss', true);
75
75
  }
76
76
  if (typeof date !== 'undefined' && date !== null) {
77
77
  date = new Date(date);