Make sure input value is zero padded to parse properly
This commit is contained in:
parent
652b96950b
commit
7d95681611
|
@ -14,11 +14,12 @@ async function fetchEventsForTimestamp(roomId, ts) {
|
|||
|
||||
const timestampToEventEndpoint = urlJoin(
|
||||
matrixServerUrl,
|
||||
`_matrix/client/unstable/org.matrix.msc3030/rooms/${roomId}/timestamp_to_event?ts=${ts}&dir=f`
|
||||
`_matrix/client/unstable/org.matrix.msc3030/rooms/${roomId}/timestamp_to_event?ts=${ts}&dir=b`
|
||||
);
|
||||
const timestampToEventResData = await fetchEndpoint(timestampToEventEndpoint);
|
||||
const eventIdForTimestamp = timestampToEventResData.event_id;
|
||||
assert(eventIdForTimestamp);
|
||||
console.log('eventIdForTimestamp', eventIdForTimestamp);
|
||||
|
||||
const contextEndpoint = urlJoin(
|
||||
matrixServerUrl,
|
||||
|
|
|
@ -89,7 +89,11 @@ class CalendarView extends TemplateView {
|
|||
t.input({
|
||||
type: 'month',
|
||||
className: { CalendarView_heading_monthInput: true },
|
||||
value: `${calendarDate.getUTCFullYear()}-${calendarDate.getUTCMonth() + 1}`,
|
||||
value: `${calendarDate.getUTCFullYear()}-${
|
||||
// ('0' + '2') -> '02'
|
||||
// ('0' + '12') -> '12'
|
||||
('0' + (calendarDate.getUTCMonth() + 1)).slice(-2)
|
||||
}`,
|
||||
onChange: (e) => vm.onMonthInputChange(e),
|
||||
}),
|
||||
|
||||
|
@ -156,10 +160,6 @@ class CalendarView extends TemplateView {
|
|||
// day number from 0 (monday) to 6 (sunday)
|
||||
const dayNumber = dayNumberDate.getUTCDay();
|
||||
|
||||
console.log(
|
||||
`dayNumberDate=${dayNumberDate.getUTCDate()} (${dayNumber}) isDayInFuture=${isDayInFuture}, ${dayNumberDate.getTime()}, ${todayTs}`
|
||||
);
|
||||
|
||||
// +1 because we're going from 0-based day to 1-based `grid-column-start`
|
||||
const gridColumnStart = dayNumber + 1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue