@quesmed/types-rn 2.4.6 → 2.4.7
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/models/User.js +11 -12
- package/package.json +1 -1
package/models/User.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EClassYearGroup = exports.classYears = void 0;
|
|
4
|
+
const luxon_1 = require("luxon");
|
|
4
5
|
exports.classYears = [
|
|
5
6
|
'Year 1',
|
|
6
7
|
'Year 2',
|
|
@@ -33,7 +34,7 @@ var EPracticeIntensity;
|
|
|
33
34
|
EPracticeIntensity[EPracticeIntensity["MED"] = 2] = "MED";
|
|
34
35
|
EPracticeIntensity[EPracticeIntensity["HIGH"] = 3] = "HIGH";
|
|
35
36
|
})(EPracticeIntensity = exports.EPracticeIntensity || (exports.EPracticeIntensity = {}));
|
|
36
|
-
function currentClassYear(createdAtUnix, classYear, compareUnix =
|
|
37
|
+
function currentClassYear(createdAtUnix, classYear, compareUnix = luxon_1.DateTime.now().toUnixInteger()) {
|
|
37
38
|
if (createdAtUnix === 0) {
|
|
38
39
|
throw new Error('createdAt not given in Unix');
|
|
39
40
|
}
|
|
@@ -45,20 +46,18 @@ function currentClassYear(createdAtUnix, classYear, compareUnix = new Date().get
|
|
|
45
46
|
if (classYearsIdx === -1) {
|
|
46
47
|
return exports.classYears[lastClassYearIdx];
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
if (createdAt.getFullYear() > compareDate.getFullYear()) {
|
|
49
|
+
const compareDT = luxon_1.DateTime.fromSeconds(compareUnix);
|
|
50
|
+
const createdAtDT = luxon_1.DateTime.fromSeconds(createdAtUnix);
|
|
51
|
+
if (createdAtDT.year > compareDT.year) {
|
|
52
52
|
throw new Error('createdAt not given in Unix');
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (createdAt > createdAcademicYear) {
|
|
59
|
-
yearsAdded--;
|
|
54
|
+
let yearsAdded = compareDT.year - createdAtDT.year;
|
|
55
|
+
let createdAtAcademicDT = luxon_1.DateTime.local(createdAtDT.year, 8, 1);
|
|
56
|
+
if (createdAtDT < createdAtAcademicDT) {
|
|
57
|
+
createdAtAcademicDT = createdAtAcademicDT.minus({ year: 1 });
|
|
60
58
|
}
|
|
61
|
-
|
|
59
|
+
const compareAcademicDT = luxon_1.DateTime.local(compareDT.year, 8, 1);
|
|
60
|
+
if (compareDT > compareAcademicDT) {
|
|
62
61
|
yearsAdded++;
|
|
63
62
|
}
|
|
64
63
|
const newClassYearIdx = classYearsIdx + yearsAdded;
|