mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
WIP(shops): cShop reconciled to schedule backend
This commit is contained in:
@@ -745,6 +745,19 @@ export const GALA_SCHEDULE = {
|
||||
},
|
||||
};
|
||||
|
||||
export const TYPE_SCHEDULE = {
|
||||
timeTravelers: FIRST_RELEASE_DAY,
|
||||
backgrounds: SECOND_RELEASE_DAY,
|
||||
petQuests: THIRD_RELEASE_DAY,
|
||||
hatchingPotionQuests: THIRD_RELEASE_DAY,
|
||||
bundles: THIRD_RELEASE_DAY,
|
||||
premiumHatchingPotions: FOURTH_RELEASE_DAY,
|
||||
seasonalGear: GALA_SWITCHOVER_DAY,
|
||||
seasonalSpells: GALA_SWITCHOVER_DAY,
|
||||
seasonalQuests: GALA_SWITCHOVER_DAY,
|
||||
customizations: GALA_SWITCHOVER_DAY,
|
||||
};
|
||||
|
||||
function getDay (date) {
|
||||
if (date === undefined) {
|
||||
return 0;
|
||||
@@ -804,6 +817,7 @@ let cacheDate = null;
|
||||
function makeMatcherClass () {
|
||||
return {
|
||||
matchers: [],
|
||||
end: new Date(),
|
||||
items: [],
|
||||
match (key) {
|
||||
if (this.matchers.length === 0) {
|
||||
@@ -818,9 +832,6 @@ function makeMatcherClass () {
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getEndDate () {
|
||||
return new Date();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -846,7 +857,12 @@ export function getScheduleMatchingGroup (type, date) {
|
||||
});
|
||||
}
|
||||
if (!cachedScheduleMatchers[type]) {
|
||||
let end = moment(checkedDate).date(TYPE_SCHEDULE[type]);
|
||||
if (end.date() <= checkedDate.date()) {
|
||||
end = moment(end).add(1, 'months');
|
||||
}
|
||||
return {
|
||||
end: end.toDate(),
|
||||
items: [],
|
||||
match () {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user