Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the value returned by ms() to a Date #217

Open
CarlosDev123 opened this issue Apr 20, 2024 · 0 comments
Open

Convert the value returned by ms() to a Date #217

CarlosDev123 opened this issue Apr 20, 2024 · 0 comments

Comments

@CarlosDev123
Copy link

CarlosDev123 commented Apr 20, 2024

Current code:

  const time = new Date();
  time.setDate(time.getDate() + 30);
  const expiresAt = new Date(time);

  const punishmentData = {
    id: '',
    type: '',
    user: '',
    guild: '',
    moderator: '',
    reason: '',
    date: '',
    expires: '',
    automod: '',
    expireAt: expiresAt
  };

What i'm trying to do:

const punishmentData = {
  id: '',
  type: '',
  user: '',
  guild: '',
  moderator: '',
  reason: '',
  date: '',
  expires: '',
  automod: '',
  expireAt: ms('30d') // be able to convert this into a Date, since mongoose only accepts Date's
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant