react-native-datepicker icon indicating copy to clipboard operation
react-native-datepicker copied to clipboard

null dates

Open amanthegreatone opened this issue 9 years ago • 8 comments

Hi,

In my app I have a null date to begin with and then the user can choose a date from the picker. When I use the below code I am getting the current datetime but I want it to be blank. How can I achieve this?

date={taskTime ? moment.tz(taskTime, businessTimeZone).format("DD-MMM-YYYY, h:mm A") : null}
mode="datetime"
format="DD-MMM-YYYY, h:mm A"

If I use this code I get Invalid Date being displayed which again is not what I want. date={moment.tz(taskTime, businessTimeZone).format("DD-MMM-YYYY, h:mm A")}

amanthegreatone avatar Mar 23 '17 10:03 amanthegreatone

I also need this too.

I want the user to enter their birthdate, but by default it should be blank. Also it should be possible for the user to clear the input.

ceefour avatar Dec 04 '17 11:12 ceefour

I too need this

thegourav avatar Apr 03 '18 17:04 thegourav

let date = this.props.date; if (date === 'Invalid date') { date = ''; }

Works?

mike-niemand avatar Apr 04 '18 07:04 mike-niemand

@mike-niemand No its not working. Any other solution ?

anil1712 avatar May 23 '18 11:05 anil1712

add placeholder=" "

tong233 avatar Jun 05 '18 02:06 tong233

placeholder="" does not work placeholder=" " works

tyasink avatar Jul 07 '19 15:07 tyasink

This is not working at all for me. If the date is falsey at all, it shows the current date instead of the placeholder. I've tried placeholder="", placeholder=" ", placeholder="Select a Date", date={null}, date={''}.

Can you please fix this? It should simply show the placeholder of the date value is falsey.

zlanich avatar Jan 12 '20 19:01 zlanich

This could be a nice feature.

Now I'm using this approach, but is kinda "ugly"

https://stackoverflow.com/questions/60926646/how-to-set-null-for-datetimepicker

jspasiuk avatar Aug 25 '21 14:08 jspasiuk