Question: I am working on some AutoIt code to help me with office pranks and stuff. The first string works to rewrite the string "shutdown pc00xxx" into `shutdown /r /m pc00xxx /t 0`, but I can't get the second string to re.

I have the following code:

```
func RunProc($string)
    Local $command = StringLower($string)
    Local $subs = StringMid($command, 1, 4)
    Local $computer = StringInStr($command, "pc")

    if $subs == "shut" Then

        Run("shutdown /r /m " & StringMid($command, $computer) & " /t 0")

    ElseIf $subs == "clos" Then

        Local $prleft = StringTrimLeft($command, 6)
        Local $extend = StringInStr($command, "on")
        Local $pright = StringTrimRight($prleft, $extend)
        Local $strclose = StringMid($string, $prleft, $pright)
        Run("taskkill.exe /S "& StringMid($command, $computer) & "  /im " & $strclose & ".exe")
    EndIf

```

The problem is that I am trying to rewrite the phrase "CLOSE "SOMETHING" ON "pc00xxx" to be taskkill.exe /S pc00xxx /im SOMETHING.exe, I am trying to get the substring between "CLOSE " and " ON pc00xxx.

So, for example, I would type CLOSE OUTLOOK ON PC00xxx and have the value of $strclose be:

```
$strclose = outlook

```

Answer: 
**Your mdDateLocaleProvider doesnt check for null values.**

Your Problem is:

```
app.config(['$mdDateLocaleProvider', function ($mdDateLocaleProvider) {
  $mdDateLocaleProvider.formatDate = function(date) {
     return moment(date).format('DD-MM-YYYY');
  }}]);

```

it needs to be something like:

```
$mdDateLocaleProvider.formatDate = function(date) {
   var m = moment(date);
   return m.isValid()? m.format('DD-MM-YYYY') : '';
};

```

Then you can set

```
$scope.user.dob=null;

```

And get an empty Datepicker.
The problem is your ng-model. You're initializing it with the current date:

```
$scope.user.dob = new Date();

```

Simply empty this variable and you'll be good ;)