Convert timefield type of Ext JS to time in DB

Asked

Viewed 33 times

-1

I have the following code:

var finalTime = record.get('attendance_time'); //Recupera valor do attendance_time
record.set('attendance_time',finalTime.toTimeString());

In this code I take the value of a field timefield and I use an ext JS method to convert it to a format that my column in the db of the type time accepted. However, when I put this method(toTimeString) and if it is in the value of the array that previously had the unconverted field, it is Undefined.

I want to know if I’m using the right method and if I am because he’s getting Undefined apos setar.

1 answer

0

I didn’t quite understand your question, but I think in any case you have to put the result of the suggested line code in a variable

var finalTime = record.get('attendance_time'); //Recupera valor do attendance_time
//variavel final_time 
var final_time = record.set('attendance_time',finalTime.toTimeString());
record.data.attendance_time = finalTime; 
record.markDirty();
  • I’ll edit the question to see if I can improve the understanding

  • I edited, check if you can understand please.

  • Before you check the value with toTimeString, you test that the value is no longer undefined? Ouseja finalTime after the first line of code has a value o ja è indefinida?

  • Before converting with toTimeString it has value! When I convert and Seto it from Undefined, it must be something when setting, because it is not setting anything, nor q I put something else to set, I think q the value is being converted, however the problem is at set time.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.