Allow input or scroll by year in Date picker

Date Picker is hard to use when I wanna choose a date long time ago.

  • Set preferred date format as ‘EEE, MM/dd/yyyy’
  • Try to refer journal in page, using date picker to pick a date long time ago, it will need scroll many times

It’s preferred can scroll by year to pick a old date quickly.

I’m surprised this isn’t more voted for, because if you like seeing the day of the week in your journal (if the date format includes EEE), you need an external calendar to link to a date. (Quick, how would you link to New Year’s Eve 1999? I don’t think you would open the date picker and click the arrow 280 times.

It would be good to either enhance the date picker, or allow some universal date format in links that does not include the day of week (so we could write something like [[19991231]]).

1 Like

or allow some universal date format in links that does not include the day of week (so we could write something like [[19991231]]).

This is supported. It’s in the Settings. If your desired format is not in the dropdown list, you can also edit config.edn directly.

Then you can use custom.js to show the day of the week in journals: Show week day and week number

I was under the impression that custom.js was removed. Are you still successfully using it on a recent build? If so I’ll definitely give that a try.

yes. it doesn’t matter if there’s no such file under /logseq, you can just create it :slight_smile:

By the way, here is the custom.js I used to successfully add the day of week to journals. Note that for a different date format input, the regular expression might need to be changed, as well as the line that constructs the Date.

function insertInfo() {
	var journalTitles = document.querySelectorAll("span.title") // in page view this will find the page title
	if (journalTitles.length == 0)
		journalTitles = document.querySelectorAll("h1.title") // in journals view, this will find all visible journal titles
	for (let t of journalTitles) {
		addWeekday(t)
	}
}

const re = /^(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\w* \d+(?:st|nd|rd|th)?,? \d{2}\d{2}?$/;
const options = { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' };

function addWeekday(t) {
	const dateRegexMatch = re.exec(t.textContent);
	if (!!dateRegexMatch) {
		const d = new Date(Date.parse(t.textContent));
		t.innerHTML = d.toLocaleDateString("en-US", options);
	}
}
var t = setInterval(insertInfo, 400);

It’s unfortunate that I need to do this, but it’s a hack that works.