@pittica/google-business-intelligence-helpers 1.8.0 → 1.9.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/dist/index.js CHANGED
@@ -33,7 +33,8 @@ const {
33
33
  } = require("./naming/dataset");
34
34
  const {
35
35
  partsToDate,
36
- stringToDate
36
+ stringToDate,
37
+ getNow
37
38
  } = require("./naming/date");
38
39
  const {
39
40
  isDataCsv
@@ -66,6 +67,7 @@ exports.getTemporaryTableName = getTemporaryTableName;
66
67
  exports.getTemporaryTableSuffix = getTemporaryTableSuffix;
67
68
  exports.partsToDate = partsToDate;
68
69
  exports.stringToDate = stringToDate;
70
+ exports.getNow = getNow;
69
71
  exports.isDataCsv = isDataCsv;
70
72
  exports.getFilenameVersion = getFilenameVersion;
71
73
  exports.incrementFilenameVersion = incrementFilenameVersion;
@@ -12,6 +12,10 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
 
15
+ const {
16
+ format
17
+ } = require("date-and-time");
18
+
15
19
  /**
16
20
  * Converts the file name parts to a date object.
17
21
  *
@@ -32,4 +36,12 @@ exports.stringToDate = date => {
32
36
  return this.partsToDate(split);
33
37
  }
34
38
  return null;
35
- };
39
+ };
40
+
41
+ /**
42
+ * Gets the current date in the given format.
43
+ *
44
+ * @param {string} dateFormat Format string.
45
+ * @returns {string} The current date in the given format.
46
+ */
47
+ exports.getNow = (dateFormat = "YYYY-MM-DD") => format(new Date(), dateFormat);
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.8.0",
4
+ "version": "1.9.0",
5
5
  "description": "Helpers for business intelligence for Google Cloud.",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {