title: Knockout Observable and Time
body: <p>I use Knockout and Typescript on my project and I need to build in the view model three fields that will have the datetime type. Those will need to be updated when a condition is meet.</p>
  
  <p>What I have:</p>
  
  <p>View:</p>
  
  <pre><code>    &lt;div data-bind="if: step1CompleteY"&gt;
      &lt;span data-bind="text: step1CompleteY" /&gt;
      &lt;input type="datetime" data-bind="value: timestampSt1()" /&gt;
  &lt;/div&gt;
  &lt;div data-bind="if: step12Complete"&gt;
      &lt;span data-bind="text: step12Complete" /&gt;
      &lt;input type="datetime" data-bind="value: timestampSt2()" /&gt;
  &lt;/div&gt;
  &lt;div data-bind="if: step23Complete"&gt;
      &lt;span data-bind="text: step23Complete" /&gt;
      &lt;input type="datetime" data-bind="value: timestampSt3()" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>View Model:</p>
  
  <pre><code>myTimestamp = ko.observable(new Date().getDate() + "/" + new Date().getMonth() + "/" + new Date().getFullYear() + " " + new Date().getHours() + ":" + new Date().getMinutes());    
  timestampSt1 = ko.observable(this.myTimestamp);
  timestampSt2 = ko.observable(this.myTimestamp);
  timestampSt3 = ko.observable(this.myTimestamp);
  step1CompleteY = ko.computed({
      read: () =&gt; this.objectChecks.exportValue() === 'Yes' 
  })
  step12Complete = ko.computed({
      read: () =&gt; { return this.objectChecks.exportValue() === 'No' || this.objectChecks.rfqStatusValue() === 'Approved' }
  })
  step23Complete = ko.computed({
      read: () =&gt; { return (this.objectChecks.indemnityValue() === 'Yes' || this.objectChecks.indemnityValue() === 'N/A' || this.objectChecks.rfqStatusValue() === "Denied") }
  })
  </code></pre>
  
  <p>The problem here is, that the date time appear and I don't know how to use "setTimeout" to work with this observables and basically to have that time refreshed only when the conditions are meet.</p>
  
  <p>Any ideas?</p>