Fixing my customized calendar

Thanks Spicy for your suggestion :slight_smile: ...but it doesn't respond to my requests, as I don't use extensions.
Anyway, it can be useful to someone else.

So I keep waiting for the answer to my previous question.

The first day of the month is the day in this month whose day number is 1.

If you are displaying the day number in each button of that calendar, just loop through them, testing each .Text value against 1.

Is that what you wanted?

P.S. in my rectangular month display, it was necessary to include prior month days to fill out the first week, since I was displaying complete weeks.

Is the weekday vs weekend nature of each date not important to you?

Great! I am finally free from the DatePicker

...not sure if my question was clear
I'm just not able to display the day "1" in my calendar (as you see in my video).
I think the problem is that "Add days" is adding days starting from the instant "day 1" so days starts from "2".

If I set the day on instant "0" it works and I can see all days of month, included "1", but it shows the Error that the similar date doesn't exist.
I really don't how to fix it.

The off-by-1 error might be from confusing an offset with an index.

Your quantity in the Clock.Add Days block could be changed to (index_day_button - 1) as a minimal tweak to lower your date range by a day.

Alleluia! It works.

Schermata 2022-08-10 alle 15.18.37

Now,
how can I change month days in my calendar while clicking arrows of DateButton?

You need a global variable (Calendar_Base_Instant?) for the year and month currently being displayed.

I see you were pulling those from Clock.Now in your last blocks image.

If you use an Instant for your global variable (Initialized to Now() at startup), you can use the Clock block AddMonth (+1 or -1) to adjust the global variable before refreshing your calendar display from the variable.

:+1:

How?
This is not accepted:
2

You can ref this guide to know how to get first day of every month without extension

You can't use these blocks in the initialization part. use it like this:

blocks

This should work.

init the variable to something like '' or 0, then in Screen.Initialize set it to Clock.Now

Do NOT set it to a year if you are keeping it as an Instant.

Also, you can see what kind of error is given by clicking on the red 'x', for example:

screenshot.110

Hi Yoshi :slight_smile:
Thanks to your suggestion, confirmed by Abraham, I was able to apply Abraham's solution: Fixing my customized calendar - #12 by ABG

So now browsing through the months of my calendar is fixed. Great!
These are my new blocks:


Nadi_09.aia (974.4 KB)

If there is any correction or improvement to be made, please tell me
...otherwise my next question is:

I have to set up an image for each day that contains the data.
How can I recall the Namespace?
...as you see in my blocks in the "Settings_Day_buttons" procedure I tried to do it, ...how can I do it?

ps: for now I have disconnected image setting for Sunday, I will put it back once buttons with data are fixed

...ah, the Namespace is called:

Are you

  • building the images, or are you
  • selecting them from a pre-defined list of image picture files?

If you want to store one image picture per day, you could add an extra TinyDB NameSpace 'Images' with days (pick a unique format like yyyyMMdd(?)) for tags and image file names as values.

@Ela
Just an information only, while creating namespaces, you could have maintain a dictionary where key - namespace and value - namespace-description, so that, later on you can recall if you have multiple namespaces.

Since, there is no built-in block to recall all created namespcesa smting like getTags

...instead of the background color (as you did), I highlight the button with the data by inserting an image in background that I have already loaded (as you see in my blocks in the "Settings Day buttons" procedure).
But how can I indicate which days contain data, so which buttons have to be highlighted?

Is this the solution?

...I mentioned the Namespace but maybe it is enough to use "call> Get tags" block? ...if so, how?

Here is what needs to be changed:

  • Change the procedure 'procedure' to the name 'tags' and give it a parameter (date) to make it accept a date and return the tag list for that date
  • (never leave a procedure named procedure. Always name it for what it does or what it returns.)
  • change the test on the returned tag list to 'is list empty?' from your text empty test.
  • change the tags value procedure to use the date parameter instead of the global date.
  • have the tags procedure return the taglist directly
  • if you want to have a Sunday background image test for dates with no activity, hang it off the else branch as shown.

P.S. I used the wrong global date on my blocks markup.
You want to use the local variable that has the current date instant for this pass through the loop over the month's dates and buttons.

It seems that sooner or later I will have to dive into the new dictionary ocean :slightly_smiling_face: ...then I will need your explanations

Since we are in this zone, I ask for a detail:
My app is all in English / Sanskrit, but the month names in the DatePicker Button are in Italian.
I know it depends on the phone system, but is there any way to set the date language to English?

1 Like

I was sure it was that simple :slight_smile:
Simple solutions for maximum power! ...this is my specialty

So it works perfectly.

I decided to highlight the days with data by simply setting the button text to white, bold.
I will work on it a little more for optimal viewing, but now having the right procedure, it will be easy to make any changes.

Now I have to work on clicking on the highlighted day and making the data appear in the table.

1 Like