react-date-range icon indicating copy to clipboard operation
react-date-range copied to clipboard

Set no predefined value in calendar

Open martinpesout opened this issue 8 years ago • 6 comments

Is there any chance to define no default value when displaying calendar? I want to use this plugin only for selecting ranges, but I want to display only blank calendars by default after first render.

martinpesout avatar Apr 20 '16 15:04 martinpesout

Did you ever find a solution ?

EDIT: I found this in the source code:

import moment from 'moment';

export default function parseInput(input, format) {
  let output = null;

  if (typeof input === 'undefined' ||  typeof input === 'null' || !input || input === '') {
    output = moment().startOf('day');
  } else if (typeof input === 'string') {
    output = moment(input, format).startOf('day');
  } else if (typeof input === 'function') {
    output = parseInput( input(moment().startOf('day')) , format);
  } else if (input._isAMomentObject) {
    output = input.startOf('day').clone();
  }

  return output;
}

It seems that it will always return a moment object.

ZachPerkitny avatar Nov 20 '16 03:11 ZachPerkitny

Exactly. I think that currently there is no solution for this problem

martinpesout avatar Nov 20 '16 08:11 martinpesout

@martinpesout

Hopefully they'll make this possible, or maybe I'll make a pull request.

ZachPerkitny avatar Nov 20 '16 09:11 ZachPerkitny

If a calendar state without a date selected is valid should you be able to unselect the date as well, or is that something you'd implement yourself?

jacobrask avatar Mar 13 '17 21:03 jacobrask

Hello,

is there any update on this issue?

Regards

krupasavadiya avatar Sep 27 '23 11:09 krupasavadiya