swcombine.js 0.0.8 → 0.0.9

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 CHANGED
@@ -255,15 +255,29 @@ const _SwcTimestamp = class _SwcTimestamp {
255
255
  }
256
256
  /**
257
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'.
258
+ * The following formats are available:
259
+ *
260
+ * 'full': Year 25 Day 60, 6:03:12<br>
261
+ * 'minute': Year 25 Day 60, 6:03<br>
262
+ * 'day': Year 25 Day 60<br>
263
+ * 'shortFull': Y25 D60, 6:03:12<br>
264
+ * 'shortMinute': Y25 D60, 6:03<br>
265
+ * 'shortDay': Y26 D60
266
+ * @param format format to use
259
267
  */
260
- toString(format = "full") {
268
+ toString(format) {
261
269
  switch (format) {
262
270
  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}`;
271
+ return `Year ${this.year} Day ${this.day}, ${this.hour}:${this.minute.toString().padStart(2, "0")}:${this.second.toString().padStart(2, "0")}`;
272
+ case "minute":
273
+ return `Year ${this.year} Day ${this.day}, ${this.hour}:${this.minute.toString().padStart(2, "0")}`;
266
274
  case "day":
275
+ return `Year ${this.year} Day ${this.day}`;
276
+ case "shortFull":
277
+ return `Y${this.year} D${this.day}, ${this.hour}:${this.minute.toString().padStart(2, "0")}:${this.second.toString().padStart(2, "0")}`;
278
+ case "shortMinute":
279
+ return `Y${this.year} D${this.day}, ${this.hour}:${this.minute.toString().padStart(2, "0")}}`;
280
+ case "shortDay":
267
281
  return `Y${this.year} D${this.day}`;
268
282
  }
269
283
  }
package/dist/index.d.ts CHANGED
@@ -442,9 +442,17 @@ export declare class SwcTimestamp {
442
442
  getDurationTo(otherTimestamp: SwcTimestamp): Duration;
443
443
  /**
444
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'.
445
+ * The following formats are available:
446
+ *
447
+ * 'full': Year 25 Day 60, 6:03:12<br>
448
+ * 'minute': Year 25 Day 60, 6:03<br>
449
+ * 'day': Year 25 Day 60<br>
450
+ * 'shortFull': Y25 D60, 6:03:12<br>
451
+ * 'shortMinute': Y25 D60, 6:03<br>
452
+ * 'shortDay': Y26 D60
453
+ * @param format format to use
446
454
  */
447
- toString(format?: 'full' | 'short' | 'day'): string;
455
+ toString(format: 'full' | 'minute' | 'day' | 'shortFull' | 'shortMinute' | 'shortDay'): string;
448
456
  /**
449
457
  * @returns {number}
450
458
  * @private
package/dist/index.esm.js CHANGED
@@ -253,15 +253,29 @@ const _SwcTimestamp = class _SwcTimestamp {
253
253
  }
254
254
  /**
255
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'.
256
+ * The following formats are available:
257
+ *
258
+ * 'full': Year 25 Day 60, 6:03:12<br>
259
+ * 'minute': Year 25 Day 60, 6:03<br>
260
+ * 'day': Year 25 Day 60<br>
261
+ * 'shortFull': Y25 D60, 6:03:12<br>
262
+ * 'shortMinute': Y25 D60, 6:03<br>
263
+ * 'shortDay': Y26 D60
264
+ * @param format format to use
257
265
  */
258
- toString(format = "full") {
266
+ toString(format) {
259
267
  switch (format) {
260
268
  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}`;
269
+ return `Year ${this.year} Day ${this.day}, ${this.hour}:${this.minute.toString().padStart(2, "0")}:${this.second.toString().padStart(2, "0")}`;
270
+ case "minute":
271
+ return `Year ${this.year} Day ${this.day}, ${this.hour}:${this.minute.toString().padStart(2, "0")}`;
264
272
  case "day":
273
+ return `Year ${this.year} Day ${this.day}`;
274
+ case "shortFull":
275
+ return `Y${this.year} D${this.day}, ${this.hour}:${this.minute.toString().padStart(2, "0")}:${this.second.toString().padStart(2, "0")}`;
276
+ case "shortMinute":
277
+ return `Y${this.year} D${this.day}, ${this.hour}:${this.minute.toString().padStart(2, "0")}}`;
278
+ case "shortDay":
265
279
  return `Y${this.year} D${this.day}`;
266
280
  }
267
281
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swcombine.js",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "swcombine",