Tag.Year question

Aug 24, 2012 at 9:14 PM
Edited Aug 24, 2012 at 9:15 PM

Looking at tag.Year.Value show me a datetime value e.g if an mp3 file has a year tag of 2007, from Id3Tag.Year.Value i obtain 01/01/2007 when i expect only 2007.

Looking at the source, i saw that YearFrame derive from DateTimeTextFrame and define a custom DateTimeFormat but it's not used in DateTimeTextFrame Value getter nor in the ToString method.

My personal opinion is that almost one of Value getter and ToString method should use the DateTimeFormat so we can have the correct Year value.

Example of DateTimeTextFrame Value getter:

 

public override sealed string Value
{
	get { return AsDateTime.HasValue ? AsDateTime.Value.ToString( DateTimeFormat ) : null; }
	set
	{
		if (string.IsNullOrEmpty(value))
			AsDateTime = null;
		else
		{
			DateTime dateTime;
			if (
				!DateTime.TryParseExact(value, DateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces,
										out dateTime))
				AsDateTime = null;
			else
				AsDateTime = dateTime;
		}
	}
}

Kind Regards

Massimiliano

Coordinator
Aug 26, 2012 at 6:41 AM

The YearFrame will be changing to a TextFrame (specifically a NumericTextFrame) in the next release. The ID3 v2.3 specification says that it should be a text frame, but I had initially gone with a date/time frame because it seemed to make sense. However, using it as a date/time has turned out to be not so intuitive, and so I'll be changing it to be a NumericTextFrame.

Regards,

Jeevan