@pittica/google-business-intelligence-helpers 1.10.0 → 1.11.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.
package/README.md CHANGED
@@ -7,10 +7,6 @@
7
7
 
8
8
  Helpers for business intelligence for Google Cloud.
9
9
 
10
- ## Overview
11
-
12
- This project uses [BigQuery](https://cloud.google.com/bigquery/docs) libraries.
13
-
14
10
  ## Copyright
15
11
 
16
12
  This project is licensed.
package/dist/index.js CHANGED
@@ -33,7 +33,9 @@ const {
33
33
  } = require("./naming/dataset");
34
34
  const {
35
35
  partsToDate,
36
+ partsToDateUTC,
36
37
  stringToDate,
38
+ stringToDateUTC,
37
39
  getNow,
38
40
  formatDate
39
41
  } = require("./naming/date");
@@ -67,7 +69,9 @@ exports.getSafeFilenameFromBucket = getSafeFilenameFromBucket;
67
69
  exports.getTemporaryTableName = getTemporaryTableName;
68
70
  exports.getTemporaryTableSuffix = getTemporaryTableSuffix;
69
71
  exports.partsToDate = partsToDate;
72
+ exports.partsToDateUTC = partsToDateUTC;
70
73
  exports.stringToDate = stringToDate;
74
+ exports.stringToDateUTC = stringToDateUTC;
71
75
  exports.getNow = getNow;
72
76
  exports.formatDate = formatDate;
73
77
  exports.isDataCsv = isDataCsv;
@@ -24,6 +24,14 @@ const {
24
24
  */
25
25
  exports.partsToDate = parts => new Date(parseInt(parts[1]), parseInt(parts[2]) - 1, parseInt(parts[3]));
26
26
 
27
+ /**
28
+ * Converts the file name parts to an UTC date object.
29
+ *
30
+ * @param {Array} parts String array from regular expression split representing a date from file name.
31
+ * @returns {Date} The UTC date from the given array.
32
+ */
33
+ exports.partsToDateUTC = parts => new Date(Date.UTC(parseInt(parts[1]), parseInt(parts[2]) - 1, parseInt(parts[3])));
34
+
27
35
  /**
28
36
  * Extracts a date from the given date representation.
29
37
  *
@@ -38,6 +46,20 @@ exports.stringToDate = date => {
38
46
  return null;
39
47
  };
40
48
 
49
+ /**
50
+ * Extracts an UTC date from the given date representation.
51
+ *
52
+ * @param {string} date Date in string format YYYY-MM-DD.
53
+ * @returns {Date} An UTC date from the given date representation.
54
+ */
55
+ exports.stringToDateUTC = date => {
56
+ const split = date.split(/^(\d{4})\-(\d{2})\-(\d{2})$/gis);
57
+ if (split.length === 5) {
58
+ return this.partsToDateUTC(split);
59
+ }
60
+ return null;
61
+ };
62
+
41
63
  /**
42
64
  * Gets the current date in the given format.
43
65
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pittica/google-business-intelligence-helpers",
3
3
  "private": false,
4
- "version": "1.10.0",
4
+ "version": "1.11.0",
5
5
  "description": "Helpers for business intelligence for Google Cloud.",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
@@ -26,13 +26,13 @@
26
26
  },
27
27
  "homepage": "https://github.com/pittica/google-business-intelligence-helpers#README.md",
28
28
  "dependencies": {
29
- "@pittica/google-cloud-storage-helpers": "^1.2.2",
30
- "date-and-time": "^3.6.0"
29
+ "@pittica/google-cloud-storage-helpers": "^1.3.1",
30
+ "date-and-time": "^4.1.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@babel/cli": "^7.27.0",
33
+ "@babel/cli": "^7.28.3",
34
34
  "mkdirp": "^3.0.1",
35
- "prettier": "^3.5.3",
35
+ "prettier": "^3.6.2",
36
36
  "rimraf": "^6.0.1"
37
37
  }
38
38
  }