Open
Description
I am struggling to get the string.format to work with date formats
I have stepped through the code and it appears that the constructor for my date object doesn't have a 'name' field
and the constructor has a prototype called 'invalid date'
The date has been passed in by json from my server. I transform this into a javascript date object with the code below
internal static Date FixDate(Date date) {
if (Script.IsNullOrUndefined(date)) return null;
if (date.ToString().IndexOf("Date") > -1)
return new Date(int.Parse(date.ToString().Substr(6)));
return date;
}
And I am using the next piece for formatting the date
internal static int ToYearMonthKey(Date date) {
if (Script.IsNullOrUndefined(date)) return 0;
return int.Parse(string.Format(CultureInfo.InvariantCulture, "{0:yyyyMM}", date));
}