Actually looking at the old code the only problem was line 72, `hour = 1`, that just needs to be `hour = 12` and then you can still add in your `ampm` variable.

```javascript
var hour = time.getHours() %12,
    ampm = hour < 12 ? "AM" : "PM";
if (hour === 0) {
    hour = 12;
}
```