Only a little request
Hi, and thanks for your APP,
Just a little request if it maybe possible to have Format card to be available also for a datetime text string non only for system datetime tag.
Thank you in advance!
Regards Domenico
Comments (43)
-
repo owner -
repo owner - changed status to resolved
I have updated the card to give a better picture, see https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/221
-
Hi arie
Thank you for answer. What I mean if it can be possible to have a Format card that works also for a text variable in which I put the system datetime. In that way I can extract only the info I want: (or month or day or year). I still see the Format card able to manage datetime system variable if I am not wrong, in case let me know.
Thank you
-
In a text variable I can put also a datetime output from another APP and I need to extract only the datetime part I want (hour, minutes or day). So I need a Format card which works on a text variable.
-
repo owner Hey Domenico, i think you can already do what you want, just a very little bit different:
Ill post it on the topic:
[APP][Pro] Better Logic Library - For Users - Apps - Homey Community Forum
And yes, later on, i will probably add a Format date free-text card.
But i wanna see where this app goes first before i deside how cards will look.
So i hope you can manage with these examples, everything you want should be able already.
Else, let me know!
-
repo owner - changed status to on hold
-
repo owner Also, are you on the test version?
The Format Date card has an optional date argument.
But i think you ment you also want the format as text and not select, right.
-
Hi Arie,
No, I am not on test version, the Format date Card I see haven’t un optional argument.
-
hasn’t
-
repo owner Okay, then install the test version (append /Test to the app store url) or wait for the review by athom ;)
Might be Friday tho.
-
I have just installed the test version as for your indication. Then I’ve used the Format card by putting in mandatory arg <date>='HH:mm' and in <date> optional arg the text string containing my datetime. But the output in “Formatted result” tag is related to System date time, not related to <date> optional arg.
Maybe I made something wrong
-
repo owner What is the date-argument look like?
It needs to be an UTC-Time-number, UTC-Stamp/ISO or a date object.
Can you share your flow or print-screen?
-
repo owner You need to have the text-date in these formats:
-
repo owner I dont know where you get the date from, but somewhere you save that into a variable?
How do you place that into a variable? How do you get that date?
-
repo owner Btw, the new version has just been approved and is live, perhaps beter to switch back to the live version, so you don’t auto-update on test-changes.
-
The output in test is formatted System datetime not the formatted text variable I put in optional arg.
The optional arg is: 11/15/2022, 6:00:00 PM
-
Ah ok, maybe the problem is that optional arg is not in UTC format
-
So in that case the easier way is to have a string function which extract char from the right to extract hh:mm only…. :)
-
repo owner Indeed, a date-conversion will be made, but not right now.
“So in that case the easier way is to have a string function which extract char from the right to extract hh:mm only…. :)”
However, you can create a function in the app settings for this!
Here for example:
Functionname: extract
function (s) { return s.substr(2,2) }
then use this in any BLL expression or in a BLL coding:
extract("2022-01-01")
-
repo owner Wait, i’m putting through an update, you can just use the date-tag like you have it and it will be converted into a date:
It’s in the latest live version i just pushed a minute ago: version 2.1.5.
It will convert EN dates automaticly (and a lott of apps give you the datetime in the default EN, so this will work great for most apps)
-
repo owner wrap the arg in a d():
-
Great!
I’ve just created the function (extract from 11th char for 10 chars), but I’ve got an error:
Error: “Invalid type for token 'text' expected 'string' but got 'undefined'“.
-
I will give a try with your new date function
-
repo owner I removed the d method, because it would be pointless atm. ;)
Update to 2.1.6.
Then, just place the EN formatted date as argument/token:
And don’t forget to send the arg to your method in your example:
ExtractString11_10(arg)
-
repo owner Sorry about messing around with the d method and not.
But i realized that it would be handier for most apps to use the default Homey EN input.
And for the convertion method, what will come, the default should be BLL locale/timezone/etc.
-
Hello Arie,
It seems there is something strange.
I have used your Date function but the HH:mm extracted from my datestring is different from source hh:mm :
-
repo owner No, please look again at my pictures:
the code in the first card should be
date('HH:mm', arg)
-
repo owner That would be enough, use the Text-Tag from the first card you have with the code i supplied, and it should work :)
-
This is the result:
-
repo owner Please copy/paste my code, it is case sensitive. You have a capital D in Date.
-
Sorry Arie… now it’s ok :)
I guess is in GMT+0 so I have to sum +1 Hour
Thank you for your help
-
To subtract
-
repo owner No, goto bll app settings and set your timezone. Than the time should be translated into your timezone.
-
Just made. I have also restarted app but it is still 1 hour ahead as shown above.
But it is no a problem for me now. You have solved my former problem, so thank you for your time. I will put five stars to your app for sure :)
-
repo owner Hey Domenico,
Just so you know: I have changed the flowcard a bit, removed the argument from it.
You current cards still work, but better update them by placing the token within the function directly (no arg):
-
repo owner - changed status to resolved
-
Hi Arie,
I get an error:
-
Then, the token “shortdatetime” what has to return? I need HH:mm as per previous need
-
repo owner Yeah, the Token in the left-top card: you need qoutes around them (i would do double qoutes)
And you don’t need shortdatetime, you can just type: “HH:mm”
So, place this in the card:
date("HH:mm", "[TOKEN]")
Replace [TOKEN]
-
OK, solved,
However I still see 1 hour ahead in converted date 19:00 rather than 18:00. I confirm that I set regional setting to Italian in your app. If you want to reproduce the case
-
repo owner First off, are you absolute sure the 11/16/2022, 6:00:00 PM is YOUR 6:00:00 PM?
If not, they result (19:00?) should be the correct one.
If somehow the date you get is already translated into your timezone-time, then you need to handle it as an GMT time in the flowcard:
date("HH:mm", "[TOKEN]", null, "GMT")
GMT will keep the date/time always the same as input, since input it considered GMT.
-
Yes,
the 11/16/2022, 6:00:00 PM is my 6:00:00 PM.
I handled it as GMT time as you indicated and NOW it works fine (returns 18:00)!
-
repo owner Great!
- Log in to comment
Hey, sure, but please explain in more details what you want, because that is not clear to me.
In the formatcrd, you can type any format you wish yourself, and selct it from the top of the list.
If that is not what you mean, please explain further.