[SOLVED] Can't show time in table

Found this!!! And it works. Thank you @admin-23 .


Mine modified for sourcing reference fields too

 
    $w('#yourDataset').onReady(() => { 
    $w("#yourDataset").getItems(0, 20) 
  .then( (result) => {
    let items = result.items;
    items.map(item => {

//for regular fields: make the table field tblField = "the ds field name"
if (item.dsField) {
          item.tblField=item.dsField.toLocaleTimeString();
        }
 
 //for referenced fields: make the table field tblField = "the ds field name"."collection field name" that you are using ie: title or another field in the collection"
 if (item.dsField) {
    item.tblField= item.dsField.refField;
    })
    console.log(result.items)
    $w("#yourTable").rows = items; //populates the table
  } )
  .catch( (err) => {
    let errMsg = err.message;
    let errCode = err.code;
  } );
    })


A repeater won’t work for me (unless you know something I don’t). I am using the table to display data that the user can select and edit. Therefore selecting the row is an important feature that I don’t believe you can do in a repeater. All I am looking for is to show either date and time in one cell or date in one cell time in another in the below Table.

My collection currently has a date (date/time) field and a Time (time) field. Neither shows time in the table. Any ideas? Am I missing something obvious? Is there a code formatting solution that will work? I am only aware of at type “Date” in columns (see last photo). Maybe I make the time a string and insert it in a text field called Time?

#tables #date/time #dateField #showTime #formattingTable