219
Views
10
Comments
Solved
Time input with seconds
Question
Application Type
Reactive

Hello,

I have an input of datatype Time, however it only allows editing hours and minutes. How can I edit hours, minutes and seconds? Thank you!

2023-10-21 19-42-11
Tousif Khan
Champion
Solution

Hello

You just have to add step =1 to your input attribute

I am attaching a sample for you with the use case

https://personal-ejuytnht.outsystemscloud.com/SampleForumPOCS/TimePicker?_ts=638153115224041328

Best Regards

Tousif Khan

SampleTime Sample.oml
UserImage.jpg
Cute Bear

Hello,

Thank you. However, this is not working quite well.

I have a table with a DateTime in one column, e.g. 10:32:16, that comes from DB.

Next to it, I want an input to edit this DateTime value. I added step 1 in the input, but now it shows 10:32:00 in the input instead of 10:32:16. The seconds seem to always show up as 00...

2023-10-21 19-42-11
Tousif Khan
Champion

May I know what is the data type of your date time col linked attribute?

UserImage.jpg
Cute Bear

Sure, the datatype of the attribute is DateTime.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Cute Bear,

please share a sample OML with what exactly you are doing.  Are you sure you don't have some FormatDateTime somewhere messing things up for you ?

UserImage.jpg
Cute Bear

Sure, there it is. 

In the mainscreen:

In the edit screen:

Tests.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Aaah,

Ok, I see.  So it is possible to enter seconds, they are also correctly saved to database and retrieved from database, but when using that existing value in an input widget, the seconds get lost.

I think this is a bug in Outsystems core javascript code, they just don't cater for the seconds part of a datatime in an input.

Possible workaround is to set the value yourself with javascript after retrieving it from the database.  The value is correctly coming back from the aggregate, and shows correctly if you would put on your screen in an expression, it is just the part that initializes an initial value for the input that goes wrong.

See attached your demo altered to show that if you amend it yourself, you can get the correct value into the input.

None of this is very nice,and you should definitely test thouroughly if you are going this route.

Dorine

TestsUpdated.oml
UserImage.jpg
Cute Bear

Hello Dorine,

Thank you very much for your help, this works!
Also, do you know if there any way that this could be reported to OutSystems?

2021-09-06 15-09-53
Dorine Boudry
 
MVP
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Aaah,

Ok, I see.  So it is possible to enter seconds, they are also correctly saved to database and retrieved from database, but when using that existing value in an input widget, the seconds get lost.

I think this is a bug in Outsystems core javascript code, they just don't cater for the seconds part of a datatime in an input.

Possible workaround is to set the value yourself with javascript after retrieving it from the database.  The value is correctly coming back from the aggregate, and shows correctly if you would put on your screen in an expression, it is just the part that initializes an initial value for the input that goes wrong.

See attached your demo altered to show that if you amend it yourself, you can get the correct value into the input.

None of this is very nice,and you should definitely test thouroughly if you are going this route.

Dorine

TestsUpdated.oml
2023-10-21 19-42-11
Tousif Khan
Champion
Solution

Hello

You just have to add step =1 to your input attribute

I am attaching a sample for you with the use case

https://personal-ejuytnht.outsystemscloud.com/SampleForumPOCS/TimePicker?_ts=638153115224041328

Best Regards

Tousif Khan

SampleTime Sample.oml
UserImage.jpg
Cute Bear

Hello,

Thank you. However, this is not working quite well.

I have a table with a DateTime in one column, e.g. 10:32:16, that comes from DB.

Next to it, I want an input to edit this DateTime value. I added step 1 in the input, but now it shows 10:32:00 in the input instead of 10:32:16. The seconds seem to always show up as 00...

2023-10-21 19-42-11
Tousif Khan
Champion

May I know what is the data type of your date time col linked attribute?

UserImage.jpg
Cute Bear

Sure, the datatype of the attribute is DateTime.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Cute Bear,

please share a sample OML with what exactly you are doing.  Are you sure you don't have some FormatDateTime somewhere messing things up for you ?

UserImage.jpg
Cute Bear

Sure, there it is. 

In the mainscreen:

In the edit screen:

Tests.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Aaah,

Ok, I see.  So it is possible to enter seconds, they are also correctly saved to database and retrieved from database, but when using that existing value in an input widget, the seconds get lost.

I think this is a bug in Outsystems core javascript code, they just don't cater for the seconds part of a datatime in an input.

Possible workaround is to set the value yourself with javascript after retrieving it from the database.  The value is correctly coming back from the aggregate, and shows correctly if you would put on your screen in an expression, it is just the part that initializes an initial value for the input that goes wrong.

See attached your demo altered to show that if you amend it yourself, you can get the correct value into the input.

None of this is very nice,and you should definitely test thouroughly if you are going this route.

Dorine

TestsUpdated.oml
UserImage.jpg
Cute Bear

Hello Dorine,

Thank you very much for your help, this works!
Also, do you know if there any way that this could be reported to OutSystems?

2021-09-06 15-09-53
Dorine Boudry
 
MVP
2024-09-12 02-43-38
Deepsagar Dubey

Hi @Cute Bear 

As @Tousif Khan said you can just  add step="1" in the attribute then it'll show Seconds as well.s - 


additionally for more operations or attributes on input type time you can refer this tutorial -

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time

Thanks

Deep

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.