Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix roundtrip bug with d/EEEE ordering in formats like PPPPP #1795

Merged
merged 15 commits into from Jul 17, 2020
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