@pittica/google-business-intelligence-helpers 1.8.0 → 1.10.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 +5 -1
- package/dist/naming/date.js +22 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33,7 +33,9 @@ const {
|
|
|
33
33
|
} = require("./naming/dataset");
|
|
34
34
|
const {
|
|
35
35
|
partsToDate,
|
|
36
|
-
stringToDate
|
|
36
|
+
stringToDate,
|
|
37
|
+
getNow,
|
|
38
|
+
formatDate
|
|
37
39
|
} = require("./naming/date");
|
|
38
40
|
const {
|
|
39
41
|
isDataCsv
|
|
@@ -66,6 +68,8 @@ exports.getTemporaryTableName = getTemporaryTableName;
|
|
|
66
68
|
exports.getTemporaryTableSuffix = getTemporaryTableSuffix;
|
|
67
69
|
exports.partsToDate = partsToDate;
|
|
68
70
|
exports.stringToDate = stringToDate;
|
|
71
|
+
exports.getNow = getNow;
|
|
72
|
+
exports.formatDate = formatDate;
|
|
69
73
|
exports.isDataCsv = isDataCsv;
|
|
70
74
|
exports.getFilenameVersion = getFilenameVersion;
|
|
71
75
|
exports.incrementFilenameVersion = incrementFilenameVersion;
|
package/dist/naming/date.js
CHANGED
|
@@ -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,21 @@ 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") => this.formatDate(new Date(), dateFormat);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Gets the given date in the given format.
|
|
51
|
+
*
|
|
52
|
+
* @param {Date} date Date object.
|
|
53
|
+
* @param {string} dateFormat Format string.
|
|
54
|
+
* @returns {string} The given date in the given format.
|
|
55
|
+
*/
|
|
56
|
+
exports.formatDate = (date, dateFormat = "YYYY-MM-DD") => format(date, dateFormat);
|
package/package.json
CHANGED