Skip to content

Commit

Permalink
Fix round-trip bug with d/EEEE ordering in formats like PPPPP (#1795)
Browse files Browse the repository at this point in the history
  • Loading branch information
arsnyder16 committed Jul 17, 2020
1 parent 130e749 commit 2a73ae1
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/locale/hu/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 1453. máj. 29. | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 1987. február 11. | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453. május 29. | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987. február 11., szerda | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453. május 29., vasárnap | 1453-05-08T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987. február 11., szerda | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453. május 29., vasárnap | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 12:13 | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 23:59 | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 12:13:14 | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 2 additions & 2 deletions src/locale/hy/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 29 մայ, 1453 | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 11 փետրվար, 1987 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29 մայիս, 1453 | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 11 փետրվար, 1987, չորեքշաբթի | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29 մայիս, 1453, կիրակի | 1453-05-08T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 11 փետրվար, 1987, չորեքշաբթի | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29 մայիս, 1453, կիրակի | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 12:13 | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 23:59 | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 12:13:14 | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 2 additions & 2 deletions src/locale/ja/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 1453/05/29 | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日 | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日水曜日 | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日日曜日 | 1453-05-08T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日水曜日 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日日曜日 | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 12:13 | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 23:59 | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 12:13:14 | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 2 additions & 2 deletions src/locale/ko/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 1453.05.29 | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 1987년 2월 11일 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453년 5월 29일 | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987년 2월 11일 수요일 | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453년 5월 29일 일요일 | 1453-05-01T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987년 2월 11일 수요일 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453년 5월 29일 일요일 | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 12:13 | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 23:59 | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 12:13:14 | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 2 additions & 2 deletions src/locale/lt/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 1453-05-29 | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 1987 m. vasario 11 d. | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 m. gegužės 29 d. | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987 m. vasario 11 d., trečiadienį | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 m. gegužės 29 d., sekmadienį | 1453-05-08T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987 m. vasario 11 d., trečiadienį | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 m. gegužės 29 d., sekmadienį | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 12:13 | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 23:59 | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 12:13:14 | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 2 additions & 2 deletions src/locale/te/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 29 మే, 1453 | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 11 ఫిబ్రవరి, 1987 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29 మే, 1453 | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 11, ఫిబ్రవరి 1987, బుధవారం | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29, మే 1453, ఆదివారం | 1453-05-01T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 11, ఫిబ్రవరి 1987, బుధవారం | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29, మే 1453, ఆదివారం | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 12:13 అపరాహ్నం | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 11:59 అపరాహ్నం | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 12:13:14 అపరాహ్నం | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 2 additions & 2 deletions src/locale/tr/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 29 May 1453 | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 11 Şubat 1987 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29 Mayıs 1453 | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 11 Şubat 1987 Çarşamba | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29 Mayıs 1453 Pazar | 1453-05-08T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 11 Şubat 1987 Çarşamba | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 29 Mayıs 1453 Pazar | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 12:13 | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 23:59 | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 12:13:14 | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 2 additions & 2 deletions src/locale/zh-CN/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 1453-05-29 | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日 | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日 星期三 | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日 星期日 | 1453-05-08T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日 星期三 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日 星期日 | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 下午 12:13 | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 下午 11:59 | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 下午 12:13:14 | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 2 additions & 2 deletions src/locale/zh-TW/snapshot.md
Expand Up @@ -166,8 +166,8 @@
| | | 1453-05-29T23:59:59.999Z | 1453-05-29 | 1453-05-29T00:00:00.000Z |
| | PPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日 | 1453-05-29T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日 星期三 | 1987-02-04T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日 星期日 | 1453-05-08T00:00:00.000Z |
| | PPPP | 1987-02-11T12:13:14.015Z | 1987 年 2 月 11 日 星期三 | 1987-02-11T00:00:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 1453 年 5 月 29 日 星期日 | 1453-05-29T00:00:00.000Z |
| Long localized time | p | 1987-02-11T12:13:14.015Z | 下午 12:13 | 1987-02-11T12:13:00.000Z |
| | | 1453-05-29T23:59:59.999Z | 下午 11:59 | 1453-05-29T23:59:00.000Z |
| | pp | 1987-02-11T12:13:14.015Z | 下午 12:13:14 | 1987-02-11T12:13:14.000Z |
Expand Down
4 changes: 4 additions & 0 deletions src/parse/_lib/parsers/index.js
Expand Up @@ -866,6 +866,8 @@ var parsers = {
// Day of the month
d: {
priority: 90,

subPriority: 1,

parse: function(string, token, match, _options) {
switch (token) {
Expand Down Expand Up @@ -914,6 +916,8 @@ var parsers = {
// Day of year
D: {
priority: 90,

subPriority: 1,

parse: function(string, token, match, _options) {
switch (token) {
Expand Down
6 changes: 5 additions & 1 deletion src/parse/index.js
Expand Up @@ -422,6 +422,7 @@ export default function parse(
var setters = [
{
priority: TIMEZONE_UNIT_PRIORITY,
subPriority: -1,
set: dateToSystemTimezone,
index: 0
}
Expand Down Expand Up @@ -504,6 +505,7 @@ export default function parse(

setters.push({
priority: parser.priority,
subPriority: parser.subPriority || 0,
set: parser.set,
validate: parser.validate,
value: parseResult.value,
Expand Down Expand Up @@ -556,7 +558,9 @@ export default function parse(
.filter(function(setter) {
return setter.priority === priority
})
.reverse()
.sort(function(a, b) {
return b.subPriority - a.subPriority
})
})
.map(function(setterArray) {
return setterArray[0]
Expand Down

0 comments on commit 2a73ae1

Please sign in to comment.