v-if using table row field and date rangeVuetify Data table with expandable rows getting collapse when text inputtedvuefity translate v-text-field labelHow to validate Vuetify text field asynchronously?styling each row in a data tableHow to delete Specific row in a datatable?How to add an additional field to Vuetify date picker?VueJs Filtering Between Dates in tableDeleting the selected row on data table VuetifyVuetify Datatable Actions Row

Why is unzipped directory exactly 4.0k (much smaller than zipped file)?

Navigating a quick return to previous employer

Variable declaraton with extra in C

Would Buddhists help non-Buddhists continuing their attachments?

Why is 'additive' EQ more difficult to use than 'subtractive'?

Are cells guaranteed to get at least one mitochondrion when they divide?

Can we assume that a hash function with high collision resistance also means highly uniform distribution?

What weight should be given to writers groups critiques?

Is my plasma cannon concept viable?

How to keep consistency across the application architecture as a team grows?

Sorting with IComparable design

Heat lost in ideal capacitor charging

Removing the last element of a list

“For nothing” = “pour rien”?

3 prong range outlet

Why was this character made Grand Maester?

How to respond to an e-mail asking me to suggest a doctoral research topic?

Why do Russians almost not use verbs of possession akin to "have"?

How would a developer who mostly fixed bugs for years at a company call out their contributions in their CV?

Why does FOO=bar; export the variable into my environment

Can a UK national work as a paid shop assistant in the USA?

How can I properly write this equation in Latex?

Is superuser the same as root?

How to melt snow without fire or using body heat?



v-if using table row field and date range


Vuetify Data table with expandable rows getting collapse when text inputtedvuefity translate v-text-field labelHow to validate Vuetify text field asynchronously?styling each row in a data tableHow to delete Specific row in a datatable?How to add an additional field to Vuetify date picker?VueJs Filtering Between Dates in tableDeleting the selected row on data table VuetifyVuetify Datatable Actions Row






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to highlight a <td> based on that field's date range from today's date.



I've been trying to use current <td> date value less than Date.now() - #(number of days) to determine whether to highlight the <td> (green, yellow, or red) but not having any success with how I'm doing so.



<td v-if="props.item.date < Date.now() - 2">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="props.item.date < Date.now() - 7">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>


I'd like to think I'm close to the solution but I may not be doing it the appropriate way. Any help would be greatly appreciated.



UPDATE 2



<td v-if="Date.parse(props.item.date) > Date.now()">
<v-icon small class="greenDate">fiber_manual_record</v-icon> props.item.date_sent
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now()">
<v-icon small class="yellowDate">fiber_manual_record</v-icon> props.item.date_sent
</td>
<td v-else">
<v-icon small class="redDate">fiber_manual_record</v-icon> props.item.date_sent
</td>


Tried this just to test and see if anything is even recognized the conditions and it doesnt seem like it. Always hits the last condition (red). Maybe its not like props.item.date formatted mm/dd/yyyy. I also realized my conditions in the original example would conflict since I have both a less than 2 days and 7 days, but no condition for also greater than 2 days under 7 days condition










share|improve this question
























  • whats the format of props.item.date ???

    – dagalti
    Mar 24 at 0:25











  • Date Format -> mm/dd/yyyy

    – Zeus
    Mar 24 at 0:34











  • Updated the answer. Check that and let me know the result.

    – dagalti
    Mar 24 at 0:57











  • Added update edit above

    – Zeus
    Mar 24 at 1:36

















0















I'm trying to highlight a <td> based on that field's date range from today's date.



I've been trying to use current <td> date value less than Date.now() - #(number of days) to determine whether to highlight the <td> (green, yellow, or red) but not having any success with how I'm doing so.



<td v-if="props.item.date < Date.now() - 2">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="props.item.date < Date.now() - 7">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>


I'd like to think I'm close to the solution but I may not be doing it the appropriate way. Any help would be greatly appreciated.



UPDATE 2



<td v-if="Date.parse(props.item.date) > Date.now()">
<v-icon small class="greenDate">fiber_manual_record</v-icon> props.item.date_sent
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now()">
<v-icon small class="yellowDate">fiber_manual_record</v-icon> props.item.date_sent
</td>
<td v-else">
<v-icon small class="redDate">fiber_manual_record</v-icon> props.item.date_sent
</td>


Tried this just to test and see if anything is even recognized the conditions and it doesnt seem like it. Always hits the last condition (red). Maybe its not like props.item.date formatted mm/dd/yyyy. I also realized my conditions in the original example would conflict since I have both a less than 2 days and 7 days, but no condition for also greater than 2 days under 7 days condition










share|improve this question
























  • whats the format of props.item.date ???

    – dagalti
    Mar 24 at 0:25











  • Date Format -> mm/dd/yyyy

    – Zeus
    Mar 24 at 0:34











  • Updated the answer. Check that and let me know the result.

    – dagalti
    Mar 24 at 0:57











  • Added update edit above

    – Zeus
    Mar 24 at 1:36













