@managesome/eposmatic-toolkit 0.2.539 → 0.2.541

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.
@@ -68,6 +68,7 @@ export interface ILocalTimeFields {
68
68
  localWeekOfYear: number;
69
69
  localMonth: number;
70
70
  localQuarter: number;
71
+ localSemester: number;
71
72
  localYear: number;
72
73
  localDate: string;
73
74
  localTime: string;
@@ -13,7 +13,7 @@ export declare function convertMilliToTime(milliseconds: number): {
13
13
  minutes: number;
14
14
  hours: number;
15
15
  };
16
- export declare function getHMS(milliseconds: number): string;
16
+ export declare function getHMS(milliseconds: number, showSeconds?: boolean): string;
17
17
  export declare function fakeDelay(delay?: number): Promise<void>;
18
18
  export declare const isValidNumber: RegExp;
19
19
  export declare function pxToRem(value: number): string;
@@ -110,17 +110,20 @@ function convertMilliToTime(milliseconds) {
110
110
  };
111
111
  }
112
112
  // ==============================>><<==============================
113
- function getHMS(milliseconds) {
113
+ function getHMS(milliseconds, showSeconds) {
114
114
  const date = new Date(milliseconds);
115
115
  let hours = date.getUTCHours();
116
116
  let minutes = date.getUTCMinutes();
117
- const seconds = '00';
117
+ let seconds = showSeconds ? date.getUTCSeconds() : 0;
118
118
  if (hours < 10) {
119
119
  hours = '0' + hours;
120
120
  }
121
121
  if (minutes < 10) {
122
122
  minutes = '0' + minutes;
123
123
  }
124
+ if (seconds < 10) {
125
+ seconds = '0' + seconds;
126
+ }
124
127
  return hours + ':' + minutes + ':' + seconds;
125
128
  }
126
129
  // ==============================>><<==============================
@@ -9,6 +9,7 @@ export declare function getLocalDocumentFields(gmtOffset: number, date: Date): {
9
9
  localWeekOfYear: number;
10
10
  localMonth: number;
11
11
  localQuarter: number;
12
+ localSemester: number;
12
13
  localYear: number;
13
14
  localDate: string;
14
15
  localTime: string;
@@ -37,6 +37,8 @@ function getLocalDocumentFields(gmtOffset, date) {
37
37
  const localWeekOfYear = Math.ceil((dayOfYear + startOfYear.getDay()) / 7);
38
38
  // Calculate quarter (1-4)
39
39
  const localQuarter = Math.ceil(localMonth / 3);
40
+ // Calculate semester (1-2)
41
+ const localSemester = Math.ceil(localMonth / 6);
40
42
  // Format date and time strings
41
43
  const localDateString = `${localYear}-${String(localMonth).padStart(2, '0')}-${String(localDate).padStart(2, '0')}`;
42
44
  const localTimeString = `${String(localHour).padStart(2, '0')}:${String(localMinute).padStart(2, '0')}:${String(localSecond).padStart(2, '0')}`;
@@ -49,6 +51,7 @@ function getLocalDocumentFields(gmtOffset, date) {
49
51
  localWeekOfYear,
50
52
  localMonth,
51
53
  localQuarter,
54
+ localSemester,
52
55
  localYear,
53
56
  localDate: localDateString,
54
57
  localTime: localTimeString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.539",
3
+ "version": "0.2.541",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",