Skip to content

Commit 5a0bea1

Browse files
emmatownBrandon Dail
authored andcommitted
fix(parsing) Fix rendering Sundays
1 parent 712310d commit 5a0bea1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

__test__/index.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,8 @@ describe('tinytime', () => {
6868
'It was 9:07:30PM on September 24th, 1992.'
6969
)
7070
});
71+
it('sundays', () => {
72+
expect(tinytime('{dddd}').render(new Date('May 7, 2017'))).toEqual('Sunday')
73+
});
7174
});
7275
});

src/compiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ const months: Array<Month> = [
4242
]
4343

4444
const days: Array<Days> = [
45+
"Sunday",
4546
"Monday",
4647
"Tuesday",
4748
"Wednesday",
4849
"Thursday",
4950
"Friday",
5051
"Saturday",
51-
"Sunday",
5252
]
5353

5454
/**
@@ -120,7 +120,7 @@ export default function compiler(tokens: Array<Token>, date: Date, options: Tiny
120120
compiled += (year + '').slice(2);
121121
break;
122122
case DayOfTheWeek:
123-
compiled += days[date.getDay() - 1];
123+
compiled += days[date.getDay()];
124124
break;
125125
case DayOfTheMonth:
126126
compiled += options.padDays ? paddWithZeros(day) : day

0 commit comments

Comments
 (0)