FANDOM


  • Hi, I would like to add a function to my wikia where I would input a date and the counter would count the number of days have passed since that date, excluding weekdays. For example, I input the date December 1, 2017, and I want it to output 4, because 4 weekdays have passed since that date.

      Loading editor
    • So, what I think you mean is you want to exclude weekends; correct? Do you want this counter to be interactive, as in, users enter the date in a text field and the answer is displayed? Or, do you want the date to be static, as in, the date is set for each instance of the counter? If the latter, do you need something that is constantly updated (and thus always correct) or would something less accurate suffice? These are all questions you must answer in order to determine the best solution for you.

        Loading editor
    • Something static is what I am going for. For example, the age counter in wiki sites where you just input the date of a person's birthdate and it displays the age of the person currently. I want to be able to just input a specific date, and it will display the number of days since that date, excluding the weekends.

        Loading editor
    • u can use datecalc module

        Loading editor
    • Because I don't know, are Lua modules subject to caching?

        Loading editor
    • as like any other template. actually, it doesn't matter, cuz cache purges daily.

        Loading editor
    • How can I use datecalc module and modify it to do what I want to do? Sorry I'm not very familiar with functions like those.

        Loading editor
    • u don't need to change anything. formula: days passed * 5/7. example for now and 2000.01.01:
      {{#expr:trunc ({{#invoke:datecalc|main|diff|{{CURRENTTIMESTAMP}}|2000/01/01}}*0.714285)}}
      4904

      diff between now and 2017.12.01: 230

      to add module import to ur wiki, create module:datecalc with following line:
      return require("Dev:Datecalc")
        Loading editor
    • Fngplg wrote: as like any other template. actually, it doesn't matter, cuz cache purges daily.

      Not necessarily. I know that there are some pages on the wiki I admin that don't get purged for weeks. But that is an entirely different topic.

        Loading editor
    • Thanks so much for the helpĀ :)

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message