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

Proposal for getOpeningAndExpiryStatus #1

Open
MaximeCrp opened this issue Jun 1, 2023 · 0 comments
Open

Proposal for getOpeningAndExpiryStatus #1

MaximeCrp opened this issue Jun 1, 2023 · 0 comments

Comments

@MaximeCrp
Copy link

export const getOpeningAndExpiryStatus = (
  startDate: moment.Moment | undefined,
  endDate: moment.Moment | undefined
) => {
  let isOpen;
  let isExpired;

  if (startDate === undefined) {
    isOpen = true;
  } else isOpen = moment().isAfter(startDate);

  if (endDate === undefined) {
    isExpired = false;
  } else isExpired = moment().isAfter(endDate);

  return {
    isOpen,
    isExpired,
  };
};
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