@tryghost/pretty-stream 0.1.29 → 0.2.1

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013-2025 Ghost Foundation
3
+ Copyright (c) 2013-2026 Ghost Foundation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -37,4 +37,4 @@ Follow the instructions for the top-level repo.
37
37
 
38
38
  # Copyright & License
39
39
 
40
- Copyright (c) 2013-2025 Ghost Foundation - Released under the [MIT license](LICENSE).
40
+ Copyright (c) 2013-2026 Ghost Foundation - Released under the [MIT license](LICENSE).
@@ -101,17 +101,23 @@ class PrettyStream extends Transform {
101
101
 
102
102
  let output = '';
103
103
 
104
- // Convert the time to UTC
105
- const now = new Date();
106
- const dataTime = new Date(data.time || now);
107
-
108
- // If the timezone offset is equal to the current timezone offset, and that timezone offset is not 0,
109
- // then we need to adjust the time
110
- if (dataTime.getTimezoneOffset() === now.getTimezoneOffset() && dataTime.getTimezoneOffset() !== 0) {
111
- dataTime.setMinutes(dataTime.getMinutes() + dataTime.getTimezoneOffset());
112
- }
104
+ // Handle time formatting
105
+ let time;
113
106
 
114
- const time = dateFormat.asString('yyyy-MM-dd hh:mm:ss', dataTime);
107
+ if (data.time) {
108
+ // If time is provided as a string in the expected format, use it directly
109
+ if (typeof data.time === 'string' && /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(data.time)) {
110
+ time = data.time;
111
+ } else {
112
+ // Otherwise, parse and format it
113
+ const dataTime = new Date(data.time);
114
+ time = dateFormat.asString('yyyy-MM-dd hh:mm:ss', dataTime);
115
+ }
116
+ } else {
117
+ // No time provided, use current time
118
+ const now = new Date();
119
+ time = dateFormat.asString('yyyy-MM-dd hh:mm:ss', now);
120
+ }
115
121
 
116
122
  let logLevel = _private.levelFromName[data.level].toUpperCase();
117
123
  const codes = _private.colors[_private.colorForLevel[data.level]];
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@tryghost/pretty-stream",
3
- "version": "0.1.29",
4
- "repository": "https://github.com/TryGhost/framework/tree/main/packages/pretty-stream",
3
+ "version": "0.2.1",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/TryGhost/framework.git",
7
+ "directory": "packages/pretty-stream"
8
+ },
5
9
  "author": "Ghost Foundation",
6
10
  "license": "MIT",
7
11
  "main": "index.js",
@@ -20,14 +24,13 @@
20
24
  },
21
25
  "devDependencies": {
22
26
  "c8": "10.1.3",
23
- "mocha": "10.7.3",
27
+ "mocha": "11.7.5",
24
28
  "should": "13.2.3",
25
- "sinon": "18.0.0"
29
+ "sinon": "21.0.1"
26
30
  },
27
31
  "dependencies": {
28
32
  "date-format": "^4.0.14",
29
33
  "lodash": "^4.17.21",
30
34
  "prettyjson": "^1.2.5"
31
- },
32
- "gitHead": "783b40c3ece6e1c9e293d09f2c069baa3e1110b2"
35
+ }
33
36
  }