@lighthouse/common 4.29.0 → 4.29.1-canary-A
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.
|
@@ -28,9 +28,10 @@ function generateScheduleEnd({
|
|
|
28
28
|
const isFrequencyLessThanWeek = (0, _fp.includes)(frequencyUnit, [_scheduling.Unit.Millisecond, _scheduling.Unit.Second, _scheduling.Unit.Minute, _scheduling.Unit.Hour, _scheduling.Unit.Day]);
|
|
29
29
|
|
|
30
30
|
const mStart = _momentTimezone.default.tz(start, timezone); // NOTE: if frequency unit less than a week we must set end to jump a week
|
|
31
|
+
// plus the interval length of the schedule frequency
|
|
31
32
|
// so that we can ensure that we are within a service interval
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
const end = isFrequencyLessThanWeek ? mStart.add(1, _scheduling.Unit.Week).valueOf() : mStart.add(frequencyValue * 2, frequencyUnit).valueOf();
|
|
35
|
+
const end = isFrequencyLessThanWeek ? mStart.add(1, _scheduling.Unit.Week).add(frequencyValue, frequencyUnit).valueOf() : mStart.add(frequencyValue * 2, frequencyUnit).valueOf();
|
|
35
36
|
return end;
|
|
36
37
|
}
|
|
@@ -13,9 +13,10 @@ export function generateScheduleEnd(_ref) {
|
|
|
13
13
|
frequencyValue = frequency.value;
|
|
14
14
|
var isFrequencyLessThanWeek = includes(frequencyUnit, [Unit.Millisecond, Unit.Second, Unit.Minute, Unit.Hour, Unit.Day]);
|
|
15
15
|
var mStart = moment.tz(start, timezone); // NOTE: if frequency unit less than a week we must set end to jump a week
|
|
16
|
+
// plus the interval length of the schedule frequency
|
|
16
17
|
// so that we can ensure that we are within a service interval
|
|
17
18
|
|
|
18
|
-
var end = isFrequencyLessThanWeek ? mStart.add(1, Unit.Week).valueOf() : mStart.add(frequencyValue * 2, frequencyUnit).valueOf();
|
|
19
|
+
var end = isFrequencyLessThanWeek ? mStart.add(1, Unit.Week).add(frequencyValue, frequencyUnit).valueOf() : mStart.add(frequencyValue * 2, frequencyUnit).valueOf();
|
|
19
20
|
return end;
|
|
20
21
|
}
|
|
21
22
|
//# sourceMappingURL=generateScheduleEnd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/scheduling/helpers/generateScheduleEnd.ts"],"names":["includes","moment","Unit","generateScheduleEnd","frequency","start","timezone","frequencyUnit","unit","frequencyValue","value","isFrequencyLessThanWeek","Millisecond","Second","Minute","Hour","Day","mStart","tz","end","add","Week","valueOf"],"mappings":"AAAA,SAASA,QAAT,QAAyB,WAAzB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AAEA,SAAiBC,IAAjB,QAA6B,qBAA7B;;AAQA;;;AAGA,OAAO,SAASC,mBAAT,OAIyB;AAAA,MAH9BC,SAG8B,QAH9BA,SAG8B;AAAA,MAF9BC,KAE8B,QAF9BA,KAE8B;AAAA,MAD9BC,QAC8B,QAD9BA,QAC8B;AAAA,MAChBC,aADgB,GACyBH,SADzB,CACtBI,IADsB;AAAA,MACMC,cADN,GACyBL,SADzB,CACDM,KADC;AAG9B,MAAMC,uBAAuB,GAAGX,QAAQ,CAACO,aAAD,EAAgB,CACtDL,IAAI,CAACU,WADiD,EAEtDV,IAAI,CAACW,MAFiD,EAGtDX,IAAI,CAACY,MAHiD,EAItDZ,IAAI,CAACa,IAJiD,EAKtDb,IAAI,CAACc,GALiD,CAAhB,CAAxC;AAQA,MAAMC,MAAM,GAAGhB,MAAM,CAACiB,EAAP,CAAUb,KAAV,EAAiBC,QAAjB,CAAf,CAX8B,CAa9B;AACA;;AACA,MAAMa,GAAG,GAAGR,uBAAuB,GAC/BM,MAAM,CAACG,GAAP,CAAW,CAAX,EAAclB,IAAI,CAACmB,IAAnB,
|
|
1
|
+
{"version":3,"sources":["../../../src/scheduling/helpers/generateScheduleEnd.ts"],"names":["includes","moment","Unit","generateScheduleEnd","frequency","start","timezone","frequencyUnit","unit","frequencyValue","value","isFrequencyLessThanWeek","Millisecond","Second","Minute","Hour","Day","mStart","tz","end","add","Week","valueOf"],"mappings":"AAAA,SAASA,QAAT,QAAyB,WAAzB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AAEA,SAAiBC,IAAjB,QAA6B,qBAA7B;;AAQA;;;AAGA,OAAO,SAASC,mBAAT,OAIyB;AAAA,MAH9BC,SAG8B,QAH9BA,SAG8B;AAAA,MAF9BC,KAE8B,QAF9BA,KAE8B;AAAA,MAD9BC,QAC8B,QAD9BA,QAC8B;AAAA,MAChBC,aADgB,GACyBH,SADzB,CACtBI,IADsB;AAAA,MACMC,cADN,GACyBL,SADzB,CACDM,KADC;AAG9B,MAAMC,uBAAuB,GAAGX,QAAQ,CAACO,aAAD,EAAgB,CACtDL,IAAI,CAACU,WADiD,EAEtDV,IAAI,CAACW,MAFiD,EAGtDX,IAAI,CAACY,MAHiD,EAItDZ,IAAI,CAACa,IAJiD,EAKtDb,IAAI,CAACc,GALiD,CAAhB,CAAxC;AAQA,MAAMC,MAAM,GAAGhB,MAAM,CAACiB,EAAP,CAAUb,KAAV,EAAiBC,QAAjB,CAAf,CAX8B,CAa9B;AACA;AACA;;AACA,MAAMa,GAAG,GAAGR,uBAAuB,GAC/BM,MAAM,CAACG,GAAP,CAAW,CAAX,EAAclB,IAAI,CAACmB,IAAnB,EAAyBD,GAAzB,CAA6BX,cAA7B,EAA6CF,aAA7C,EAA4De,OAA5D,EAD+B,GAE/BL,MAAM,CAACG,GAAP,CAAWX,cAAc,GAAG,CAA5B,EAA+BF,aAA/B,EAA8Ce,OAA9C,EAFJ;AAIA,SAAOH,GAAP;AACD","sourcesContent":["import { includes } from 'lodash/fp'\nimport moment from 'moment-timezone'\n\nimport { Period, Unit } from '../scheduling.types'\n\ninterface GenerateScheduleEnd {\n readonly frequency: Period\n readonly start: number\n readonly timezone: string\n}\n\n/**\n * Generates a schedule end datetime based on the start and frequency\n */\nexport function generateScheduleEnd({\n frequency,\n start,\n timezone,\n}: GenerateScheduleEnd): number {\n const { unit: frequencyUnit, value: frequencyValue } = frequency\n\n const isFrequencyLessThanWeek = includes(frequencyUnit, [\n Unit.Millisecond,\n Unit.Second,\n Unit.Minute,\n Unit.Hour,\n Unit.Day,\n ])\n\n const mStart = moment.tz(start, timezone)\n\n // NOTE: if frequency unit less than a week we must set end to jump a week\n // plus the interval length of the schedule frequency\n // so that we can ensure that we are within a service interval\n const end = isFrequencyLessThanWeek\n ? mStart.add(1, Unit.Week).add(frequencyValue, frequencyUnit).valueOf()\n : mStart.add(frequencyValue * 2, frequencyUnit).valueOf()\n\n return end\n}\n"],"file":"generateScheduleEnd.js"}
|
package/package.json
CHANGED
package/mise.toml
DELETED