NeoDate issues - Forum

Forum Navigation
You need to log in to create posts and topics.

NeoDate issues

Hi..

I have a date field in mySQL database and i use a DateInput object to take the data in a variable and after i use the following

neoDateAsString [InputDate] "YYYY/MM/DD" [OutputDate]

to change the date format from EU to US and save it in database. So far so good.

Also there is the need to edit the date from the database.

Problem 1. If i use a DateObject is not receiving the date, so i gave up with this idea and i use a normal input object.

Now the date is already saved in US format, and i need to change it to EU format before i present it.  So i use:

neoDateCreate [EUDate] "[InputDate]" "YYYY-MM-DD"

neoDateAsString [EUDate] "DD-MM-YYYY" [USDateFormat]

And it seems that is working cause i don't receive any errors.

Problem 2. Now if i edit the date, lets say for example is 20-12-2022 and make it 19-12-2022 and use the

neoDateCreate [USDate] "[InputDate]" "DD-MM-YYYY"

neoDateAsString [USDate] "YYYY-MM-DD" [USDateFormat]

to change the format from EU to US i receive error on neoDateCreate that is not valid date object. From test i made at this point it only accepts date like this [MM-DD-YYYY] which is weird. If i put a date [DD-MM-YYYY] i take error.

ps. I tried the DatePicker and is not working, it presents in screen only a square with month in a different position from where the Date input is.

Any help. ?

@smartmedia I'm a bit lost on your comments. I have checked neoDatePicker right now and it works as expected. Have you checked the Console for any error message? Regarding neoDate plugin, probably @gaev can help better than me.

Regards.

@smartmedia, regarding NeoDatePicker, please check this thread:
https://visualneo.com/forum/topic/neodatepicker-plugin-2

At the end, you will find a completely different plugin probably more appropiate for responsive apps.
Let me know if it works for you.

Hi @luishp

In a new plain neoapp project with 1 button and a text entry the neodatepicker3 shows up. In my project i see only the result in the image.

https://imgur.com/MjXul9C

I don't know if this has something to do with other plugins i use.

I don't know if this has something to do with other plugins i use.

@smartmedia there is probably an error somewhere in your project. Please press F12 when testing your app to open up the Console and check any possible error message.

 

 

@smartmedia

I have a date field in mySQL database and i use a DateInput object to take the data in a variable and after i use the following

neoDateAsString [InputDate] "YYYY/MM/DD" [OutputDate]

to change the date format from EU to US and save it in database. So far so good.

1) neoDateAsString does not work with just any object; only date value objects created with neoDateCreate

2) I am not familiar with the type of date/variable generated from the DateInput object; note that a lack of error messages from neoDate does not always mean that it worked as expected e.g. January 6 in one format can be interpreted as June 1 in another.

3) in order to verify that the neoDate plugin is working as expected, attach this code to a Button ...

neoDateCreate [abcd] "2022/12/19" "YYYY/MM/DD"
neoDateAsString "[abcd]" "YYYY/MM/DD" [testAnswer]
AlertBox "2022/12/19" "output as YYYY/MM/DD = [testAnswer]" ""

... if it gives the expected answer, try ...

SetVar "[inputDateString]" "2022/12/19"
neoDateCreate [abcd] "[inputDateString]" "YYYY/MM/DD"
neoDateAsString "[abcd]" "YYYY/MM/DD" [testAnswer]
AlertBox "[inputDateString]" "output as YYYY/MM/DD = [testAnswer]" ""

... if this works as expected too, then you have to make sure that ...

- the date/variable generated from the DateInput object is a string with the date format you specify in neoDateCreate
- the date string generated by neoDateAsString is of the same date format as that expected by your database (YYYY/MM/DD is NOT the US date format; it might be the format expected by your database)

Now the date is already saved in US format, and i need to change it to EU format before i present it. So i use:

neoDateCreate [EUDate] "[InputDate]" "YYYY-MM-DD"
neoDateAsString [EUDate] "DD-MM-YYYY" [USDateFormat]

And it seems that is working cause i don't receive any errors.

1) YYYY/MM/DD is not the same as YYYY-MM-DD

2) unless you are going to supply a leading zero for months January to September, use M instead of MM (same for D vs. DD)

3) Again, a lack of error messages from neoDate does not always mean that it worked as expected; you should independently verify that the database has the expected value in the right format

i receive error on neoDateCreate that is not valid date object.

neoDateCreate will create an empty date object if the specified one does not exist; however, if a variable with the same name exists, but it is not a neoDate object, you will get this error message.

You will save yourself a lot of time (and frustration) if you ...

a) read the Tutorial to understand how the neoDate plugin works

b) try out each neoDate command using hard coded values first, then do the same with your database commands, finally verify the output from the DateInput widget is compatible with what you are sending to the neoDate plugin.

Vadim has reacted to this post.
Vadim

Hi @luishp

I don't see any errors in console besides the classic

DevTools failed to load source map: Could not load content for http://localhost/css/bootstrap.min.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

I toke from the sample NeoDate app only one button and changed the date into 14-8-2019 in order to take it back as 2019-8-14 and i receive error also in a the plain app, meaning that something wrong with the plugin.

@gaev i need your skills...

Uploaded files:
  • You need to login to have access to uploads.

@smartmedia

I toke from the sample NeoDate app only one button and changed the date into 14-8-2019 in order to take it back as 2019-8-14 and i receive error also in a the plain app, meaning that something wrong with the plugin.

You are right; it looks like the (optional) parameter 'Format of the Input String' for the neoDateCreate  command is being ignored; always expects (US date format) mm-dd-yyyy

When you initialize it with 14-08-2019, it considers it month number of 14 (and accepts it), but then, when you invoke the neoDateAsString command, it reports the error.

In my Tutorial, I did not have an example of month/day greater than 12; when I used 4-08-2019 in your button, it did not report any error, but output it as 8th of April !!!

I will examine the plugin code to see if there was some error in it; otherwise, it could be a bug in the underlying chartjs library.

Vadim and smartmedia have reacted to this post.
Vadimsmartmedia

Update ...

@smartmedia

I checked the neoDate plugin for possible errors; there were none.

The problem is with the dayjs library; it considers the "day, month, year" date formats as "custom formats"; in order to keep the main library as small as possible, these "custom format are relegated to an additional file (that needs to be included). Without this additional file, it ignores these formats and sets the US (month, day, year) format by default.

If you study the Tutorial, you will notice that a number of other formats (e.g. YYYY-MM-DD) work without this extra library file.

I will have to find the size of this extra file, and discuss with @luishp whether it should be added to the base file. Even if it is decided to add this additional file, it will take a while to test and re-publish this plugin.

In the mean time, can you provide cases of date strings (coming from your DateInput widget and values returned by mySQL) that you desire to convert to american format ? ... e.g.

D/M/YY
D/M/YYYY
DD/MM/YY
DD/MM/YYYY

D-M-YY
D-M-YYYY
DD-MM-YY
DD-MM-YYYY

I can then provide a workaround (subroutines) to convert from "custom formats" required by you to one of the date formats that the plugin will accept.

 

Vadim and smartmedia have reacted to this post.
Vadimsmartmedia

Hi @gaev,

Thanks for the time and effort, i was sure that something was going on, i am glad that u have found the error. In the meantime i have used a StringParse to break apart the date and reconstructed again in different order.

ps. Just to have an answer on that, the DateInput Object can receive dates or is used only to choose a date and save the contains on a variable ?