mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
15 lines
425 B
JavaScript
15 lines
425 B
JavaScript
import moment from 'moment';
|
|
import { MAX_LEVEL } from '../constants';
|
|
|
|
export default function isFreeRebirth (user) {
|
|
let daysFromLastFreeRebirth = user.flags.lastFreeRebirth;
|
|
|
|
if (daysFromLastFreeRebirth) {
|
|
daysFromLastFreeRebirth = moment().diff(moment(user.flags.lastFreeRebirth), 'days');
|
|
} else {
|
|
daysFromLastFreeRebirth = 999;
|
|
}
|
|
|
|
return user.stats.lvl >= MAX_LEVEL && daysFromLastFreeRebirth > 45;
|
|
}
|