title: How to create new date from offset in Vega?
body: <p>I want to create a new date field using a field containing seconds and a field using time. </p>
  
  <p>I've tried adding an additional field
  <code>{calculate: "toDate(datum._source['TimeStamp']-datum._source['Metric'])", as: "time2"}</code></p>
  
  <p>I'd like to plot Y against time as blue points and Y against time2 as red points. When I include the time2 expression and plot against it the graph comes back empty without error. I know I need to do something involving converting either the Date or Metric that can be subtracted.</p>
  
  <p>Ex: "TimeStamp": July 1st 2019, 09:16:44.000
      "Metric": 0.3 &lt;-seconds</p>
  
  <pre><code>  $schema: https://vega.github.io/schema/vega-lite/v2.json
    data: {
      url: {
        %context%: true
        %timefield%: TimeStamp
        index: a.index*
        body: {
          size: 10000
          _source: ["@timestamp", "TimeStamp", "Metric", "TxnType","Y"]
        }
      }
      format: {property: "hits.hits"}
    }
    transform: [
      {calculate: "toDate(datum._source['TimeStamp'])", as: "time"},
      {"filter": "datum._source['Y'] &gt; 0"},
      {"filter": "datum._source['TxnType'] == 'Type'"}
  
    ]
  
    mark: circle
    encoding: {
      x: {field: "time", type: "temporal",
      }
      y: {field: "_source.Y", type: "quantitative", "scale": {"type": "log"}}
    }
  }```
  </code></pre>