utils#getNextOffchainPollEndingTime TypeScript Examples

The following examples show how to use utils#getNextOffchainPollEndingTime. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: poll_editor.tsx    From commonwealth with GNU General Public License v3.0 6 votes vote down vote up
getPollDurationCopy = (
  customDuration: string,
  customDurationEnabled: boolean
) => {
  if (customDurationEnabled && customDuration === 'Infinite') {
    return 'This poll will never expire.';
  } else if (customDurationEnabled && customDuration !== 'Infinite') {
    return `If started now, this poll will stay open until ${moment()
      .add(customDuration.split(' ')[0], 'days')
      .local()
      .format('lll')}.`;
  } else {
    return `By default, offchain polls run for at least 5 days, ending on the 1st
        and 15th of each month. If started now, this poll would stay open until
        ${getNextOffchainPollEndingTime(moment())
          .local()
          .format('lll')}. Override?`;
  }
}