Check here, it explains it quite well:
This is a countdown days to christmas day (25th december for those not sure) for leap years and non leap years:
$#DISLEAPYEAR#=false?(359-#DD#):(360-#DD#)$
Using the day in year tag and leap year tag are the key.
Does that give you days till the next on the 26th ?
Between 26th and 31st dec it will display negative days that have past 25th from -1 to -6. Then on 1st Jan it will again calculate number of days to 25th dec.
But if that is not desired, just hide the field if result < 0 etc.
Canât have it all!
The Candy Cane formula stars counting on the 26th . This will work for any anniversary you care to find the day number of . Have a look it is a fabulous bit of maths .Well it is to me . Not my work . It was left somewhere on the Community as a gift . I had to tweak it as the Syntax Mods broke it but I have no memory of what I had to do . That is the problem with my Brain . Soon as the job is done I forget straight away . Just copy and Paste .
If with everything you do, explain and guide your brain there is a problem now Iâm worried about mineâŠlaughs
Se com tudo que vocĂȘ faz, explica e orienta seu cĂ©rebro tem algum problema agora estou preocupado com o meuâŠrisos
My Friend if you are here you have a problem . Other People have a Life . Fortunately you donât really need to be a Genius to have Fun . Just Enjoy .
.
.
.
Meu amigo, se vocĂȘ estĂĄ aqui, vocĂȘ tem um problema. Outras pessoas tĂȘm uma vida. Felizmente vocĂȘ realmente nĂŁo precisa ser um GĂȘnio para se divertir. Apenas aproveite .
.
.
.
If you inspect you can play with the calendar date in time machine to see if logic works.
Looks like you can probably do it all in one fieldâŠbut i like to split it into separate text fields as its easier for me to understand !
Above give weird results for me.
I believe that is the old version that used to work until Facer updated mid last year. I took out all the leap year parts and just used $(#Dy#/4)==floor(#Dy#/4)&&#DD#<=360?360-#DD#:$ $(#Dy#/4)!=floor(#Dy#/4)&&#DD#<=359?359-#DD#:$
with opacity so it would only start showing during December. $#DMM#==12&&#DdL#<25?100:0$
Then I used this as a countdown until New Years $#Dy#%4==0&&#DD#<=367?367-#DD#:$ $#Dy#%4!=0&&#DD#<=367?366-#DD#:$ Days Until (#Dyyyy#+1)
and I used $#DMM#==12&&#DdL#>25?100:0$
in opacity.
I had to cheat the system by making it less functional, but more stable.
Yep, I think its hard to do it all in one field⊠and alot easier to make sense of formulas if they are split into separate objects.