Fix sticker seeder.
This commit is contained in:
@@ -7,8 +7,7 @@ import { getDaysInMonth, getYear, getMonth, isBefore } from "date-fns";
|
||||
*/
|
||||
|
||||
const generateSticker = (): -2 | -1 | 0 | 1 | 2 => {
|
||||
const stickerPossibility = [-2, -1, 0, 1, 2];
|
||||
const sticker = Math.floor(Math.random() * stickerPossibility.length);
|
||||
const sticker = Math.floor(Math.random() * (2 - -2 + 1)) + -2;
|
||||
|
||||
if (
|
||||
sticker === -2 ||
|
||||
@@ -21,14 +20,14 @@ const generateSticker = (): -2 | -1 | 0 | 1 | 2 => {
|
||||
}
|
||||
};
|
||||
|
||||
const stickersSeeder = (): Sticker[] => {
|
||||
const stickersSeeder = (): StickerDays => {
|
||||
const stickers = [] as Sticker[];
|
||||
|
||||
const now = new Date();
|
||||
const daysOfThisMonth = getDaysInMonth(now);
|
||||
|
||||
for (let i = 0; i <= daysOfThisMonth; i++) {
|
||||
const currDate = new Date(getYear(now), getMonth(now) - 1, i);
|
||||
for (let i = 1; i <= daysOfThisMonth; i++) {
|
||||
const currDate = new Date(getYear(now), getMonth(now), i);
|
||||
|
||||
const newSticker: Sticker = {
|
||||
date: currDate,
|
||||
|
||||
Reference in New Issue
Block a user