How to use the tubular-common.formatDate function in tubular-common

To help you get started, we’ve selected a few tubular-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github unosquare / tubular-react / sample / src / remoteDataGrid.tsx View on Github external
const bodyRenderer = (row: any, rowIndex: number, gridColumns: ColumnModel[], rowClickProxy: any) => (
    
      {row.OrderID}
      {row.CustomerName}
      
        {formatDate(row.ShippedDate, 'M/d/yyyy h:mm a')}
      
      {row.ShipperCity}
      
        {row.Amount || 0}
      
      
        {row.IsShipped ?  : }
      
    
  );
github unosquare / tubular-react / sample / src / CustomLayoutDataGrid.tsx View on Github external
const CustomTbRow: React.FunctionComponent = ({ row, onRowClick }) => (
  
    {row.OrderID} 
    {row.CustomerName} 
    
      {formatDate(row.ShippedDate, 'M/d/yyyy h:mm a')}
    
    {row.ShipperCity}
    
      {row.Amount || 0}
    
    
      {row.IsShipped ?  : }
    
  
);
github unosquare / tubular-react / sample / src / RemoteGridList.tsx View on Github external
{tbTableInstance.state.data && tbTableInstance.state.data.map((row) => (
                  
                    
                      
                        
                          {row.OrderID} - {row.CustomerName}
                        
                        
                          {row.ShipperCity}
                        
                        
                          {formatDate(row.ShippedDate, 'M/d/yyyy h:mm a')}
                        
                      
                      
                        <button color="primary" size="small">
                          Learn More
                              </button>
                      
                    
                  
                ))}
github unosquare / tubular-react / src / Filtering / DialogInput.tsx View on Github external
const getValue = (dataType: ColumnDataType, operator: CompareOperators, value: string, handleTextFieldChange: any) => {
    switch (dataType) {
        case ColumnDataType.DATE:
            if (value) {
                return formatDate(value, 'yyyy-MM-DD');
            }
            handleTextFieldChange(formatDate(new Date().toISOString(), 'YYYY-MM-DD'));
            return '';
        case ColumnDataType.DATE_TIME:
        case ColumnDataType.DATE_TIME_UTC:
            if (value) {
                return formatDate(value, 'yyyy-MM-DD[T]HH:mm');
            }
            handleTextFieldChange(formatDate(new Date().toISOString(), 'yyyy-MM-DD[T]HH:mm'));
            return '';
        case ColumnDataType.BOOLEAN:
            return operator === CompareOperators.NONE
                ? ''
                : typeof value === 'boolean'
                ? value === true
                    ? 'true'
                    : 'false'
                : value;
        default:
            return operator === CompareOperators.NONE ? '' : value || '';
    }
};
github unosquare / tubular-react / src / Filtering / DialogInput.tsx View on Github external
const getValue = (dataType: ColumnDataType, operator: CompareOperators, value: string, handleTextFieldChange: any) => {
    switch (dataType) {
        case ColumnDataType.DATE:
            if (value) {
                return formatDate(value, 'yyyy-MM-DD');
            }
            handleTextFieldChange(formatDate(new Date().toISOString(), 'YYYY-MM-DD'));
            return '';
        case ColumnDataType.DATE_TIME:
        case ColumnDataType.DATE_TIME_UTC:
            if (value) {
                return formatDate(value, 'yyyy-MM-DD[T]HH:mm');
            }
            handleTextFieldChange(formatDate(new Date().toISOString(), 'yyyy-MM-DD[T]HH:mm'));
            return '';
        case ColumnDataType.BOOLEAN:
            return operator === CompareOperators.NONE
                ? ''
                : typeof value === 'boolean'
                ? value === true
                    ? 'true'
github unosquare / tubular-react / src / Filtering / DialogInput.tsx View on Github external
const getValue = (dataType: ColumnDataType, operator: CompareOperators, value: string, handleTextFieldChange: any) => {
    switch (dataType) {
        case ColumnDataType.DATE:
            if (value) {
                return formatDate(value, 'yyyy-MM-DD');
            }
            handleTextFieldChange(formatDate(new Date().toISOString(), 'YYYY-MM-DD'));
            return '';
        case ColumnDataType.DATE_TIME:
        case ColumnDataType.DATE_TIME_UTC:
            if (value) {
                return formatDate(value, 'yyyy-MM-DD[T]HH:mm');
            }
            handleTextFieldChange(formatDate(new Date().toISOString(), 'yyyy-MM-DD[T]HH:mm'));
            return '';
        case ColumnDataType.BOOLEAN:
            return operator === CompareOperators.NONE
                ? ''
                : typeof value === 'boolean'
                ? value === true
                    ? 'true'
                    : 'false'
                : value;
github unosquare / tubular-react / src / Filtering / DialogInput.tsx View on Github external
const getValue = (dataType: ColumnDataType, operator: CompareOperators, value: string, handleTextFieldChange: any) => {
    switch (dataType) {
        case ColumnDataType.DATE:
            if (value) {
                return formatDate(value, 'yyyy-MM-DD');
            }
            handleTextFieldChange(formatDate(new Date().toISOString(), 'YYYY-MM-DD'));
            return '';
        case ColumnDataType.DATE_TIME:
        case ColumnDataType.DATE_TIME_UTC:
            if (value) {
                return formatDate(value, 'yyyy-MM-DD[T]HH:mm');
            }
            handleTextFieldChange(formatDate(new Date().toISOString(), 'yyyy-MM-DD[T]HH:mm'));
            return '';
        case ColumnDataType.BOOLEAN:
            return operator === CompareOperators.NONE
                ? ''
                : typeof value === 'boolean'
                ? value === true
                    ? 'true'
                    : 'false'
                : value;
        default:
            return operator === CompareOperators.NONE ? '' : value || '';
    }
};
github unosquare / tubular-react / src / utils / renders.tsx View on Github external
export const renderCellContent: any = (column: ColumnModel, row: any) =&gt; {
    switch (column.DataType) {
        case ColumnDataType.NUMERIC:
            return row[column.Name] || 0;
        case ColumnDataType.DATE:
            return formatDate(row[column.Name]);
        case ColumnDataType.DATE_TIME:
        case ColumnDataType.DATE_TIME_UTC:
            return formatDate(row[column.Name], 'M/d/yyyy h:mm a');
        case ColumnDataType.BOOLEAN:
            return row[column.Name] === true ?  : ;
        default:
            return row[column.Name];
    }
};