Setting reminder for last day of the month - slack

Is there a Slack reminder for last day of the month so that the reminder will occur on the 31st, 30th, or the 28th depending on the month?
Does something like /remind #channel to do X on the last day of the month work?

This syntax seems to work in setting a reminder for the last day of every month:
/remind #someone [What] on the 31st of every month

There is a way but i could not find the best one to do it:
/remind #someone [What] on the 28th of every month
This will remind you on the 28th day of every month. Unfortunately there is no way of working this around. You can set a reminder for every 1st day of the month too:
/remind #someone [What] every month
You can set a reminder for every month but its not that easy to manage:
/remind #someone [What] on the 31st of every January
and so on.

I've just created 12 reminders for myself for the next year
/remind #yourname to "Fill time-report" at 9:00 on Sep 30
/remind #yourname to "Fill time-report" at 9:00 on Oct 31 # Note that October has 31 days
...
This way you can adjust for last weekday of the month being a holiday in your country

Related

How to set Slack reminder for last day of every month?

I need to complete timesheet of work until midnight of every last day of month. Since it's easy to forget, I want to set reminder on say 1PM of the last day. What's the correct syntax to configure it?
All my attempts either don't work or are clumsy:
/remind me "Complete timesheet!!!" at 13:00 on the last day of every month - sets 1st instead and does not completely understand
/remind me "Complete timesheet!!!" at 13:00 on the 31st of every month - works for 31-day-long months, ignores for shorter months
/remind me "Complete timesheet!!!" at 13:00 on the 30st of every month - (I guess) works every month except February, for 30-day-long months one can manually snooze by day
/remind me "Complete timesheet!!!" at -11:00 on the 1st of every month - sets 1st instead and does not completely understand
/remind me "Complete timesheet!!!" 11 hours before 1st day of every month - sets 1st instead and does not completely understand
12x copy of /remind me "Complete timesheet!!!" at 13:00 every November 30th for literally mentioned last day of every month - works but too lengthy
I will also accept answer with link to any documentation with formalized syntax of /remind command (BNF, railroad diagram) from which the possibility of such command would be either provable or disprovable.

Get date of a given day of the week based on current date Carbon Laravel

Based on the current date Carbon :: now (), there is a need to get the date from the current week by the ordinal number of the day of the week from 1 to 7 or by the name of the day of the week (Monday, Tuesday ...).
Example:
Let's say the current date is 2020-12-12;
There is a need to find out what date will be for Sunday of the current week by the name Sunday or by the number of the day of the week 7;

Laravel Carbon find same day of week in previous month

I am trying to find the same day of week from last month if today's date is Wednesday Oct 2nd 2019. I need to retrieve Wednesday Sept 4th 2019.
I am using Carbon and have tried subDays(30) and subMonth(1) but that obviously doesn't return the same week day.
SalesLogs::loadByDate(Carbon::now()->subMonth(1));
This code works as expected, however I am unable to work out how to make it find the same day of the week based on the prior month.
It's not super clear what you are trying to do, but I will take a shot at it. What about if you subtract a month, and then go to the next matching weekday?
$weekday = now()->dayOfWeek;
SalesLogs::loadByDate(now()->subMonth(1)->next($weekday));
Note: you can take advantage of Laravel's handy now() helper function, which is equal to Carbon::now(), but saves you from having to import Carbon.
Does that get you what you need?

Rest the month and I keep giving the same month with Carbon

Until yesterday it worked perfectly showed me February and January, the two previous months but now it is showing me March and January:
This is the date of my computer recently:
This is the code:
I do not understand what is happening if some information is missing or they need something else I can provide it
When subtracting a month from the 29th of March, you would expect to get the 29th of February, which does not exist. So, PHP compensates this by counting the extra days. This way, the date becomes the 1st of march.
To avoid this problem, use the carbon constructor and instruct it to get the last month:
$lastMonth = new Carbon('first day of last month');

Why does the number week of the year start with 1 or 0 depending on the year?

Why does the number of the week of the year start with 1 in 2017 and 0 in 2018?
Date.strptime('2017-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %U') #2017-01-01 01
Date.strptime('2018-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %U') #2018-01-01 00
From the Ruby docs
Week number:
The week 1 of YYYY starts with a Sunday or Monday (according to %U
or %W). The days in the year before the first week are in week 0.
%U - Week number of the year. The week starts with Sunday. (00..53)
So it seems that Ruby identifies the "first week" (week 1) as starting with the first Sunday of the year. Anything that happens to come before that exists in week 0. 2017 happened to start on a Sunday, so the first day started the first week. However, 2018 started on a Monday, so week 1 of 2018 will start on January 7th, the first Sunday of the year.
To show week numbers according to ISO-8601, use %V:
# %V - Week number of the week-based year (01..53)
Date.strptime('2017-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %V') #2017-01-01 52
Date.strptime('2018-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %V') #2018-01-01 01
In general:
Week number according to the ISO-8601 standard, weeks starting on Monday. The first week of the year is the week that contains that year's first Thursday (='First 4-day week').
https://www.epochconverter.com/weeknumbers

Resources