@davekato-consulting-com

@davekato-consulting-com

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: DateTime API in React table #104050

    That worked, thank you!
    Dave

    in reply to: DateTime API in React table #104046

    That worked, thank you. My other problem now is the function is not returning the formatted date. Here is my updated code:

    import { Table, Smart } from ‘smart-webcomponents-react/table’;

    const columns = [
    {
    label: ‘First name’,
    dataField: ‘FirstName’,
    dataType: ‘string’
    },
    {
    label: ‘Last Name’,
    dataField: ‘LastName’,
    dataType: ‘string’
    },
    {
    label: ‘Appointment’,
    dataField: ‘Appointment’,
    //dataType: ‘date’,
    formatFunction: function (settings) {
    const formatedDate = new Smart.Utilities.DateTime(settings.value).toString(‘MM/dd/yyyy ‘);
    console.log(formatedDate);
    settings.template = <div>${formatedDate}</div>
    }
    },

    In the table, the date displays as: 2022-12-01T15:10:34.433Z
    In the console it logs properly as: 12/02/2022.

    It should display in the table as 12/02/2022, what am I doing wrong? Do I need to return something from formatFunction? I’m not setting a dataType for the Appointment column.

    The data is coming in from SQL:
    SELECT
    FirstName,
    LastName,
    getdate() AS Appointment
    FROM Person

    in reply to: Errors with calendar “important events” #102773

    I pulled down the latest, it works now.

    Thanks for the quick response!

    Dave Petersen

Viewing 3 posts - 1 through 3 (of 3 total)