• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Read dates from file and do a compare

Scheduled Pinned Locked Moved Development
12 Posts 2 Posters 3.0k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    BravoOscar @sdetweil
    last edited by Feb 3, 2021, 10:24 PM

    @sdetweil

    I have this now, and this is working.

    for(let type of Object.keys(obj)){
    var date = obj[type];
    console.log(type, date);
    }
    

    This will show the correct type and date.
    But I have something in mind, that look like this:

    if date === currentdate {
    picture=type+"Div"}
    
    ex:  
    20.02.2021 === 20.02.2021 then var piture= "bigDiv"
    

    picture is then displayed.

    but this have to be a loop, because there can be same dates but with different types(pictures)

    Does this gives any meaning? its hard to descripe, but I’m realy glad for all the help I get.

    S 1 Reply Last reply Feb 3, 2021, 10:56 PM Reply Quote 0
    • S Do not disturb
      sdetweil @BravoOscar
      last edited by Feb 3, 2021, 10:56 PM

      @bravooscar as i said u can use the js library moment().format(‘dd.mm.yyyy’) to get today in string to compare

      see the online doc for exact syntax

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      B 1 Reply Last reply Feb 4, 2021, 6:18 AM Reply Quote 0
      • B Offline
        BravoOscar @sdetweil
        last edited by Feb 4, 2021, 6:18 AM

        @sdetweil
        That I know. I allready have the actual date and the date from the array,
        Im unsure of how to get all the dates and all the types from the array, so if there are more of the same dates, then there are more types taht has to be displayed.

        S 1 Reply Last reply Feb 4, 2021, 8:32 AM Reply Quote 0
        • S Do not disturb
          sdetweil @BravoOscar
          last edited by Feb 4, 2021, 8:32 AM

          @bravooscar u are usuing object.keys() to.loop.over the array this only gives u unique entries, house, …

          i would use my loop, which covers every entry.
          i dont understand your file data

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          B 1 Reply Last reply Feb 7, 2021, 3:09 PM Reply Quote 0
          • B Offline
            BravoOscar @sdetweil
            last edited by Feb 7, 2021, 3:09 PM

            @sdetweil

            Thanks for all the help.
            I ended the project because I found a module that allready hat the function that I was looking for.

            You came up with some good information, thx for the help.

            1 Reply Last reply Reply Quote 0
            • 1
            • 2
            • 2 / 2
            2 / 2
            • First post
              12/12
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy