@suffolklitlab/alkiln 4.7.2 → 4.8.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/CHANGELOG.md CHANGED
@@ -40,6 +40,10 @@ Format:
40
40
  -->
41
41
  <!-- ## [Unreleased] -->
42
42
 
43
+ ## [4.8.0] - 2022-08-30
44
+ ### Changed
45
+ - Date for filenames. Format date in y-m-d format instead of d-m-y that it had by default. Include ms.
46
+
43
47
  ## [4.7.2] - 2022-08-09
44
48
  ### Changed
45
49
  - Inform the developer when a test failure may have been caused by a server reload. See https://github.com/SuffolkLITLab/ALKiln/issues/392.
@@ -5,11 +5,20 @@ let files = {};
5
5
 
6
6
  files.readable_date = function() {
7
7
  /* Return the current timestamp in a human-readable filename-safe format to
8
- * match the workflow artifact date format. */
8
+ * match the workflow artifact date format.
9
+ *
10
+ * See https://stackoverflow.com/a/48729396/14144258 and https://stackoverflow.com/a/6040556/14144258
11
+ */
9
12
  let date = new Date(); // now
10
- let str = date.toLocaleString('en-GB', { timeZone: 'UTC' });
11
- // To properly get the year/month/day format, look at https://stackoverflow.com/a/48729396/14144258
12
- let fancy_str = str.replace(/\//g, '-').replace(',', ' at').replace(':', 'hrs ').replace(':', 'mins ') + 'secs UTC';
13
+ let day = ("0" + date.getUTCDate()).slice(-2);
14
+ let month = ("0" + date.getUTCMonth() + 1).slice(-2);
15
+ let year = date.getUTCFullYear();
16
+ let hours = ("0" + date.getUTCHours()).slice(-2);
17
+ let mins = ("0" + date.getUTCMinutes()).slice(-2);
18
+ let secs = ("0" + date.getUTCSeconds()).slice(-2);
19
+ let msecs = ("00" + date.getUTCMilliseconds()).slice(-3);
20
+
21
+ let fancy_str = `${ year }-${ month }-${ day } at ${ hours }hr ${ mins }min ${ secs }sec ${ msecs }ms UTC`;
13
22
  return fancy_str;
14
23
  }; // Ends files.readable_date()
15
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "4.7.2",
3
+ "version": "4.8.0",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -9,9 +9,9 @@
9
9
 
10
10
  let test_filename = function ( expected_prefix, result ) {
11
11
  /* Test a name to see if it's valid output with a language defined. */
12
- let expected_name_regex_str = `^${ expected_prefix }-${ names.base_filename }-\.{37}$`;
12
+ let expected_name_regex_str = `^${ expected_prefix }-${ names.base_filename }-\.{40}$`;
13
13
  if ( expected_prefix == `` ) {
14
- expected_name_regex_str = `^${ names.base_filename }-\.{37}$`;
14
+ expected_name_regex_str = `^${ names.base_filename }-\.{40}$`;
15
15
  }
16
16
  let regex = new RegExp( expected_name_regex_str );
17
17