%year% returning two different values for the same file

I'm working on a filter to reorganise a massive music library, which is currently this (still WIP):

F:\Music\$left($if2(%albumartist%,%artist%),1)\$if2(%albumartist%,%artist%)\\%year%$if(%date%,-$cutLeft(%date%,2)$if($eq($len(%date%),4),-$cutRight(%date%,2),),) ~ %album%\$left(%artist%,1)$left($right(%artist%,$sub($len(%artist%),$strrchr(%artist%, ))),1)[-%year%][$num(%discnumber%,2)-]$num(%track%,2) - %title%

Indented for readability:

            \\%year%$if(%date%,-$cutLeft(%date%,2)$if($eq($len(%date%),4),-$cutRight(%date%,2),),) ~ %album%
                \$left(%artist%,1)$left($right(%artist%,$sub($len(%artist%),$strrchr(%artist%, ))),1)[-%year%][$num(%discnumber%,2)-]$num(%track%,2) - %title%

The parts I'm concerned with are these:


Which displays the date as YYYY-MM-DD format (if this looks unnecessarily complicated, read on). %date% here seems to return MMDD from the date.

And this:

$left(%artist%,1)$left($right(%artist%,$sub($len(%artist%),$strrchr(%artist%, ))),1)[-%year%]

Which displays the first letter of the first and last word in the Artist field, followed by year as YYYY.
(E.g. "Arjen Anthony Lucassen", "2012" -> "AL-2012")

My issue is this:
In the first code snippet, %year% returns "2012". In the second one, it returns "2012-04-20", which is what I wrote all that other gobbledigook to display. (It also managed to display exactly the format I didn't want, both times <_< )

I haven't really tested much to reproduce this behaviour (just writing "[-%year%]" anywhere else doesn't work), but it's very strange.

Can anyone shed light on this issue? Is the %year% field supposed to display YYYY, YYYY-MM-DD or something else? In the documentation it just says "Year".

AFAIKT there is some information about DATE and YEAR if you have a look at the changelog
for Version 2.58 and 2.59

Perhaps this sheds some light.

It does, thanks.

I've got foobar2000 set to use ID3v2.3, so it's saving the full date in TYER. I gather from that changelog that in Mp3tag, %date% fetches the TDAT tag, which isn't mentioned in foobar2000's tag mapping documentation. As far as I can tell, TDAT doesn't exist in my files at all, so I don't know where %date% is getting it's information from, or why %year% has changed on me.

I guess I'm still confused. Enlightened, but still confused.