List-Formatting icon indicating copy to clipboard operation
List-Formatting copied to clipboard

generic-world-time for 30 minute differences, example Banglore is +9 hrs 30 min

Open jaxkookie opened this issue 2 years ago • 7 comments

would like to see how to work with timezones in the half-hour. Banglore 9.5 hours Baroda 9.5 hours India 10.5 hours

jaxkookie avatar Jun 08 '22 16:06 jaxkookie

after looking at it closely I just wrapped the txtContent [$TimeDifference] with floor. "txtContent": "=abs((24 + floor([$TimeDifference]) + 5) % 24)" that fixed the chart column, but still need to figure out how to get the chart timeline to line up on the half hour

jaxkookie avatar Jun 08 '22 16:06 jaxkookie

Hi @jaxkookie ! Thank you for your feedback! I forgot that the time difference is not necessarily an integer😥

I tried to shift the chart to the right if the time difference was not an integer, as shown in the next image. What do you think? image

I will share the code later after reviewing it.

tecchan1107 avatar Jun 09 '22 05:06 tecchan1107

Hi @tecchan1107, thanks for the reply. that's a great start, I was looking to see if I could bump or left pad the first number so the chart stays aligned.

jaxkookie avatar Jun 09 '22 11:06 jaxkookie

@jaxkookie Fixed the code in the pull request. Please try it! https://github.com/pnp/List-Formatting/pull/521

tecchan1107 avatar Jun 09 '22 11:06 tecchan1107

@tecchan1107 , thank you great job. I made a little tweak. on line 25: "margin-left": "=if([$TimeDifference] % 1 == 0 , '0px', if([$TimeDifference] > 0 , ((abs(1 - [$TimeDifference] % 1) * 60) / (60 * 24) * 100) + '%' , ((abs([$TimeDifference] % 1) * 60) / (60 * 24) * 100) + '%'))" I changed to padding-left. Then I added a new line 26"

25: "padding-left": "=if([$TimeDifference] % 1 == 0 , '0px', if([$TimeDifference] > 0 , ((abs(1 - [$TimeDifference] % 1) * 60) / (60 * 24) * 100) + '%' , ((abs([$TimeDifference] % 1) * 60) / (60 * 24) * 100) + '%'))", 26: "padding-right": "=if([$TimeDifference] % 1 == 0 , ((abs(1 - [$TimeDifference] % 1) * 60) / (60 * 24) * 100)/2 + '%' , '0px')"

this now aligns both the beginning and end charts.

great work.

jaxkookie avatar Jun 09 '22 13:06 jaxkookie

@tecchan1107 hi again. one more enhancement. I notice the time differents with half-hour, midnight showed up as 24, whereas all the others showed as 0. for all the txtContent I added a logic check, if it is 24, return 0

"txtContent": "=if(ceiling(abs((24 + [$TimeDifference]) % 24))==24,0,ceiling(abs((24 + [$TimeDifference]) % 24)))" thanks again

jaxkookie avatar Jun 09 '22 20:06 jaxkookie

Hi @jaxkookie

Thank you for your feedback!! I have fixed the txtContent. I also modified it to adjust the size of the div on both ends if the time difference was in minutes. image

I have fixed the code in the pull request, so you can try it again if you like.

tecchan1107 avatar Jun 10 '22 04:06 tecchan1107