code: function(str, fmt) {
  
              if ((!str) || (!str.indexOf) || (str.indexOf("mm")==0)) return null;
  
              var y = 0;
              var m = -1;
              var d = 0;
              var a = str.split(/\W+/);
              var b = fmt.match(/%./g);
              var i = 0, j = 0;
              var hr = 0;
              var min = 0;
              var sec = 0;
  
              for (i = 0; i < a.length; ++i) {
                  if (!a[i])
                      continue;
                  switch (b[i]) {
                      case "%d":
                          d = parseInt(a[i], 10);
                          break;
  
                      case "%m":
                          m = parseInt(a[i], 10) - 1;
                          break;
  
                      case "%Y":
                      case "%y":
                          y = parseInt(a[i], 10);
                          (y < 100) && (y += (y > 29) ? 1900 : 2000);
                          break;
  
                      case "%H":
                          hr = parseInt(a[i], 10);
                          break;
  
                      case "%M":
                          min = parseInt(a[i], 10);
                          break;
  
                      case "%S":
                          sec = parseInt(a[i], 10);
                          break;
  
                      default:
                          break;
                  }
              }
              if (y != 0 && m != -1 && d != 0) {
                  var ourDate = new Date(y, m, d, hr, min, sec);
                  return ourDate;
              } else {
                  //this.logger.warn('unable to parse date "' + str + '" into "' + fmt + '"');
                  return false;
              }
          }
docs: This was ported, rewritten a bit and greatly simplified from the
  same method in the old Calendar object we used to use.
  TODO - it is only here temporarily, and we should continue trying to
  kill it.