Huthaifa-Dev / project

Operands must both be numbers or strings in addition expressions JS-0377
Anti-pattern
8 months ago8 months old
Operands to the + operator should be both numbers or both strings
26      const newUser = getUser(username);
27      setUser(newUser);
28      setLocalUser(newUser);
29      toast.success(newUser?.fullName + " has logged in successfully!");30
31      if (newUser) {
32        dispatch(
Operands to the + operator should be both numbers or both strings
 1export const createDate = (value: Date) => {
 2  const currentDate = value;
 3  const date =
 4    currentDate.getFullYear() + 5    "-" + 6    (currentDate.getMonth() + 1) +
 7    "-" +
 8    currentDate.getDate();
Operands to the + operator should be both numbers or both strings
 7    "-" +
 8    currentDate.getDate();
 9  const time =
10    currentDate.getHours() +11    ":" +12    currentDate.getMinutes() +
13    ":" +
14    currentDate.getSeconds();
Operands to the + operator should be both numbers or both strings
 7    "-" +
 8    currentDate.getDate();
 9  const time =
10    currentDate.getHours() +11    ":" +12    currentDate.getMinutes() +13    ":" +
14    currentDate.getSeconds();
15  const dateTime = date + " " + time;
Operands to the + operator should be both numbers or both strings
 7    "-" +
 8    currentDate.getDate();
 9  const time =
10    currentDate.getHours() +11    ":" +12    currentDate.getMinutes() +13    ":" +14    currentDate.getSeconds();15  const dateTime = date + " " + time;
16  return dateTime;
17};