@things-factory/env 7.1.8 → 7.1.12-alpha.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.
Files changed (2) hide show
  1. package/lib/logger.js +15 -1
  2. package/package.json +2 -2
package/lib/logger.js CHANGED
@@ -29,7 +29,21 @@ if (consoleConfig) {
29
29
  logTransports.push(new transports.Console(Object.assign({}, CONSOLE_LOGGER_CONFIG, consoleConfig)))
30
30
  }
31
31
 
32
- const SYSTEM_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone
32
+ function getSystemTimeZone() {
33
+ try {
34
+ const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
35
+ if (!timeZone) {
36
+ throw new Error('Unable to resolve timeZone')
37
+ }
38
+ return timeZone
39
+ } catch (e) {
40
+ console.warn('Failed to get system timeZone, falling back to UTC.', e)
41
+ return 'UTC'
42
+ }
43
+ }
44
+
45
+ const SYSTEM_TZ = getSystemTimeZone()
46
+
33
47
  const systemTimestamp = format((info, opts) => {
34
48
  if (opts.tz) info.timestamp = moment().tz(opts.tz).format()
35
49
  return info
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/env",
3
- "version": "7.1.8",
3
+ "version": "7.1.12-alpha.0",
4
4
  "description": "Things Factory running environment helper library",
5
5
  "main": "index.js",
6
6
  "author": "heartyoh@hatiolab.com",
@@ -27,5 +27,5 @@
27
27
  "winston": "^3.2.1",
28
28
  "winston-daily-rotate-file": "^4.2.1"
29
29
  },
30
- "gitHead": "2b215ddbbb6fb12b50fa8b5b68ca21b03d5d2fb8"
30
+ "gitHead": "2be45c33868b2cc01d55b7b540b9a4877805ff8a"
31
31
  }