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

Issue with local timezone display #1720

Closed
srijakumar opened this issue Aug 5, 2020 · 2 comments
Closed

Issue with local timezone display #1720

srijakumar opened this issue Aug 5, 2020 · 2 comments

Comments

@srijakumar
Copy link

Similar to the closeed issue - "Timezone support #118Issue " the react big calendar when displayed shows a day back due to local time conversion. I have tried the solutions mentioned in #118 but didnt work for me. Any recommendations? Thanks!

`import React from 'react'
import {connect} from 'react-redux'
import {deleteNote} from '../actions/deleteNote'

import { Calendar, momentLocalizer, Views } from 'react-big-calendar';
import moment from 'moment';
import moment_timezone from 'moment-timezone';
import 'react-big-calendar/lib/css/react-big-calendar.css';

const localizer = momentLocalizer(moment)

const Notes = (props) => {
console.log("this is props in Notes.js", props)
const handleDelete = (note) => {
props.deleteNote(note.id, note.tracker_id)
}
const updateEvents = (notes) => {
debugger
let notesArray = []
notes.map(noteEditted => {
let note = {
title: "X",
start: noteEditted.date,
end: noteEditted.date
}
notesArray.push(note)
})
console.log("This is notesArray", notesArray)
return notesArray
}
return (


{props.notes && props.notes.map(note =>
  • {note.content} - {note.date} <button className="Button" onClick={() => handleDelete(note)}>Delete

  • )}






    )
    }
    export default connect(null,{deleteNote})(Notes)`

    @srijakumar
    Copy link
    Author

    This is my return statement - it seems to be formatted weird above due to the li and br tags

    return (


    {props.notes && props.notes.map(note =>
  • {note.content} - {note.date} <button className="Button" onClick={() => handleDelete(note)}>Delete

  • )}

      <div className="app-side-bar">
        <Calendar
          selectable
          localizer={localizer}
          events={updateEvents(props.notes)}
          defaultDate={moment().toDate()}
         />
      </div>
    </div>
    

    )

    @cutterbl
    Copy link
    Collaborator

    See our documentation on Dealing with Timezones

    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

    2 participants