mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 13:47:33 +01:00
add cards to event content cycle
This commit is contained in:
committed by
Sabe Jones
parent
249394b4ad
commit
6e96085f99
@@ -1,4 +1,6 @@
|
||||
/* eslint-disable key-spacing */
|
||||
import filter from 'lodash/filter';
|
||||
import moment from 'moment';
|
||||
|
||||
// gem block: number of gems
|
||||
const gemsPromo = {
|
||||
@@ -14,12 +16,28 @@ export const REPEATING_EVENTS = {
|
||||
end: '1970-01-04T23:59-05:00',
|
||||
season: 'nye',
|
||||
npcImageSuffix: '_nye',
|
||||
content: [
|
||||
{
|
||||
type: 'cards',
|
||||
items: [
|
||||
'nye',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
valentines: {
|
||||
start: '1970-02-13T08:00-05:00',
|
||||
end: '1970-02-17T23:59-05:00',
|
||||
season: 'valentines',
|
||||
npcImageSuffix: '_valentines',
|
||||
content: [
|
||||
{
|
||||
type: 'cards',
|
||||
items: [
|
||||
'valentine',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
birthday: {
|
||||
start: '1970-01-30T08:00-05:00',
|
||||
@@ -35,6 +53,17 @@ export const REPEATING_EVENTS = {
|
||||
},
|
||||
};
|
||||
|
||||
export function getRepeatingEvents (date) {
|
||||
const momentDate = date instanceof moment ? date : moment(date);
|
||||
return filter(Object.keys(REPEATING_EVENTS), eventKey => {
|
||||
const eventData = REPEATING_EVENTS[eventKey];
|
||||
const startDate = eventData.start.replace('1970', momentDate.year());
|
||||
const endDate = eventData.end.replace('1970', momentDate.year());
|
||||
|
||||
return momentDate.isBetween(startDate, endDate);
|
||||
});
|
||||
}
|
||||
|
||||
export const EVENTS = {
|
||||
noEvent: {
|
||||
start: '2024-05-01T00:00-04:00',
|
||||
|
||||
Reference in New Issue
Block a user