diff --git a/src/App.jsx b/src/App.jsx index 627ccc4..6c12069 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -20,15 +20,19 @@ WebFont.load({ class App extends React.Component { static propTypes = { getNow: PropTypes.func, - weekdays: PropTypes.arrayOf(PropTypes.string), + weekdays: PropTypes.arrayOf( + PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + ])), } static defaultProps = { getNow: () => moment(), weekdays: [ - 'tuesday', - 'thursday', - 'saturday', + 2, + 4, + 6, ], } diff --git a/src/getUpcomingDate.js b/src/getUpcomingDate.js index c3076a3..fdb3727 100644 --- a/src/getUpcomingDate.js +++ b/src/getUpcomingDate.js @@ -1,12 +1,15 @@ import moment from 'moment-timezone'; -export default function getUpcomingDate(now, weekday: String) { +const localTimeZone = moment.tz.guess(); + +export default function getUpcomingDate(now, weekday: String|Number) { let wanted = moment() .tz('CET') .isoWeekday(weekday) .second(0) .minute(0) - .hour(0); + .hour(0) + .tz(localTimeZone); if (wanted.isBefore(now)) { // we want the date from the upcoming week