0












0








0








I'm trying to highlight a <td> based on that field's date range from today's date.



I've been trying to use current <td> date value less than Date.now() - #(number of days) to determine whether to highlight the <td> (green, yellow, or red) but not having any success with how I'm doing so.



<td v-if="props.item.date < Date.now() - 2">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="props.item.date < Date.now() - 7">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>


I'd like to think I'm close to the solution but I may not be doing it the appropriate way. Any help would be greatly appreciated.



UPDATE 2



<td v-if="Date.parse(props.item.date) > Date.now()">
<v-icon small class="greenDate">fiber_manual_record</v-icon> props.item.date_sent
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now()">
<v-icon small class="yellowDate">fiber_manual_record</v-icon> props.item.date_sent
</td>
<td v-else">
<v-icon small class="redDate">fiber_manual_record</v-icon> props.item.date_sent
</td>


Tried this just to test and see if anything is even recognized the conditions and it doesnt seem like it. Always hits the last condition (red). Maybe its not like props.item.date formatted mm/dd/yyyy. I also realized my conditions in the original example would conflict since I have both a less than 2 days and 7 days, but no condition for also greater than 2 days under 7 days condition










share|improve this question
















I'm trying to highlight a <td> based on that field's date range from today's date.



I've been trying to use current <td> date value less than Date.now() - #(number of days) to determine whether to highlight the <td> (green, yellow, or red) but not having any success with how I'm doing so.



<td v-if="props.item.date < Date.now() - 2">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="props.item.date < Date.now() - 7">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>


I'd like to think I'm close to the solution but I may not be doing it the appropriate way. Any help would be greatly appreciated.



UPDATE 2



<td v-if="Date.parse(props.item.date) > Date.now()">
<v-icon small class="greenDate">fiber_manual_record</v-icon> props.item.date_sent
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now()">
<v-icon small class="yellowDate">fiber_manual_record</v-icon> props.item.date_sent
</td>
<td v-else">
<v-icon small class="redDate">fiber_manual_record</v-icon> props.item.date_sent
</td>


Tried this just to test and see if anything is even recognized the conditions and it doesnt seem like it. Always hits the last condition (red). Maybe its not like props.item.date formatted mm/dd/yyyy. I also realized my conditions in the original example would conflict since I have both a less than 2 days and 7 days, but no condition for also greater than 2 days under 7 days condition







vue.js vuejs2 vuetify.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 1:36







Zeus

















asked Mar 23 at 23:29









ZeusZeus

348




348












  • whats the format of props.item.date ???

    – dagalti
    Mar 24 at 0:25











  • Date Format -> mm/dd/yyyy

    – Zeus
    Mar 24 at 0:34











  • Updated the answer. Check that and let me know the result.

    – dagalti
    Mar 24 at 0:57











  • Added update edit above

    – Zeus
    Mar 24 at 1:36

















  • whats the format of props.item.date ???

    – dagalti
    Mar 24 at 0:25











  • Date Format -> mm/dd/yyyy

    – Zeus
    Mar 24 at 0:34











  • Updated the answer. Check that and let me know the result.

    – dagalti
    Mar 24 at 0:57











  • Added update edit above

    – Zeus
    Mar 24 at 1:36
















whats the format of props.item.date ???

– dagalti
Mar 24 at 0:25





whats the format of props.item.date ???

– dagalti
Mar 24 at 0:25













Date Format -> mm/dd/yyyy

– Zeus
Mar 24 at 0:34





Date Format -> mm/dd/yyyy

– Zeus
Mar 24 at 0:34













Updated the answer. Check that and let me know the result.

– dagalti
Mar 24 at 0:57





Updated the answer. Check that and let me know the result.

– dagalti
Mar 24 at 0:57













Added update edit above

– Zeus
Mar 24 at 1:36





Added update edit above

– Zeus
Mar 24 at 1:36












1 Answer
1






active

oldest

votes


















2














The Date.now() method returns the number of milliseconds



So if you want to reduce somedays. you have to covert days to milliseconds and then minus. 1 day = 1000 * 60 * 60 * 24 * 1 milliseconds



The Date.parse() method parses a string representation of a date, and returns the number of milliseconds



Convert props.item.date to milliseconds using Date.parse



for example change code like below



<td v-if="Date.parse(props.item.date) < Date.now() - (2 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now() - (7 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>





share|improve this answer

























  • To add to this, in your code, when you do Date.now() - 7 you're saying "older than 7 milliseconds ago", which, frankly, isn't that old.

    – J.Ko
    Mar 24 at 1:00











  • Yea I figured I was off in that calculation

    – Zeus
    Mar 24 at 1:36











  • I figured it out, it was just how my date was being converted, so the comparison wasn't working. Thanks all

    – Zeus
    Mar 24 at 17:06











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319332%2fv-if-using-table-row-field-and-date-range%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














