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(
|
const timestampToEventEndpoint = urlJoin(
|
||||||
matrixServerUrl,
|
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 timestampToEventResData = await fetchEndpoint(timestampToEventEndpoint);
|
||||||
const eventIdForTimestamp = timestampToEventResData.event_id;
|
const eventIdForTimestamp = timestampToEventResData.event_id;
|
||||||
assert(eventIdForTimestamp);
|
assert(eventIdForTimestamp);
|
||||||
|
console.log('eventIdForTimestamp', eventIdForTimestamp);
|
||||||
|
|
||||||
const contextEndpoint = urlJoin(
|
const contextEndpoint = urlJoin(
|
||||||
matrixServerUrl,
|
matrixServerUrl,
|
||||||
|
|
|
@ -89,7 +89,11 @@ class CalendarView extends TemplateView {
|
||||||
t.input({
|
t.input({
|
||||||
type: 'month',
|
type: 'month',
|
||||||
className: { CalendarView_heading_monthInput: true },
|
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),
|
onChange: (e) => vm.onMonthInputChange(e),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -156,10 +160,6 @@ class CalendarView extends TemplateView {
|
||||||
// day number from 0 (monday) to 6 (sunday)
|
// day number from 0 (monday) to 6 (sunday)
|
||||||
const dayNumber = dayNumberDate.getUTCDay();
|
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`
|
// +1 because we're going from 0-based day to 1-based `grid-column-start`
|
||||||
const gridColumnStart = dayNumber + 1;
|
const gridColumnStart = dayNumber + 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue