mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 13:24:19 +00:00
Pad single-digit months, days, and minutes with a leading zero
This commit is contained in:
parent
ab5db0bc1e
commit
0a37d40fad
1 changed files with 4 additions and 4 deletions
|
@ -24,13 +24,13 @@ pub fn new_journal_entry(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
|
|||
|
||||
let journal_dir = home_dir.join("journal");
|
||||
let month_dir = journal_dir
|
||||
.join(now.year().to_string())
|
||||
.join(now.month().to_string());
|
||||
let entry_path = month_dir.join(format!("{}.md", now.day()));
|
||||
.join(format!("{:2}", now.year()))
|
||||
.join(format!("{:2}", now.month()));
|
||||
let entry_path = month_dir.join(format!("{:2}.md", now.day()));
|
||||
let now = now.time();
|
||||
let (pm, hour) = now.hour12();
|
||||
let am_or_pm = if pm { "PM" } else { "AM" };
|
||||
let entry_heading = format!("# {}:{} {}\n\n", hour, now.minute(), am_or_pm);
|
||||
let entry_heading = format!("# {}:{:2} {}\n\n", hour, now.minute(), am_or_pm);
|
||||
|
||||
let create_entry = cx.background().spawn(async move {
|
||||
std::fs::create_dir_all(month_dir)?;
|
||||
|
|
Loading…
Reference in a new issue