The Date.now() method returns the number of milliseconds



So if you want to reduce somedays. you have to covert days to milliseconds and then minus. 1 day = 1000 * 60 * 60 * 24 * 1 milliseconds



The Date.parse() method parses a string representation of a date, and returns the number of milliseconds



Convert props.item.date to milliseconds using Date.parse



for example change code like below



<td v-if="Date.parse(props.item.date) < Date.now() - (2 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now() - (7 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>





share|improve this answer

























  • To add to this, in your code, when you do Date.now() - 7 you're saying "older than 7 milliseconds ago", which, frankly, isn't that old.

    – J.Ko
    Mar 24 at 1:00











  • Yea I figured I was off in that calculation

    – Zeus
    Mar 24 at 1:36











  • I figured it out, it was just how my date was being converted, so the comparison wasn't working. Thanks all

    – Zeus
    Mar 24 at 17:06















2














The Date.now() method returns the number of milliseconds



So if you want to reduce somedays. you have to covert days to milliseconds and then minus. 1 day = 1000 * 60 * 60 * 24 * 1 milliseconds



The Date.parse() method parses a string representation of a date, and returns the number of milliseconds



Convert props.item.date to milliseconds using Date.parse



for example change code like below



<td v-if="Date.parse(props.item.date) < Date.now() - (2 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now() - (7 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>





share|improve this answer

























  • To add to this, in your code, when you do Date.now() - 7 you're saying "older than 7 milliseconds ago", which, frankly, isn't that old.

    – J.Ko
    Mar 24 at 1:00











  • Yea I figured I was off in that calculation

    – Zeus
    Mar 24 at 1:36











  • I figured it out, it was just how my date was being converted, so the comparison wasn't working. Thanks all

    – Zeus
    Mar 24 at 17:06













2












2








2







The Date.now() method returns the number of milliseconds



So if you want to reduce somedays. you have to covert days to milliseconds and then minus. 1 day = 1000 * 60 * 60 * 24 * 1 milliseconds



The Date.parse() method parses a string representation of a date, and returns the number of milliseconds



Convert props.item.date to milliseconds using Date.parse



for example change code like below



<td v-if="Date.parse(props.item.date) < Date.now() - (2 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now() - (7 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>





share|improve this answer















The Date.now() method returns the number of milliseconds



So if you want to reduce somedays. you have to covert days to milliseconds and then minus. 1 day = 1000 * 60 * 60 * 24 * 1 milliseconds



The Date.parse() method parses a string representation of a date, and returns the number of milliseconds



Convert props.item.date to milliseconds using Date.parse



for example change code like below



<td v-if="Date.parse(props.item.date) < Date.now() - (2 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:green;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else-if="Date.parse(props.item.date) < Date.now() - (7 * 1000 * 60 * 60 * 24)">
<v-icon small style="color:yellow;">fiber_manual_record</v-icon> props.item.date
</td>
<td v-else>
<v-icon small style="color:red;">fiber_manual_record</v-icon> props.item.date
</td>






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 24 at 0:57

























answered Mar 24 at 0:31









dagaltidagalti

762137




762137












  • To add to this, in your code, when you do Date.now() - 7 you're saying "older than 7 milliseconds ago", which, frankly, isn't that old.

    – J.Ko
    Mar 24 at 1:00











  • Yea I figured I was off in that calculation

    – Zeus
    Mar 24 at 1:36











  • I figured it out, it was just how my date was being converted, so the comparison wasn't working. Thanks all

    – Zeus
    Mar 24 at 17:06

















  • To add to this, in your code, when you do Date.now() - 7 you're saying "older than 7 milliseconds ago", which, frankly, isn't that old.

    – J.Ko
    Mar 24 at 1:00











  • Yea I figured I was off in that calculation

    – Zeus
    Mar 24 at 1:36











  • I figured it out, it was just how my date was being converted, so the comparison wasn't working. Thanks all

    – Zeus
    Mar 24 at 17:06
















To add to this, in your code, when you do Date.now() - 7 you're saying "older than 7 milliseconds ago", which, frankly, isn't that old.

– J.Ko
Mar 24 at 1:00





To add to this, in your code, when you do Date.now() - 7 you're saying "older than 7 milliseconds ago", which, frankly, isn't that old.

– J.Ko
Mar 24 at 1:00













Yea I figured I was off in that calculation

– Zeus
Mar 24 at 1:36





Yea I figured I was off in that calculation

– Zeus
Mar 24 at 1:36













I figured it out, it was just how my date was being converted, so the comparison wasn't working. Thanks all

– Zeus
Mar 24 at 17:06





I figured it out, it was just how my date was being converted, so the comparison wasn't working. Thanks all

– Zeus
Mar 24 at 17:06



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319332%2fv-if-using-table-row-field-and-date-range%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?