dce-reactkit 4.1.1 → 4.1.2

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.
@@ -4,7 +4,7 @@
4
4
  * @author Gabe Abrams
5
5
  * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
6
6
  * @returns object with timestamp (ms since epoch) and numbers
7
- * corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
7
+ * corresponding to ET time values for year, month, day, hour, hour12, minute, second, isPM
8
8
  * where hour is in 24hr time and hour12 is in 12hr time.
9
9
  */
10
10
  declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
@@ -15,6 +15,7 @@ declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
15
15
  hour: number;
16
16
  hour12: number;
17
17
  minute: number;
18
+ second: number;
18
19
  isPM: boolean;
19
20
  };
20
21
  export default getTimeInfoInET;
package/dist/index.d.ts CHANGED
@@ -996,7 +996,7 @@ declare const getOrdinal: (num: number) => string;
996
996
  * @author Gabe Abrams
997
997
  * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
998
998
  * @returns object with timestamp (ms since epoch) and numbers
999
- * corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
999
+ * corresponding to ET time values for year, month, day, hour, hour12, minute, second, isPM
1000
1000
  * where hour is in 24hr time and hour12 is in 12hr time.
1001
1001
  */
1002
1002
  declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
@@ -1007,6 +1007,7 @@ declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
1007
1007
  hour: number;
1008
1008
  hour12: number;
1009
1009
  minute: number;
1010
+ second: number;
1010
1011
  isPM: boolean;
1011
1012
  };
1012
1013
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -4,7 +4,7 @@
4
4
  * @author Gabe Abrams
5
5
  * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
6
6
  * @returns object with timestamp (ms since epoch) and numbers
7
- * corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
7
+ * corresponding to ET time values for year, month, day, hour, hour12, minute, second, isPM
8
8
  * where hour is in 24hr time and hour12 is in 12hr time.
9
9
  */
10
10
  const getTimeInfoInET = (dateOrTimestamp?: Date | number): {
@@ -15,6 +15,7 @@ const getTimeInfoInET = (dateOrTimestamp?: Date | number): {
15
15
  hour: number,
16
16
  hour12: number,
17
17
  minute: number,
18
+ second: number,
18
19
  isPM: boolean,
19
20
  } => {
20
21
  // Create a time string
@@ -45,6 +46,11 @@ const getTimeInfoInET = (dateOrTimestamp?: Date | number): {
45
46
  const month = Number.parseInt(monthStr, 10);
46
47
  const day = Number.parseInt(dayStr, 10);
47
48
  const minute = Number.parseInt(minStr, 10);
49
+ const second = (
50
+ ending.split(' ')[0]
51
+ ? Number.parseInt(ending.split(' ')[0], 10)
52
+ : 0
53
+ );
48
54
  const hour12 = Number.parseInt(hourStr, 10);
49
55
  // Convert from am/pm to 24hr
50
56
  const isAM = ending.toLowerCase().includes('am');
@@ -66,6 +72,7 @@ const getTimeInfoInET = (dateOrTimestamp?: Date | number): {
66
72
  hour12,
67
73
  isPM,
68
74
  minute,
75
+ second,
69
76
  };
70
77
  };
71
78