Skip to content

How to change the date? #2

Answered by Richardsl
OmarGoubail asked this question in Q&A
Mar 12, 2022 · 6 comments · 11 replies
Discussion options

You must be logged in to vote

thanks, you could probably use something like the example below, but havent tested it:

dv.span("**Alcohol**")

const calendarData = { 
    year: 2022,
    colors: {   // optional, defaults to green
      orange:      ["#ffa244","#fd7f00","#dd6f00","#bf6000","#9b4e00"],
      pink:        ["#ff96cb","#ff70b8","#ff3a9d","#ee0077","#c30062"]
    },
    entries: [] // populated in the DataviewJS loop below
}

for(let page of dv.pages('"Journal"').where(p=>p.alcohol).sort(p=>p.file.name)){ 

    const date = new Date(page.file.name);
    const yyyy = date.getFullYear();
    let mm = date.getMonth() + 1; // Months start at 0!
    let dd = date.getDate();
    if (dd < 10) dd = '0' + dd;
    if (mm 

Replies: 6 comments 11 replies

Comment options

You must be logged in to vote
1 reply
@raysico
Comment options

Answer selected by Richardsl
Comment options

You must be logged in to vote
3 replies
@wesleyboers
Comment options

@YannikDe
Comment options

@YannikDe
Comment options

Comment options

You must be logged in to vote
2 replies
@dwassem
Comment options

@samhsabin
Comment options

Comment options

You must be logged in to vote
3 replies
@javiavid
Comment options

@mthlvt
Comment options

@GoulartNogueira
Comment options

Comment options

You must be logged in to vote
2 replies
@GoulartNogueira
Comment options

@gpdnjs70754
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet