Only a little request

Issue #3 resolved
Former user created an issue

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)

  1. arie repo owner

    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.

  2. Domenico

    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

  3. Domenico

    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.

  4. arie 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.

  5. Domenico

    Hi Arie,

    No, I am not on test version, the Format date Card I see haven’t un optional argument.

  6. arie 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.

  7. Domenico

    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

  8. arie 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?

  9. arie 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?

  10. arie 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.

  11. Domenico

    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

  12. Domenico

    So in that case the easier way is to have a string function which extract char from the right to extract hh:mm only…. :)

  13. arie 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")
    

  14. arie 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)

  15. Domenico

    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'“.

  16. arie 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)
    

  17. arie 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.

  18. Domenico

    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 :

  19. arie repo owner

    No, please look again at my pictures:

    the code in the first card should be

    date('HH:mm', arg)
    

  20. arie 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 :)

  21. Domenico

    Sorry Arie… now it’s ok :)

    I guess is in GMT+0 so I have to sum +1 Hour

    Thank you for your help

  22. arie repo owner

    No, goto bll app settings and set your timezone. Than the time should be translated into your timezone.

  23. Domenico

    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 :)

  24. arie 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):

  25. arie 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]

  26. Domenico

    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

  27. arie 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.

  28. Domenico

    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)!

  29. Log in to comment