Author Topic: $Now() and <Last Played> Between 12:00:00 AM-12:59:59 AM Not Handling Correctly  (Read 1860 times)

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
Running version 3.4.7422.

Code
 $If($Now()>=<Last Played>,T,F)

$Now() -> 06/15/20 11:04:33 AM
<Last Played> -> 06/14/20 11:57 PM

This correctly displays "T," but...

$Now() -> 06/15/20 11:04:33 AM
<Last Played> -> 06/15/20 12:03 AM

...incorrectly shows "F."

$Now() -> 06/15/20 11:04:33 AM
$AddDurationToDateTime(<Last Played>,01:00:00) -> 06/15/20 01:03 AM

Correctly displays "T."

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34313
I dont know how it would work at all as there is no $Now() function implemented by musicbee itself. Maybe its a plugin function someone has implemented. On the MusicBee side, <Last Played> would be converted to a local date/time so perhaps $Now() has been implemented as a UTC date/time
Last Edit: June 20, 2020, 03:25:18 AM by Steven

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
I was planning - one day - to getting around to trying to test out your suggestion, but, since it would likely be fairly daunting, I put it off. However, a couple weeks ago, I noticed another number-related thing when using the Additional Tagging & Reporting Tools plug-in, which I reported here and today, while helping another user out, I realized what's happening.

This code will return all expected results, i.e.
1 hour, 25 minutes...
1 hour, 1 minute
2 hours, 50 minutes
Code
$If($Div($Split(<Album Duration>,:,1),60)<1,,$RoundDown($Div($Split(<Album Duration>,:,1),60),0)" hour"$If($Pad($Split(<Album Duration>,:,1),3)>=120,"s",)", ")$Mod($Split(<Album Duration>,:,1),60)" minute"$If($Pad($Mod($Split(<Album Duration>,:,1),60),2)=01,,"s")

Removing the $Pad() function when checking if an album's duration is two hours or more returns incorrect results.
Code
$If($Div($Split(<Album Duration>,:,1),60)<1,,$RoundDown($Div($Split(<Album Duration>,:,1),60),0)" hour"$If($Split(<Album Duration>,:,1)>=120,"s",)", ")$Mod($Split(<Album Duration>,:,1),60)" minute"$If($Pad($Mod($Split(<Album Duration>,:,1),60),2)=01,,"s")

Furthermore...
Code
$If($Pad(1,2)=1,T,F)
...returns "F."

So... derp to me. I'm guessing this is intentional in how you want MB to handle numbers?