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.

Wrong value returned from picker

See original GitHub issue

Bug

Time picker returns today’s date instead of given date.

In datetimepicker.android.js 53rd line should be const date = new Date(value); instead of const date = new Date();

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:10

github_iconTop GitHub Comments

2reactions
NonameLTUscommented, Jan 28, 2020

Seeing the same issue. Thanks for finding the fix! Guess I’ll shim it in until the package gets updated

If you don’t want to edit package files, there’s a fix (you need to use moment package):

`onChange = (event, date) => { const { type } = event;

const chosenDate = moment(date).toObject();
const currentDate = moment(yourCurrentDateHere).toObject();

let newDate;

if ("set" === type) {
    if ("date" === mode) {
        newDate = moment({
            ...currentDate,
            years: chosenDate.years,
            months: chosenDate.months,
            date: chosenDate.date
        });
    }

    if ("time" === mode) {
        newDate = moment({
            ...currentDate,
            hours: chosenDate.hours,
            minutes: chosenDate.minutes,
            seconds: chosenDate.seconds,
            miliseconds: chosenDate.miliseconds
        });
    }
}

};`

1reaction
A4TIFcommented, Mar 20, 2020

This issue has not been fixed still. Using the latest v 2.3.0, On setting time, the date still changes to the current date.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrong value returned from picker · Issue #94 - GitHub
Time picker returns today's date instead of given date. In datetimepicker.android.js 53rd line should be const date = new Date(value); instead ...
Read more >
MaterialDatePicker returning wrong value - Stack Overflow
The problem is that the result obtained is slightly wrong, example: If the user selects the date 10/05/1998 (1st of October 1998), the...
Read more >
BDC field returns wrong value in the Value Picker - TechNet - Microsoft
I have a BDC entity in an application with multiple functioning entities but one of the entities is not behaving. it returns a...
Read more >
List Picker returns wrong return value - SAP Community
Hi, I have created a simple an online app with a Create Order page using the "Form Cell Page" template with a List...
Read more >
Date picker returns value in wrong field — oracle-tech
Hello everybody, I am using a date picker in select statement to display it in a report. The syntax I am using is...
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