question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Selecting/Unselecting multiple days.

See original GitHub issue

Hey,

Love the calendar! 😃

One issue though. I’m trying to implement it so the user can select certain dates for an event they’re hosting.

Now, selecting dates works great but unselecting seems to be an issue:

https://www.dropbox.com/s/u95gkubrtrmjul0/calendar-issue.mov?dl=0

I’ve made a quick video.

My calendar implementation looks like this:

<Calendar
current={'2017-05-16'}
minDate={'2017-05-10'}
maxDate={'2017-05-29'}
firstDay={1}
selected={ this.state.marked }
onDayPress={ day => this.onSelect( day ) }

this.onSelect() just changes the array. The updating for adding/removing dates works correctly however the calendar is not updating accordingly.

Is this something that should be working?

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
turkle12commented, Oct 2, 2017

@chapeljuice this is a basic version of what I used.

<Calendar firstDay={1} onDayPress={this.onSelectDay} markedDates={this.dates} markingType="interactive" minDate={today} hideExtraDays={true} />

This is the onSelectDay function

`const { booked, dates } = this.state const selectedDate = date.dateString

  if ( dates[selectedDate] ) {
    const newDates = { ...dates }
    delete newDates[selectedDate]
    this.setState( {
      dates: newDates
    } )

  } else {
    const newDates = { ...dates }
    newDates[selectedDate] = [
      {startingDay: true, color: colors.sea, textColor: colors.white},
      {endingDay: true, color: colors.sea, textColor: colors.white},
    ]
    this.setState( {
      dates: newDates
    }  )
  }`
1reaction
turkle12commented, Sep 5, 2017

Sorry to bring this up but I’m trying to implement this functionality but I’m a bit stumped as to how. Could either of you @tautvilas @davidfloegel help out? Thanks

(Let me know if this needs to be a separate issue)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selecting Multiple Days on Your Microsoft Outlook Calendar
In this tutorial we will take a look at how you select or pick multiple days on your Outlook calendar. This is a...
Read more >
Javascript Calendar Multiple date selection Example | Mobiscroll
Javascript calendar with multi-day selection. Maximum number of days, select counter & custom label is supported. Plain JS api for usage everywhere.
Read more >
Outlook calendar on day view, after selecting multiple days ...
Outlook calendar on day view, after selecting multiple days including today, the view wil change to future days. It is Wednesday.
Read more >
How Can I Let the Users Select Multiple Date? - Jotform
You can calculate days between dates; but you can do it with "Date Reservation" widget. To do this,. You need more than one...
Read more >
Selecting Multiple Days - Timesheets MTS Software
Selecting multiple timesheet days is a simple task. Users can either click and drag to select a contiguous number of days on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found