Easy Time Macros for Templates!

Thanks, added in 1.0.4

Petro keep in in mind that all languages do not use camel case.
I deliberately lower cases the day and month names since they are default lower case in swedish.
Only when they are the first word of a sentence are they capitalized, which should fall under normal sentencing rules.
The sentence “First Monday in January” is properly cased when written “Första måndagen i januari”.
Having capital day and month name would be wrong.

Now that I think about it, isn’t “first” and “last” something you might need translation for?

1 Like

Did not know that. Will fix in next update.

1 Like

Got the hacs update giving access to jinja templates. Very nice.

Time/date junkies may also be interested in GitHub - TheFes/relative-time-plus: Relative Time Macro with additional options

1 Like

Yep, that offers some different functionality that I do not use in my relative times. I put a link to it in the readme

1 Like

Very cool, Petro!

How about a days in month macro? If I looked correctly, the ones you have all work by weekday and won’t be covered by your “coming soon” next_day and last_day macros.

(Also, small typo in the first post: “Thanksgiving day is the 4th Thrusday in November.”)

1 Like

Yeah that can be added

1 Like

Danish:

'da':{
    'and': 'og',
    'in': 'i',
    'ago': 'siden',
    'now': 'nu',
    'lose': 'mister',
    'gain': 'tilføjer',
    'time':{
      'format': '24-hr',
      'year': [
        'Å',
        'år',
        'år',
      ],
      'week': [
        'u',
        'uge',
        'uger,
      ],
      'day': [
        'd',
        'dag',
        'dage',
      ],
      'hour': [
        't',
        'time',
        'timer',
      ],
      'minute': [
        'min',
        'minut',
        'minutter',
      ],
      'second': [
        'sek',
        'sekund',
        'sekunder',
      ],
    },
    'delta':{
      'today': 'i dag',
      'tomorrow': 'i morgen',
      'yesterday': 'i går',
    },
    'days':[
      "mandag",
      "tirsdag",
      "onsdag",
      "torsdag",
      "fredag",
      "lørdag",
      "søndag",
    ],
    'months':[
      'januar',
      'februar',
      'marts',
      'april',
      'maj',
      'juni',
      'juli',
      'august',
      'september',
      'oktober',
      'november',
      'december',
    ]
  }
1 Like

Had the same issue in danish, so I’ve just edited the danish version. Just in case that you already copied it.

v1.0.5.1

New Features

  • Number of Days in Month Counters
  • Weekday dates

New Languages

  • Danish
  • French
1 Like

This is wonderful, really…
As per requests, I have seen quite a few: xth weekday of the month, e.g. for garbage collection

Ah yes, that should be a quick add

And another one: time untill/since a specified datetime

that’s already done. easy_time, big_time, easy_relative_time, etc

Not quite the same request, days remaining until a monthly day, like this:

1 Like

Which I would like to see extended to a datetime, so that one can use more detail then just days

I’m not following what you’re requesting. A difference between datetimes is a timedelta. Is this what you’re asking for? Otherwise there are methods that already handle relative times but they output friendly verbiage.

I can make functions that return timedeltas, but the difference between two datetimes will never be a datetime.

I’m after the days remaining from a monthly anniversary day.

Like how many days until my monthly bill is due on the xth day of each month.

Yeah, I understood what you’re after, I can add that pretty easily. My concern is about vingerha’s request because it doesn’t make sense to me.

I think I’ll have to add vingerha’s request in order to even do yours. So I’d like his clarification first. Then I can reuse functions when outputting your info

1 Like

As an example, I’d like to know the time to (say) 27th of April, 14:00 (my timezone). I’d like to express that not just in days, I also want hours and maybe others want minutes too but that format maybe just a post-macro formatting of the ts in seconds…let’s not make it too complex.
For the overtime, similar, I want to show my (live example) kids that their work is xd, yh due