locked
Fail to match a string returned from DateTimeFormatter.format RRS feed

  • Question

  • var formatter = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("shortdate", ["zh-CN"]);

    var time = new Date(); var stringTime = formatter.format(time);

    var searchString = "2012[/]"; var reg = new RegExp(searchString);

    var result = stringTime.match(reg);

    The result is null. I can match "2012" and I can match "[/]" also, but I can't match "2012[/]". 

    If I use "var stringTime ='2012/7/19'" instead of "var stringTime = formatter.format(time);", it runs well.

    Is there something wrong with DateTimeFormatter.format() ?

    Thursday, July 19, 2012 6:20 AM

Answers

All replies

  • I found there are two byte '\0x0e\0x20' between "2012" and "/". 
    Thursday, July 19, 2012 6:56 AM
  • This seems like a bug in WinJS formatting... The APIs do not mention any special characters.
    Thursday, September 27, 2012 4:08 AM