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;
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
add a comment |
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
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
add a comment |
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
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
vue.js vuejs2 vuetify.js
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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>
To add to this, in your code, when you doDate.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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
To add to this, in your code, when you doDate.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
add a comment |
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>
To add to this, in your code, when you doDate.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
add a comment |
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>
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>
edited Mar 24 at 0:57
answered Mar 24 at 0:31
dagaltidagalti
762137
762137
To add to this, in your code, when you doDate.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
add a comment |
To add to this, in your code, when you doDate.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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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