moment/moment-timezone — pull request #93 by timrwood (2014-06-17 16:39:33+00:00)
Title: Parsing ambiguous input with a timezone (Redux)

This is a rebase of the tests from #27 on top of the new architecture.

When DST ends, there is an hour that is duplicated.

At the end of DST in the US, at 2am the clocks roll back an hour to 1am. Thus, given a time from 1am to 2am, it could be either before or after the rollback. The time progression is `12:00..12:59 1:00..1:59 1:00..1:59 2:00`.

This is easier to understand with the offsets noted.

```
12:00 +07:00 = 07:00
01:00 +07:00 = 08:00
01:00 +08:00 = 09:00
02:00 +08:00 = 10:00
```

When DST starts, there is an hour that is lost.

At the start of DST in the US, at 2am the clocks roll forward an hour to 3am. Thus, there is no such time between 2am and 3am. The time progression is `12:00..12:59 1:00..1:59 3:00`.

```
12:00 +08:00 = 08:00
01:00 +08:00 = 09:00
03:00 +07:00 = 10:00
04:00 +07:00 = 11:00
```

The assumption made in the tests below is to always 'round down'.

When DST is ending, if there are two valid times, use the one with the lower offset. This has the fault of not being able to parse `01:00+08:00`.

```
12:00 -> 12:00 +07:00
01:00 -> 01:00 +07:00
02:00 -> 02:00 +08:00
```

When DST is starting, if there is no valid time, subtract the DST change (typically one hour) and use that value. This has the fault of changing the value of `02:00` to `01:00`.

```
12:00 -> 12:00 +08:00
01:00 -> 01:00 +08:00
02:00 -> 01:00 +08:00
03:00 -> 03:00 +07:00
```

TODO:
- [ ] Add tests for `Zone#parse`.
- [ ] Add tests to make sure offsets are only being added if `moment.tz.needsOffset` is `true`.