How to use the conseiljs.AttrbuteDataType.DATETIME function in conseiljs

To help you get started, we’ve selected a few conseiljs 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 Cryptonomic / Arronax / src / utils / render.tsx View on Github external
export const formatValueForDisplay = (platform: string, network: string, entity: string, value: any, attribute: AttributeDefinition, onClickPrimaryKey: (entity: string, key: string, value: string | number) => void, aggregation?: ConseilFunction, truncate: boolean = true) => {
      if (value == null || value.length === 0) { return ''; }
      const {dataFormat, dataType} = attribute;
  
      if (!!aggregation) { return formatAggregatedValue(attribute, value, aggregation); }
  
      if (dataType === AttrbuteDataType.BOOLEAN) {
          const svalue = value.toString();
          return svalue.charAt(0).toUpperCase() + svalue.slice(1);
      } else if (dataType === AttrbuteDataType.DATETIME) {
          if (!dataFormat) { return value; }
          return (
            {value}
          )
      } else if (dataType === AttrbuteDataType.ACCOUNT_ADDRESS) {
          const colors = Buffer.from(Buffer.from(value.substring(3, 6) + value.slice(-3), 'utf8').map(b => Math.floor((b - 48) * 255)/74)).toString('hex');
          const address = formatReferenceValue(attribute, (truncate ? truncateHash(value) : value), value, onClickPrimaryKey)
          return (
              
              
              
              {address}
github Cryptonomic / Arronax / src / components / ValueInputItem / index.tsx View on Github external
render () {
    const {
      t,
      attribute,
      value,
      disabled,
      onChange,
      classes
    } = this.props;
    const { stateVal, suggestions } = this.state;

    const isLong = attribute.dataType === AttrbuteDataType.STRING || attribute.dataType === AttrbuteDataType.HASH || attribute.dataType === AttrbuteDataType.ACCOUNT_ADDRESS;
    
    if (attribute.dataType === AttrbuteDataType.DATETIME) {
      const newValue = value? new Date(Number(value)) : '';
      return (
         onChange(String(new Date(val).getTime()))}
        />
      )
    }
    if (attribute.cardinality && attribute.cardinality >= CARDINALITY_NUMBER && attribute.cacheConfig && attribute.cacheConfig.cached) {
      const autosuggestProps = {
github Cryptonomic / Arronax / src / components / CustomTableRow / index.tsx View on Github external
const formatValueForDisplay = (platform: string, network: string, entity: string, value: any, attribute: AttributeDefinition, onClickPrimaryKey: (entity: string, key: string, value: string | number) => void, aggregation?: ConseilFunction) => {
    if (value == null || value.length === 0) { return ''; }
    const {dataFormat, dataType} = attribute;

    if (!!aggregation) { return formatAggregatedValue(attribute, value, aggregation); }

    if (dataType === AttrbuteDataType.BOOLEAN) {
        const svalue = value.toString();
        return svalue.charAt(0).toUpperCase() + svalue.slice(1);
    } else if (dataType === AttrbuteDataType.DATETIME) {
        if (!dataFormat) { return value; }

        return (
            
            {value}
            
        )
    } else if (dataType === AttrbuteDataType.ACCOUNT_ADDRESS) {
        const colors = Buffer.from(Buffer.from(value.substring(3, 6) + value.slice(-3), 'utf8').map(b => Math.floor((b - 48) * 255)/74)).toString('hex');

        return (
            
            
            
            {formatReferenceValue(attribute, truncateHash(value), value, onClickPrimaryKey)}