@sparted/shared-library 1.10.0 → 1.10.1
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/business/campaign/live-campaign.js +4 -4
- package/business/campaign/live-campaign.js.map +1 -1
- package/business/types/content.d.ts +0 -23
- package/date/difference-in-days.js +2 -3
- package/date/difference-in-days.js.map +1 -1
- package/date/get-next-day.js +5 -4
- package/date/get-next-day.js.map +1 -1
- package/date/index.d.ts +0 -1
- package/date/index.js +0 -2
- package/date/index.js.map +1 -1
- package/date/to-utc-date-string.js +3 -3
- package/date/to-utc-date-string.js.map +1 -1
- package/index.js +0 -2
- package/index.js.map +1 -1
- package/package.json +2 -3
- package/date/to-local-date-string.d.ts +0 -1
- package/date/to-local-date-string.js +0 -10
- package/date/to-local-date-string.js.map +0 -1
|
@@ -13,12 +13,12 @@ const computeIntenseCalendar = (card) => {
|
|
|
13
13
|
if (date > endDate) {
|
|
14
14
|
return calendar;
|
|
15
15
|
}
|
|
16
|
-
const jsDay = date.
|
|
16
|
+
const jsDay = date.getDay();
|
|
17
17
|
const day = jsDay === 0 ? 7 : jsDay;
|
|
18
18
|
if (details.enabledWeekDays.includes(day) && !details.disabledDates.includes(date.toISOString().slice(0, 10))) {
|
|
19
19
|
calendar.push(new Date(date));
|
|
20
20
|
}
|
|
21
|
-
date.
|
|
21
|
+
date.setDate(date.getDate() + 1);
|
|
22
22
|
return calculateIntenseCalendarAux(date, calendar);
|
|
23
23
|
};
|
|
24
24
|
return calculateIntenseCalendarAux(startDate, []);
|
|
@@ -51,7 +51,7 @@ const checkTodayPlayable = (card) => {
|
|
|
51
51
|
if (today < startDate || today > endDate) {
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
|
-
const jsDay = today.
|
|
54
|
+
const jsDay = today.getDay();
|
|
55
55
|
const day = jsDay === 0 ? 7 : jsDay;
|
|
56
56
|
if (!details.enabledWeekDays.includes(day)) {
|
|
57
57
|
return false;
|
|
@@ -64,7 +64,7 @@ const checkTodayPlayable = (card) => {
|
|
|
64
64
|
const findNextAvailableDate = (currentDate, enabledWeekDays, disabledDates) => {
|
|
65
65
|
if (enabledWeekDays.length === 0)
|
|
66
66
|
return null;
|
|
67
|
-
const dayofDate = currentDate.
|
|
67
|
+
const dayofDate = currentDate.getDay();
|
|
68
68
|
const isEnabledDay = enabledWeekDays.includes(dayofDate === 0 ? 7 : dayofDate);
|
|
69
69
|
const isDisabledDate = disabledDates.some((d) => isSameDate.isSameDate(d, currentDate));
|
|
70
70
|
if (isEnabledDay && !isDisabledDate) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-campaign.js","sources":["../../../src/business/campaign/live-campaign.ts"],"sourcesContent":["import { addDays, isSameDate } from '../../date';\nimport { CampaignDetails, LiveCampaign } from '../types';\n\nexport const computeIntenseCalendar = (card: LiveCampaign): Date[] => {\n const { details } = card;\n\n const startDate = new Date(details.utcStartDate);\n const endDate = new Date(details.utcEndDate);\n\n const calculateIntenseCalendarAux = (date: Date, calendar: Date[]): Date[] => {\n if (date > endDate) {\n return calendar;\n }\n\n const jsDay = date.
|
|
1
|
+
{"version":3,"file":"live-campaign.js","sources":["../../../src/business/campaign/live-campaign.ts"],"sourcesContent":["import { addDays, isSameDate } from '../../date';\nimport { CampaignDetails, LiveCampaign } from '../types';\n\nexport const computeIntenseCalendar = (card: LiveCampaign): Date[] => {\n const { details } = card;\n\n const startDate = new Date(details.utcStartDate);\n const endDate = new Date(details.utcEndDate);\n\n const calculateIntenseCalendarAux = (date: Date, calendar: Date[]): Date[] => {\n if (date > endDate) {\n return calendar;\n }\n\n const jsDay = date.getDay();\n const day = jsDay === 0 ? 7 : jsDay;\n\n if (details.enabledWeekDays.includes(day) && !details.disabledDates.includes(date.toISOString().slice(0, 10))) {\n calendar.push(new Date(date));\n }\n\n date.setDate(date.getDate() + 1);\n\n return calculateIntenseCalendarAux(date, calendar);\n };\n\n return calculateIntenseCalendarAux(startDate, []);\n};\n\nexport const computeCurrentSession = (card: LiveCampaign, forceComputeCalendar?: boolean): number => {\n const { details, achievement } = card;\n\n if (details.type === 'flexible' && !forceComputeCalendar) {\n return Math.min(achievement.lastSessionPlayed + 1, details.sessionCount);\n }\n\n const today = new Date();\n\n if (today <= new Date(details.utcStartDate)) {\n return 1;\n }\n\n if (today >= new Date(details.utcEndDate)) {\n return details.sessionCount;\n }\n\n const calendar = computeIntenseCalendar(card);\n\n const todayDate = today.toISOString().slice(0, 10);\n const currentSession = calendar.findIndex((date) => date.toISOString().slice(0, 10) >= todayDate);\n\n if (currentSession === -1) {\n throw new Error('Current session not found');\n }\n\n return Math.min(currentSession + 1, details.sessionCount);\n};\n\nexport const checkTodayPlayable = (card: LiveCampaign): boolean => {\n const today = new Date();\n\n const { details } = card;\n\n const startDate = new Date(details.utcStartDate);\n const endDate = new Date(details.utcEndDate);\n\n if (today < startDate || today > endDate) {\n return false;\n }\n\n const jsDay = today.getDay();\n const day = jsDay === 0 ? 7 : jsDay;\n\n if (!details.enabledWeekDays.includes(day)) {\n return false;\n }\n\n if (details.disabledDates.includes(today.toISOString().slice(0, 10))) {\n return false;\n }\n\n return true;\n};\n\nexport const findNextAvailableDate = (\n currentDate: Date,\n enabledWeekDays: number[],\n disabledDates: Date[],\n): Date | null => {\n if (enabledWeekDays.length === 0) return null;\n const dayofDate = currentDate.getDay();\n const isEnabledDay = enabledWeekDays.includes(dayofDate === 0 ? 7 : dayofDate);\n const isDisabledDate = disabledDates.some((d) => isSameDate(d, currentDate));\n\n if (isEnabledDay && !isDisabledDate) {\n return currentDate;\n }\n\n return findNextAvailableDate(addDays(currentDate, 1), enabledWeekDays, disabledDates);\n};\n\ntype GetCalendarSessionDatesFromCampaignProps = Pick<\n CampaignDetails,\n 'launchDate' | 'enabledWeekDays' | 'disabledDates' | 'nbSessions'\n> & {\n extraDays?: number;\n};\n\nexport const getCalendarSessionDatesFromCampaign = ({\n launchDate,\n enabledWeekDays,\n disabledDates,\n nbSessions,\n extraDays = 0,\n}: GetCalendarSessionDatesFromCampaignProps): Record<number, Date> => {\n const sessionCount = nbSessions + extraDays;\n\n const calendarDatesBySession = Array.from({ length: sessionCount }).reduce((acc: Record<number, Date>, _, index) => {\n const session = index + 1;\n const lastDate = session > 1 ? addDays(new Date(acc[session - 1]), 1) : new Date(launchDate);\n\n const nextSessionDate = findNextAvailableDate(lastDate, enabledWeekDays, disabledDates);\n\n if (!nextSessionDate) return acc;\n\n return {\n ...acc,\n [session]: nextSessionDate,\n };\n }, {});\n\n return calendarDatesBySession;\n};\n"],"names":["isSameDate","addDays"],"mappings":";;;;;;;AAGa,MAAA,sBAAsB,GAAG,CAAC,IAAkB,KAAY;AACnE,IAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE7C,IAAA,MAAM,2BAA2B,GAAG,CAAC,IAAU,EAAE,QAAgB,KAAY;QAC3E,IAAI,IAAI,GAAG,OAAO,EAAE;AAClB,YAAA,OAAO,QAAQ,CAAC;AACjB,SAAA;AAED,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;AAC5B,QAAA,MAAM,GAAG,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEpC,QAAA,IAAI,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE;YAC7G,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/B,SAAA;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,O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AAe,EAC1B,CAAA,CAAA;KACH,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,OAAO,sBAAsB,CAAC;AAChC;;;;;;;;"}
|
|
@@ -183,7 +183,6 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
183
183
|
"id-ID"?: string | undefined;
|
|
184
184
|
"lv-LV"?: string | undefined;
|
|
185
185
|
"th-TH"?: string | undefined;
|
|
186
|
-
"vi-VN"?: string | undefined;
|
|
187
186
|
} | undefined;
|
|
188
187
|
choices?: ({
|
|
189
188
|
text?: {
|
|
@@ -222,7 +221,6 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
222
221
|
"id-ID"?: string | undefined;
|
|
223
222
|
"lv-LV"?: string | undefined;
|
|
224
223
|
"th-TH"?: string | undefined;
|
|
225
|
-
"vi-VN"?: string | undefined;
|
|
226
224
|
} | undefined;
|
|
227
225
|
correct?: boolean | undefined;
|
|
228
226
|
} | undefined)[] | undefined;
|
|
@@ -276,7 +274,6 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
276
274
|
"id-ID"?: string | undefined;
|
|
277
275
|
"lv-LV"?: string | undefined;
|
|
278
276
|
"th-TH"?: string | undefined;
|
|
279
|
-
"vi-VN"?: string | undefined;
|
|
280
277
|
} | undefined;
|
|
281
278
|
};
|
|
282
279
|
export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game is {
|
|
@@ -332,7 +329,6 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
332
329
|
"id-ID"?: string | undefined;
|
|
333
330
|
"lv-LV"?: string | undefined;
|
|
334
331
|
"th-TH"?: string | undefined;
|
|
335
|
-
"vi-VN"?: string | undefined;
|
|
336
332
|
} | undefined;
|
|
337
333
|
correctText?: {
|
|
338
334
|
id?: number | undefined;
|
|
@@ -370,7 +366,6 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
370
366
|
"id-ID"?: string | undefined;
|
|
371
367
|
"lv-LV"?: string | undefined;
|
|
372
368
|
"th-TH"?: string | undefined;
|
|
373
|
-
"vi-VN"?: string | undefined;
|
|
374
369
|
} | undefined;
|
|
375
370
|
explanationMedia?: {
|
|
376
371
|
image?: {
|
|
@@ -422,7 +417,6 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
422
417
|
"id-ID"?: string | undefined;
|
|
423
418
|
"lv-LV"?: string | undefined;
|
|
424
419
|
"th-TH"?: string | undefined;
|
|
425
|
-
"vi-VN"?: string | undefined;
|
|
426
420
|
} | undefined;
|
|
427
421
|
};
|
|
428
422
|
export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => game is {
|
|
@@ -478,7 +472,6 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
478
472
|
"id-ID"?: string | undefined;
|
|
479
473
|
"lv-LV"?: string | undefined;
|
|
480
474
|
"th-TH"?: string | undefined;
|
|
481
|
-
"vi-VN"?: string | undefined;
|
|
482
475
|
} | undefined;
|
|
483
476
|
answer?: {
|
|
484
477
|
id?: number | undefined;
|
|
@@ -516,7 +509,6 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
516
509
|
"id-ID"?: string | undefined;
|
|
517
510
|
"lv-LV"?: string | undefined;
|
|
518
511
|
"th-TH"?: string | undefined;
|
|
519
|
-
"vi-VN"?: string | undefined;
|
|
520
512
|
} | undefined;
|
|
521
513
|
levenshteinDistance?: number | undefined;
|
|
522
514
|
explanationMedia?: {
|
|
@@ -569,7 +561,6 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
569
561
|
"id-ID"?: string | undefined;
|
|
570
562
|
"lv-LV"?: string | undefined;
|
|
571
563
|
"th-TH"?: string | undefined;
|
|
572
|
-
"vi-VN"?: string | undefined;
|
|
573
564
|
} | undefined;
|
|
574
565
|
};
|
|
575
566
|
export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => game is {
|
|
@@ -625,7 +616,6 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
|
|
|
625
616
|
"id-ID"?: string | undefined;
|
|
626
617
|
"lv-LV"?: string | undefined;
|
|
627
618
|
"th-TH"?: string | undefined;
|
|
628
|
-
"vi-VN"?: string | undefined;
|
|
629
619
|
} | undefined;
|
|
630
620
|
text?: {
|
|
631
621
|
id?: number | undefined;
|
|
@@ -663,7 +653,6 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
|
|
|
663
653
|
"id-ID"?: string | undefined;
|
|
664
654
|
"lv-LV"?: string | undefined;
|
|
665
655
|
"th-TH"?: string | undefined;
|
|
666
|
-
"vi-VN"?: string | undefined;
|
|
667
656
|
} | undefined;
|
|
668
657
|
secondMedia?: {
|
|
669
658
|
image?: {
|
|
@@ -731,7 +720,6 @@ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game
|
|
|
731
720
|
"id-ID"?: string | undefined;
|
|
732
721
|
"lv-LV"?: string | undefined;
|
|
733
722
|
"th-TH"?: string | undefined;
|
|
734
|
-
"vi-VN"?: string | undefined;
|
|
735
723
|
} | undefined;
|
|
736
724
|
description?: {
|
|
737
725
|
id?: number | undefined;
|
|
@@ -769,7 +757,6 @@ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game
|
|
|
769
757
|
"id-ID"?: string | undefined;
|
|
770
758
|
"lv-LV"?: string | undefined;
|
|
771
759
|
"th-TH"?: string | undefined;
|
|
772
|
-
"vi-VN"?: string | undefined;
|
|
773
760
|
} | undefined;
|
|
774
761
|
} | undefined)[] | undefined;
|
|
775
762
|
explanation?: {
|
|
@@ -808,7 +795,6 @@ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game
|
|
|
808
795
|
"id-ID"?: string | undefined;
|
|
809
796
|
"lv-LV"?: string | undefined;
|
|
810
797
|
"th-TH"?: string | undefined;
|
|
811
|
-
"vi-VN"?: string | undefined;
|
|
812
798
|
} | undefined;
|
|
813
799
|
};
|
|
814
800
|
export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => game is {
|
|
@@ -850,7 +836,6 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
|
|
|
850
836
|
"id-ID"?: string | undefined;
|
|
851
837
|
"lv-LV"?: string | undefined;
|
|
852
838
|
"th-TH"?: string | undefined;
|
|
853
|
-
"vi-VN"?: string | undefined;
|
|
854
839
|
} | undefined;
|
|
855
840
|
topLabel?: {
|
|
856
841
|
id?: number | undefined;
|
|
@@ -888,7 +873,6 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
|
|
|
888
873
|
"id-ID"?: string | undefined;
|
|
889
874
|
"lv-LV"?: string | undefined;
|
|
890
875
|
"th-TH"?: string | undefined;
|
|
891
|
-
"vi-VN"?: string | undefined;
|
|
892
876
|
} | undefined;
|
|
893
877
|
cards?: ({
|
|
894
878
|
id?: number | undefined;
|
|
@@ -926,7 +910,6 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
|
|
|
926
910
|
"id-ID"?: string | undefined;
|
|
927
911
|
"lv-LV"?: string | undefined;
|
|
928
912
|
"th-TH"?: string | undefined;
|
|
929
|
-
"vi-VN"?: string | undefined;
|
|
930
913
|
} | undefined)[] | undefined;
|
|
931
914
|
bottomLabel?: {
|
|
932
915
|
id?: number | undefined;
|
|
@@ -964,7 +947,6 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
|
|
|
964
947
|
"id-ID"?: string | undefined;
|
|
965
948
|
"lv-LV"?: string | undefined;
|
|
966
949
|
"th-TH"?: string | undefined;
|
|
967
|
-
"vi-VN"?: string | undefined;
|
|
968
950
|
} | undefined;
|
|
969
951
|
explanation?: {
|
|
970
952
|
id?: number | undefined;
|
|
@@ -1002,7 +984,6 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
|
|
|
1002
984
|
"id-ID"?: string | undefined;
|
|
1003
985
|
"lv-LV"?: string | undefined;
|
|
1004
986
|
"th-TH"?: string | undefined;
|
|
1005
|
-
"vi-VN"?: string | undefined;
|
|
1006
987
|
} | undefined;
|
|
1007
988
|
};
|
|
1008
989
|
export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => game is {
|
|
@@ -1044,7 +1025,6 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
|
|
|
1044
1025
|
"id-ID"?: string | undefined;
|
|
1045
1026
|
"lv-LV"?: string | undefined;
|
|
1046
1027
|
"th-TH"?: string | undefined;
|
|
1047
|
-
"vi-VN"?: string | undefined;
|
|
1048
1028
|
} | undefined;
|
|
1049
1029
|
zones?: ({
|
|
1050
1030
|
position?: SwipingCardPosition | undefined;
|
|
@@ -1084,7 +1064,6 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
|
|
|
1084
1064
|
"id-ID"?: string | undefined;
|
|
1085
1065
|
"lv-LV"?: string | undefined;
|
|
1086
1066
|
"th-TH"?: string | undefined;
|
|
1087
|
-
"vi-VN"?: string | undefined;
|
|
1088
1067
|
} | undefined;
|
|
1089
1068
|
} | undefined)[] | undefined;
|
|
1090
1069
|
cards?: ({
|
|
@@ -1131,7 +1110,6 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
|
|
|
1131
1110
|
"id-ID"?: string | undefined;
|
|
1132
1111
|
"lv-LV"?: string | undefined;
|
|
1133
1112
|
"th-TH"?: string | undefined;
|
|
1134
|
-
"vi-VN"?: string | undefined;
|
|
1135
1113
|
} | undefined;
|
|
1136
1114
|
answer?: SwipingCardPosition | undefined;
|
|
1137
1115
|
} | undefined)[] | undefined;
|
|
@@ -1171,7 +1149,6 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
|
|
|
1171
1149
|
"id-ID"?: string | undefined;
|
|
1172
1150
|
"lv-LV"?: string | undefined;
|
|
1173
1151
|
"th-TH"?: string | undefined;
|
|
1174
|
-
"vi-VN"?: string | undefined;
|
|
1175
1152
|
} | undefined;
|
|
1176
1153
|
};
|
|
1177
1154
|
export declare const extractGameExplanation: (game?: Game) => MultilingualLabel | undefined;
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
// Number of UTC calendar days from start to end, so it agrees with toUTCDateString and isSameDate.
|
|
6
5
|
const differenceInDays = (start, end) => {
|
|
7
6
|
const msPerDay = 24 * 60 * 60 * 1000;
|
|
8
|
-
const utcStart = Date.UTC(start.
|
|
9
|
-
const utcEnd = Date.UTC(end.
|
|
7
|
+
const utcStart = Date.UTC(start.getFullYear(), start.getMonth(), start.getDate());
|
|
8
|
+
const utcEnd = Date.UTC(end.getFullYear(), end.getMonth(), end.getDate());
|
|
10
9
|
return Math.floor((utcEnd - utcStart) / msPerDay);
|
|
11
10
|
};
|
|
12
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"difference-in-days.js","sources":["../../src/date/difference-in-days.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"difference-in-days.js","sources":["../../src/date/difference-in-days.ts"],"sourcesContent":["export const differenceInDays = (start: Date, end: Date): number => {\n const msPerDay = 24 * 60 * 60 * 1000;\n const utcStart = Date.UTC(start.getFullYear(), start.getMonth(), start.getDate());\n const utcEnd = Date.UTC(end.getFullYear(), end.getMonth(), end.getDate());\n return Math.floor((utcEnd - utcStart) / msPerDay);\n};\n"],"names":[],"mappings":";;;;MAAa,gBAAgB,GAAG,CAAC,KAAW,EAAE,GAAS,KAAY;IACjE,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;AAC1E,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,QAAQ,IAAI,QAAQ,CAAC,CAAC;AACpD;;;;"}
|
package/date/get-next-day.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const getNextDay = (date) => {
|
|
6
|
+
const nextDay = new Date(date);
|
|
7
|
+
nextDay.setDate(date.getDate() + 1);
|
|
8
|
+
return nextDay;
|
|
9
|
+
};
|
|
9
10
|
|
|
10
11
|
exports.getNextDay = getNextDay;
|
|
11
12
|
//# sourceMappingURL=get-next-day.js.map
|
package/date/get-next-day.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-next-day.js","sources":["../../src/date/get-next-day.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"get-next-day.js","sources":["../../src/date/get-next-day.ts"],"sourcesContent":["export const getNextDay = (date: Date): Date => {\n const nextDay = new Date(date);\n nextDay.setDate(date.getDate() + 1);\n\n return nextDay;\n};\n"],"names":[],"mappings":";;;;AAAa,MAAA,UAAU,GAAG,CAAC,IAAU,KAAU;AAC7C,IAAA,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpC,IAAA,OAAO,OAAO,CAAC;AACjB;;;;"}
|
package/date/index.d.ts
CHANGED
package/date/index.js
CHANGED
|
@@ -11,7 +11,6 @@ var differenceInDays = require('./difference-in-days.js');
|
|
|
11
11
|
var addDays = require('./add-days.js');
|
|
12
12
|
var getStartOfDay = require('./get-start-of-day.js');
|
|
13
13
|
var toUtcDateString = require('./to-utc-date-string.js');
|
|
14
|
-
var toLocalDateString = require('./to-local-date-string.js');
|
|
15
14
|
var getIsoDayNumber = require('./get-iso-day-number.js');
|
|
16
15
|
|
|
17
16
|
|
|
@@ -27,6 +26,5 @@ exports.addDays = addDays.addDays;
|
|
|
27
26
|
exports.startOfDay = getStartOfDay.startOfDay;
|
|
28
27
|
exports.startOfDayLocal = getStartOfDay.startOfDayLocal;
|
|
29
28
|
exports.toUTCDateString = toUtcDateString.toUTCDateString;
|
|
30
|
-
exports.toLocalDateString = toLocalDateString.toLocalDateString;
|
|
31
29
|
exports.getIsoDayNumber = getIsoDayNumber.getIsoDayNumber;
|
|
32
30
|
//# sourceMappingURL=index.js.map
|
package/date/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const toUTCDateString = (date) => {
|
|
6
|
+
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString().split('T')[0];
|
|
7
|
+
};
|
|
8
8
|
|
|
9
9
|
exports.toUTCDateString = toUTCDateString;
|
|
10
10
|
//# sourceMappingURL=to-utc-date-string.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-utc-date-string.js","sources":["../../src/date/to-utc-date-string.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"to-utc-date-string.js","sources":["../../src/date/to-utc-date-string.ts"],"sourcesContent":["export const toUTCDateString = (date: Date) => {\n return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString().split('T')[0];\n};\n"],"names":[],"mappings":";;;;AAAa,MAAA,eAAe,GAAG,CAAC,IAAU,KAAI;AAC5C,IAAA,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7G;;;;"}
|
package/index.js
CHANGED
|
@@ -57,7 +57,6 @@ var differenceInDays = require('./date/difference-in-days.js');
|
|
|
57
57
|
var addDays = require('./date/add-days.js');
|
|
58
58
|
var getStartOfDay = require('./date/get-start-of-day.js');
|
|
59
59
|
var toUtcDateString = require('./date/to-utc-date-string.js');
|
|
60
|
-
var toLocalDateString = require('./date/to-local-date-string.js');
|
|
61
60
|
var getIsoDayNumber = require('./date/get-iso-day-number.js');
|
|
62
61
|
|
|
63
62
|
|
|
@@ -156,6 +155,5 @@ exports.addDays = addDays.addDays;
|
|
|
156
155
|
exports.startOfDay = getStartOfDay.startOfDay;
|
|
157
156
|
exports.startOfDayLocal = getStartOfDay.startOfDayLocal;
|
|
158
157
|
exports.toUTCDateString = toUtcDateString.toUTCDateString;
|
|
159
|
-
exports.toLocalDateString = toLocalDateString.toLocalDateString;
|
|
160
158
|
exports.getIsoDayNumber = getIsoDayNumber.getIsoDayNumber;
|
|
161
159
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparted/shared-library",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"repository": "git@github.com:Sparted/shared-library.git",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Sparted",
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
"**/**"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"test": "jest
|
|
19
|
-
"test:timezones": "node scripts/test-timezones.js",
|
|
18
|
+
"test": "jest",
|
|
20
19
|
"lint": "eslint .",
|
|
21
20
|
"clean": "rm -rf ./dist",
|
|
22
21
|
"build": "yarn clean && rollup --config rollup.config.ts --configPlugin typescript2 && cp package.json ./dist/package.json",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const toLocalDateString: (date: Date) => string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const toLocalDateString = (date) => {
|
|
6
|
-
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString().split('T')[0];
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
exports.toLocalDateString = toLocalDateString;
|
|
10
|
-
//# sourceMappingURL=to-local-date-string.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-local-date-string.js","sources":["../../src/date/to-local-date-string.ts"],"sourcesContent":["export const toLocalDateString = (date: Date) => {\n return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString().split('T')[0];\n};\n"],"names":[],"mappings":";;;;AAAa,MAAA,iBAAiB,GAAG,CAAC,IAAU,KAAI;AAC9C,IAAA,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7G;;;;"}
|