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

ISO date in filename template is yesterdays date #736

Closed
account-sxf opened this issue Aug 3, 2021 · 5 comments
Closed

ISO date in filename template is yesterdays date #736

account-sxf opened this issue Aug 3, 2021 · 5 comments

Comments

@account-sxf
Copy link

@account-sxf account-sxf commented Aug 3, 2021

Describe the bug
I'm using this template for filename: {year-locale}/{date-iso}/{page-title}.html

However, the folder name generated by date-iso is (@ 10 am my time) for the previous day, not today. E.g. today is 2021-08-04 but the folder used/generated is 2021-08-03

Environment

  • OS: Win 10 Version 1909 (OS Build 18363.1679) - corporate machine
  • Browser: Firefox 90.0.2 (64-bit)

Additional context
Tried restarting Firefox as I wondered if the date is determined at init. No luck.
Love the plugin and plan to use it all the time, superb.

@account-sxf account-sxf changed the title ISO date is delayed by a day so folder is for yesterday, not today ISO date in filename template is yesterdays date Aug 3, 2021
@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Aug 5, 2021

The ISO date is the one returned by this function: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString. The timezone is always zero UTC offset.

Why don't you use {date-locale} instead?

@account-sxf
Copy link
Author

@account-sxf account-sxf commented Aug 11, 2021

I just prefer YYYY-MM-DD as ordering the created folder/files by filename will yield a correct order by date, but mostly it's an aesthetic thing. Happy for you to close if you don't have plans to add any more template options. I might see how it works, perhaps it's pretty trivial to add some more and you can merge if you like them.

Just comparing the look of these:
image

In some similar projects the developer provides a way for the user to specify their own date string with format specifiers of their choosing etc. I believe this is where I saw it:
https://github.com/dcurtis/markdown-mark

It uses:
https://momentjs.com/docs/#/displaying/format/

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Aug 15, 2021

What about {year-utc}-{month-utc}-{day-utc} or {year-locale}-{month-locale}-{day-locale}?

@account-sxf
Copy link
Author

@account-sxf account-sxf commented Aug 22, 2021

Oh I didn't realize I could do that. Very flexible! Just tested it out and that's perfect. Closing my dumb query now :)

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau commented Aug 22, 2021

Glad to hear it fulfill your needs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants