swcombine.js 0.0.7 → 0.0.8
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.cjs.js +17 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.esm.js +17 -3
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -173,7 +173,7 @@ const _SwcTimestamp = class _SwcTimestamp {
|
|
|
173
173
|
const seconds = Math.floor(msSinceSwcStart / 1e3);
|
|
174
174
|
return new _SwcTimestamp({
|
|
175
175
|
year,
|
|
176
|
-
day,
|
|
176
|
+
day: day + 1,
|
|
177
177
|
hour,
|
|
178
178
|
minute,
|
|
179
179
|
second: seconds
|
|
@@ -253,6 +253,20 @@ const _SwcTimestamp = class _SwcTimestamp {
|
|
|
253
253
|
const endTime = otherTimestamp.toUnixTimestamp("sec");
|
|
254
254
|
return secondsToDuration(endTime - startTime);
|
|
255
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Convert the SWC timestamp to a string (i.e. Year 25 Day 60, 12:45:21)
|
|
258
|
+
* @param format 'full' = Year 25, Day 60, 12:45:21, 'short' = 'Y26 D60, 12:45:21', 'day' = 'Y26 D60'.
|
|
259
|
+
*/
|
|
260
|
+
toString(format = "full") {
|
|
261
|
+
switch (format) {
|
|
262
|
+
case "full":
|
|
263
|
+
return `Year ${this.year} Day ${this.day}, ${this.hour}:${this.minute}:${this.second}`;
|
|
264
|
+
case "short":
|
|
265
|
+
return `Y${this.year} D${this.day}, ${this.hour}:${this.minute}:${this.second}`;
|
|
266
|
+
case "day":
|
|
267
|
+
return `Y${this.year} D${this.day}`;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
256
270
|
/**
|
|
257
271
|
* @returns {number}
|
|
258
272
|
* @private
|
|
@@ -265,13 +279,13 @@ const _SwcTimestamp = class _SwcTimestamp {
|
|
|
265
279
|
let msSinceSwcStart = 0;
|
|
266
280
|
msSinceSwcStart += this.year * msPerYear;
|
|
267
281
|
msSinceSwcStart += (this.day - 1) * msPerDay;
|
|
268
|
-
msSinceSwcStart +=
|
|
282
|
+
msSinceSwcStart += this.hour * msPerHour;
|
|
269
283
|
msSinceSwcStart += this.minute * msPerMinute;
|
|
270
284
|
msSinceSwcStart += this.second * 1e3;
|
|
271
285
|
return msSinceSwcStart;
|
|
272
286
|
}
|
|
273
287
|
};
|
|
274
|
-
__publicField(_SwcTimestamp, "swcStart", new Date(1998, 11, 3, 7, 0, 0));
|
|
288
|
+
__publicField(_SwcTimestamp, "swcStart", new Date(Date.UTC(1998, 11, 3, 7, 0, 0)));
|
|
275
289
|
let SwcTimestamp = _SwcTimestamp;
|
|
276
290
|
const durationToSeconds = (duration) => (duration.years || 0) * 365 * 24 * 60 * 60 + (duration.days || 0) * 24 * 60 * 60 + (duration.hours || 0) * 60 * 60 + (duration.minutes || 0) * 60 + (duration.seconds || 0);
|
|
277
291
|
const secondsToDuration = (seconds) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -440,6 +440,11 @@ export declare class SwcTimestamp {
|
|
|
440
440
|
*/
|
|
441
441
|
subtract(duration: Partial<Duration>): SwcTimestamp;
|
|
442
442
|
getDurationTo(otherTimestamp: SwcTimestamp): Duration;
|
|
443
|
+
/**
|
|
444
|
+
* Convert the SWC timestamp to a string (i.e. Year 25 Day 60, 12:45:21)
|
|
445
|
+
* @param format 'full' = Year 25, Day 60, 12:45:21, 'short' = 'Y26 D60, 12:45:21', 'day' = 'Y26 D60'.
|
|
446
|
+
*/
|
|
447
|
+
toString(format?: 'full' | 'short' | 'day'): string;
|
|
443
448
|
/**
|
|
444
449
|
* @returns {number}
|
|
445
450
|
* @private
|
package/dist/index.esm.js
CHANGED
|
@@ -171,7 +171,7 @@ const _SwcTimestamp = class _SwcTimestamp {
|
|
|
171
171
|
const seconds = Math.floor(msSinceSwcStart / 1e3);
|
|
172
172
|
return new _SwcTimestamp({
|
|
173
173
|
year,
|
|
174
|
-
day,
|
|
174
|
+
day: day + 1,
|
|
175
175
|
hour,
|
|
176
176
|
minute,
|
|
177
177
|
second: seconds
|
|
@@ -251,6 +251,20 @@ const _SwcTimestamp = class _SwcTimestamp {
|
|
|
251
251
|
const endTime = otherTimestamp.toUnixTimestamp("sec");
|
|
252
252
|
return secondsToDuration(endTime - startTime);
|
|
253
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Convert the SWC timestamp to a string (i.e. Year 25 Day 60, 12:45:21)
|
|
256
|
+
* @param format 'full' = Year 25, Day 60, 12:45:21, 'short' = 'Y26 D60, 12:45:21', 'day' = 'Y26 D60'.
|
|
257
|
+
*/
|
|
258
|
+
toString(format = "full") {
|
|
259
|
+
switch (format) {
|
|
260
|
+
case "full":
|
|
261
|
+
return `Year ${this.year} Day ${this.day}, ${this.hour}:${this.minute}:${this.second}`;
|
|
262
|
+
case "short":
|
|
263
|
+
return `Y${this.year} D${this.day}, ${this.hour}:${this.minute}:${this.second}`;
|
|
264
|
+
case "day":
|
|
265
|
+
return `Y${this.year} D${this.day}`;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
254
268
|
/**
|
|
255
269
|
* @returns {number}
|
|
256
270
|
* @private
|
|
@@ -263,13 +277,13 @@ const _SwcTimestamp = class _SwcTimestamp {
|
|
|
263
277
|
let msSinceSwcStart = 0;
|
|
264
278
|
msSinceSwcStart += this.year * msPerYear;
|
|
265
279
|
msSinceSwcStart += (this.day - 1) * msPerDay;
|
|
266
|
-
msSinceSwcStart +=
|
|
280
|
+
msSinceSwcStart += this.hour * msPerHour;
|
|
267
281
|
msSinceSwcStart += this.minute * msPerMinute;
|
|
268
282
|
msSinceSwcStart += this.second * 1e3;
|
|
269
283
|
return msSinceSwcStart;
|
|
270
284
|
}
|
|
271
285
|
};
|
|
272
|
-
__publicField(_SwcTimestamp, "swcStart", new Date(1998, 11, 3, 7, 0, 0));
|
|
286
|
+
__publicField(_SwcTimestamp, "swcStart", new Date(Date.UTC(1998, 11, 3, 7, 0, 0)));
|
|
273
287
|
let SwcTimestamp = _SwcTimestamp;
|
|
274
288
|
const durationToSeconds = (duration) => (duration.years || 0) * 365 * 24 * 60 * 60 + (duration.days || 0) * 24 * 60 * 60 + (duration.hours || 0) * 60 * 60 + (duration.minutes || 0) * 60 + (duration.seconds || 0);
|
|
275
289
|
const secondsToDuration = (seconds) => {
|