Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template date doesn't respect date settings #1803

Closed
Nebucatnetzer opened this issue Aug 15, 2019 · 12 comments · Fixed by #1810
Closed

Template date doesn't respect date settings #1803

Nebucatnetzer opened this issue Aug 15, 2019 · 12 comments · Fixed by #1810
Labels
bug It's a bug

Comments

@Nebucatnetzer
Copy link

Nebucatnetzer commented Aug 15, 2019

In version 1.0.165 we got the new template feature, which is great, however I noticed that when I create a simple template to insert the current date it doesn't respect my date settings.

When I insert the template it writes the date as 15/08/2019 instead of 2019-08-15.

The documentation says that it should respect the date settings.

{{date}} | Today's date formatted based on the settings format

The template is really just:

{{date}}
@Nebucatnetzer Nebucatnetzer added the bug It's a bug label Aug 15, 2019
@tessus
Copy link
Collaborator

tessus commented Aug 15, 2019

@CalebJohn ping. ;-) any idea what's happening? I can have a look, but since you added this feature, you might have figured it out a lot faster.

@CalebJohn
Copy link
Contributor

@tessus Thanks for the ping, the issue was that I was setting the templates time format outside a function so it didn't reflect the settings. I've got a pull request to fix it.

@tessus
Copy link
Collaborator

tessus commented Aug 16, 2019

@CalebJohn awesome, thanks.

@Nebucatnetzer
Copy link
Author

Nice thanks for the quick solution.
I'm looking really forward to start using templates :).
Great for reoccurring tasks.

@CollinChaffin
Copy link

@CalebJohn not sure if you PR also fixes, but in 1.0.165 using:

Date: {{date}}

# {{date}}

Renders this in a note I just created today (08-16-2019):

Date: 14/08/2019

# 14/08/2019

So formatting aside, why is it producing the date that Joplin was OPENED, which for me just happened to be two days ago, rather than TODAY'S date as expected? The readme states it would enter current date.

Thanks!

@CalebJohn
Copy link
Contributor

@CollinChaffin You were correct to see that this is indeed the same bug (just a more embarrassing result). What happened was that I was initially building the templates when joplin was first opened. Meaning it wasn't correctly reading settings (because they hadn't loaded yet), but more importantly in your case, it was storing the date that joplin was first opened. The change I made is to rebuild the templates everytime a template is used (don't worry it's not slow) meaning you'll actually get the correct date and time with the proper format.

@Nebucatnetzer
Copy link
Author

Never mind the bugs it's great that we got this feature!
Is there a way to set the title for a note with a template?
Currently I'm working around this by using the first line in the note.

@CalebJohn
Copy link
Contributor

There isn't currently, I wasn't sure what the best format would be. And figured using the first line (as you do) would be sufficient at first. If you have any ideas on how to include the title, I'm open to it!

@CollinChaffin
Copy link

Thanks @CalebJohn I agree with @Nebucatnetzer this for me too has to be the number ONE most exciting new feature and one I'll use daily without question, so I'm glad I wasn't losing my mind and however you fix it is much appreciated! Thanks!

@Nebucatnetzer
Copy link
Author

There isn't currently, I wasn't sure what the best format would be. And figured using the first line (as you do) would be sufficient at first. If you have any ideas on how to include the title, I'm open to it!

Maybe Something like this?

{{ TITLE }}: "Some Title String"

@CollinChaffin
Copy link

@CalebJohn any idea when this associated PR that fixes this might be merged and optionally if that will trigger a new build? TIA!

@tessus
Copy link
Collaborator

tessus commented Aug 27, 2019

@CollinChaffin unfortunately this is impossible to say. The only one who merges PRs (besides translation and documentation PRs) is @laurent22. He's also the only one who can create releases (for desktop and mobile).

@lock lock bot locked and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug It's a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants