<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Hide a field if it is not updated during last day]]></title><description><![CDATA[<p dir="auto">Hy,<br />
in my application I've the following report:</p>
<p dir="auto"><img src="https://camo.nodebb.org/99b2fbfc1e9f067f33b9ee1c3a338a8611f790bb?url=https%3A%2F%2Fi.imgur.com%2FXz0Wpme.png" alt="0_1571655556183_826601f0-d422-40c2-97c8-3d1a6c3f1038c-immagine.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">the latest column shows the latest datetime ok the corresponding TRK. Maybe for some reason like in the figure, the latest timestamp is really old so I don't want to show that row, for example I want to see only the rows updated during last day.</p>
<p dir="auto">Maybe a way to achieve this is:</p>
<pre><code>&lt;ma-now update-interval="1 minutes" output="theTimeNow"&gt;&lt;/ma-now&gt;
..
      &lt;ng-if="!TRK_0_1_automa_state.time.isBefore(theTimeNow | maMoment:'subtract':24:'hours'")&gt;
        &lt;h5&gt;{{TRK_0_1_automa_state.time | date:'yyyy-MM-dd  HH:mm:ss'}}&lt;/h5&gt;
      &lt;/ng-if&gt;
..
      &lt;ng-if="!TRK_1_1_automa_state.time.isBefore(theTimeNow | maMoment:'subtract':24:'hours'")&gt;
        &lt;h5&gt;{{TRK_1_1_automa_state.time | date:'yyyy-MM-dd  HH:mm:ss'}}&lt;/h5&gt;
      &lt;/ng-if&gt;

</code></pre>
<p dir="auto">but the code seems to be always true, so it is not ok because both automa_state.time are showed.</p>
<p dir="auto">Any idea about where is the problem?<br />
Thanks,<br />
Antonio</p>
]]></description><link>https://forum.mango-os.com/topic/4526/hide-a-field-if-it-is-not-updated-during-last-day</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 01:08:25 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/4526.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 21 Oct 2019 14:12:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hide a field if it is not updated during last day on Tue, 29 Oct 2019 07:03:05 GMT]]></title><description><![CDATA[<p dir="auto">at the end of all the simplest working solution for me seems to be</p>
<pre><code>&lt;ma-now update-interval="1 minutes" output="theTimeNow"&gt;&lt;/ma-now&gt;
&lt;ma-calc input="theTimeNow | moment:'subtract':24:'hours'" output="theTimeADayAgo"&gt;&lt;/ma-calc&gt;
</code></pre>
<p dir="auto">and then:</p>
<pre><code>&lt;md-grid-list
      md-cols="11"
      md-gutter="0px"
      md-row-height="35px" ng-if="theTimeADayAgo.isBefore(TRK_0_1_automa_state.time)"&gt;
</code></pre>
]]></description><link>https://forum.mango-os.com/post/23933</link><guid isPermaLink="true">https://forum.mango-os.com/post/23933</guid><dc:creator><![CDATA[etantonio]]></dc:creator><pubDate>Tue, 29 Oct 2019 07:03:05 GMT</pubDate></item><item><title><![CDATA[Reply to Hide a field if it is not updated during last day on Wed, 23 Oct 2019 15:15:45 GMT]]></title><description><![CDATA[<p dir="auto"><code>moment</code> is not a valid filter name, it is <code>maMoment</code> as per your first post. You could also just call the function directly instead of using the filter -</p>
<pre><code>theTimeADayAgo.format('D MMM YYYY - HH:mm')
</code></pre>
]]></description><link>https://forum.mango-os.com/post/23898</link><guid isPermaLink="true">https://forum.mango-os.com/post/23898</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Wed, 23 Oct 2019 15:15:45 GMT</pubDate></item><item><title><![CDATA[Reply to Hide a field if it is not updated during last day on Wed, 23 Oct 2019 12:46:30 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Jared,<br />
in any case, using the following code:</p>
<pre><code>    &lt;ma-now update-interval="1 minutes" output="theTimeNow" on-change="theTimeADayAgo = $value.clone().subtract(24, 'hours')"&gt;&lt;/ma-now&gt;
    &lt;md-grid-tile class="dark-gray"&gt;
        &lt;h5&gt;{{theTimeADayAgo|moment:'format':'D MMM YYYY - HH:mm'}}&lt;/h5&gt;
    &lt;/md-grid-tile&gt;
 	  &lt;md-grid-tile class="dark-gray"&gt;
      &lt;h5&gt;{{theTimeNow|moment:'format':'D MMM YYYY - HH:mm'}}&lt;/h5&gt;
    &lt;/md-grid-tile&gt;
</code></pre>
<p dir="auto">I've this result:</p>
<p dir="auto"><img src="https://camo.nodebb.org/b1d3de7d71d8b0bfb0ce99d8f62d53708a8baefd?url=https%3A%2F%2Fi.imgur.com%2FxlBJiOp.png" alt="0_1571835141023_b41eaf9f-3ab0-493c-bfcd-d5ad9278a0c8-immagine.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">and in fact the row filtering based on datetime seems to be not working.</p>
]]></description><link>https://forum.mango-os.com/post/23894</link><guid isPermaLink="true">https://forum.mango-os.com/post/23894</guid><dc:creator><![CDATA[etantonio]]></dc:creator><pubDate>Wed, 23 Oct 2019 12:46:30 GMT</pubDate></item><item><title><![CDATA[Reply to Hide a field if it is not updated during last day on Tue, 22 Oct 2019 15:10:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/etantonio" aria-label="Profile: etantonio">@<bdi>etantonio</bdi></a></p>
<p dir="auto">The problem is that <code>TRK_0_1_automa_state.time</code> is not a moment.js object and you cannot use <code>.isBefore()</code> on it. It is an epoch timestamp (i.e. a number, specifically of seconds since 1980).</p>
<p dir="auto">I would suggest using this</p>
<pre><code>&lt;ma-now update-interval="1 minutes" output="theTimeNow" on-change="theTimeADayAgo = $value.clone().subtract(24, 'hours')"&gt;&lt;/ma-now&gt;
</code></pre>
<p dir="auto">Then</p>
<pre><code>&lt;div ng-if="theTimeADayAgo.isBefore(TRK_0_1_automa_state.time)"&gt;
</code></pre>
]]></description><link>https://forum.mango-os.com/post/23885</link><guid isPermaLink="true">https://forum.mango-os.com/post/23885</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Tue, 22 Oct 2019 15:10:01 GMT</pubDate></item></channel></rss>