# Day of the Month - Plus/Minus X days

It would be really great if there was a tag for the following Day of the Month variations:
DoM +1 day
DoM +2 days
DoM +3 days
DoM +4 days
DoM +5 days

DoM - 1 day
DoM - 2 days
DoM - 3 days
DoM - 4 days
DoM - 5 days

Currently to calculate the DoM minus 1 day requires 14 different elements to capture all Month scenarios. DoM plus 1 day requires 2 elements. The goal in this request are for creating dial like the one below but with more flexibility:

That would be great for hours, minutes and seconds as wellā¦

I guess the advantage with those is you can get away with using a modelo.

1 Like

I think this was asked some time back ā¦ (maybe I didnāt post my response)

Day+1

`\$(#Dd#+1)<=#DIM#?(#Dd#+1):1\$`

Day-1

`\$#Dd#!=1?(#Dd#-1):\$\$#DM#=2&&#DD#=60?28:\$\$#DM#=2&&#DD#=61?29:\$\$(#DM#=4||#DM#=6||#DM#=9||#DM#=11)&&#Dd#=1?30:\$\$(#DM#=1||#DM#=3||#DM#=5||#DM#=7||#DM#=8||#DM#=10||#DM#=12)&&#Dd#=1?31:\$`

2 Likes

Cool! Thanks @andrew.dowden.

Is it possible to make the same for hours and minutes as well? Whatā about Ā±2 or/and Ā±3?

Yes, Iāll find time to create them all ā¦

Let me know which you are missing (and need first).

Minutes (0ā¦59)

Minutes +1, +n

`((#Dm#+1)%60)`
`((#Dm#+n)%60)`

Minutes -1, -n

`((#Dm#+60-1)%60)`
`((#Dm#+60-n)%60)`

Minutes (1ā¦60)

Minutes +1

`\$#Dm#!=60?(#Dm#+1):1\$`

Minutes -1

`\$#Dm#!=1?(#Dm#-1):60\$`

Hours (0ā¦23)

Hours -1, +n

`((#DH#+1)%24)`
`((#DH#+n)%24)`

Hours -1, -n

`((#DH#+24-1)%24)`
`((#DH#+24-n)%24)`

Hours (1-12)

(pending)

Hours (1-24)

Hours +1

`\$#DH#!=24?(#DH#+1):1\$`

Hours -1

`\$#DH#!=1?(#DH#-1):24\$`

Day (1ā¦28/29/30/31)

Day+2

`\$(#Dd#+2)<=#DIM#?(#Dd#+2):(#Dd#+2-#DIM#)\$`

Day-2

(pending)

Day+3

`\$(#Dd#+3)<=#DIM#?(#Dd#+3):(#Dd#+3-#DIM#)\$`

Day-3

(pending)

Month (1-12)

Month+1

`\$#DM#!=12?(#DM#+1):1\$`

Month-1

`\$#DM#!=1?(#DM#-1):12\$`

1 Like

Is it possible to do so for text based Day of week as well?

This Formula doesnĀ“t seem to be correct in one case.

When you go at the 1sth of a month it doesnĀ“t show any value. I think you canĀ“t get the number of days from the month before.

Day-of-week: (0-6, as text)

DOW

En
`\$#DOW#=0?Sun:\$\$#DOW#=1?Mon:\$\$#DOW#=2?Tue:\$\$#DOW#=3?Wed:\$\$#DOW#=4?Thu:\$\$#DOW#=5?Fri:\$\$#DOW#=6?Sat:\$`

Fra
`\$#DOW#=0?Dim:\$\$#DOW#=1?Lun:\$\$#DOW#=2?Mar:\$\$#DOW#=3?Mer:\$\$#DOW#=4?Jeu:\$\$#DOW#=5?Ven:\$\$#DOW#=6?Sam:\$`

Deu
`\$#DOW#=0?Son:\$\$#DOW#=1?Mon:\$\$#DOW#=2?Die:\$\$#DOW#=3?Mit:\$\$#DOW#=4?Don:\$\$#DOW#=5?Fre:\$\$#DOW#=6?Sam:\$`

DOW +1

`\$((#DOW#+1%7)=0?Sun:\$\$((#DOW#+1%7)=1?Mon:\$\$((#DOW#+1%7)=2?Tue:\$\$((#DOW#+1%7)=3?Wed:\$\$((#DOW#+1%7)=4?Thu:\$\$((#DOW#+1%7)=5?Fri:\$\$((#DOW#+1%7)=6?Sat:\$`

DOW -1

`\$((#DOW#+7-1)%7)=0?Sun:\$\$((#DOW#+7-1)%7)=1?Mon:\$\$((#DOW#+7-1)%7)=2?Tue:\$\$((#DOW#+7-1)%7)=3?Wed:\$\$((#DOW#+7-1)%7)=4?Thu:\$\$((#DOW#+7-1)%7)=5?Fri:\$\$((#DOW#+7-1)%7)=6?Sat:\$`

IMHO: This should all be built-in to Facer ā¦

1 Like

Nice solution!!! The only problem is that the formulae arenĀ“t linkable to an automated language selectorā¦

So spain, chinese and all othersā¦ are left behindā¦

And how do we solve that?

Actually, my āwhite boxā engine would solve that.

1 Like

I think we canĀ“t solve the language problem.

I am sure your white box engine would be able to solve it. And i am the first who would be the happiest man on earth to get rid of all that customized formulae.

Then we could have moonrise/moonset and other nice thingsā¦

And the whole program would become much more newbie friendlier.

1 Like

@andrew.dowden @GAUSS Are nested conditionals working for you guys? I thought the max was 2 before things stopped working.

Well, i tested hours, minutes, seconds with -3 up to +3. They seem to work fine on creator.

The month and day of week numeral formulae did work on creator in positive direction.

I didnĀ“t test on a smart watch yetā¦

1 Like

Here is a test file:

Nested conditional can cause issues.

It is not depth (>2 levels), but how the syntax is written. The limitation is in Facer parser (and even more so on the watch, than in Facer Creator).

As I have been able to work around it (and there have been no effort to fix/improve the issue), I have stopped trying to determine exact cause.

Old thread, but some good suggestions here which does not seem to have been implemented yet, especially @andrew.dowden 's āwhite boxā engine.
I landed here looking for a better solution for variable / calculated Day-of-the-week.

Even if the complete white box engine is not implemented, having basic day-of-the-week / month-of-the-year etc. arithmetic (i.e. + & - operations) available so that you can calculate a weekday or month fully localised with correct wrap around at the start/end of a week / year, will be a huge improvement.
e.g. say you want the text value for ātomorrowā, you could use (#DE#+1) or (#DEEEE#+1) etc. instead of the nested conditional statements above which only works for one language (and does not even work on all watch hardware at present).

I hope @Facer_Official is at least considering some of the suggestions made on this forumā¦

1 Like