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

Comments

@Nebucatnetzer
Copy link

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}}
@tessus

This comment has been minimized.

Copy link
Collaborator

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

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2019

@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

This comment has been minimized.

Copy link
Collaborator

commented Aug 16, 2019

@CalebJohn awesome, thanks.

@Nebucatnetzer

This comment has been minimized.

Copy link
Author

commented Aug 16, 2019

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

@CollinChaffin

This comment has been minimized.

Copy link

commented Aug 16, 2019

@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

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2019

@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

This comment has been minimized.

Copy link
Author

commented Aug 16, 2019

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

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2019

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

This comment has been minimized.

Copy link

commented Aug 17, 2019

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

This comment has been minimized.

Copy link
Author

commented Aug 18, 2019

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

This comment has been minimized.

Copy link

commented Aug 27, 2019

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

@tessus

This comment has been minimized.

Copy link
Collaborator

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).

laurent22 added a commit that referenced this issue Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.