@pallasoft/ps-utilities 1.0.1 → 1.0.3

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.
@@ -3,6 +3,7 @@ export declare class DateService {
3
3
  static getDate(date?: string | number): Dayjs;
4
4
  static getToday(): string;
5
5
  static getTomorrow(): string;
6
+ static formatSecondsToTime(seconds: number): string;
6
7
  static calculateTimeRemaining(date: string | number, placeholder: string): string;
7
8
  static getNextWeek(): string;
8
9
  static getNextMonth(): string;
@@ -23,6 +23,20 @@ var DateService = /** @class */ (function () {
23
23
  DateService.getTomorrow = function () {
24
24
  return (0, dayjs_1.default)().add(1, 'day').toISOString();
25
25
  };
26
+ DateService.formatSecondsToTime = function (seconds) {
27
+ var hours = Math.floor(seconds / 3600);
28
+ var minutes = Math.floor((seconds % 3600) / 60);
29
+ var remainingSeconds = Math.floor(seconds % 60);
30
+ if (hours > 0) {
31
+ return "".concat(String(hours).padStart(2, '0'), ":").concat(String(minutes).padStart(2, '0'), ":").concat(String(remainingSeconds).padStart(2, '0'));
32
+ }
33
+ else if (minutes > 0) {
34
+ return "".concat(String(minutes).padStart(2, '0'), ":").concat(String(remainingSeconds).padStart(2, '0'));
35
+ }
36
+ else {
37
+ return "00:".concat(String(remainingSeconds).padStart(2, '0'));
38
+ }
39
+ };
26
40
  DateService.calculateTimeRemaining = function (date, placeholder) {
27
41
  var currentDate = (0, dayjs_1.default)();
28
42
  var targetDate = (0, dayjs_1.default)(date);
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-utilities",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "private": false,
5
- "type": "module",
6
5
  "main": "./dist/index.js",
7
6
  "types": "./dist/index.d.ts",
8
7
  "export": "/dist/index.js",