generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 241
update date format to YYYY-MM-DD-HH-mm and support review before due #614
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -275,7 +275,7 @@ export default class SRPlugin extends Plugin { | |
| }; | ||
|
|
||
| const now = window.moment(Date.now()); | ||
| const todayDate: string = now.format("YYYY-MM-DD"); | ||
| const todayDate: string = now.format("YYYY-MM-DD-HH-mm"); | ||
| // clear bury list if we've changed dates | ||
| if (todayDate !== this.data.buryDate) { | ||
| this.data.buryDate = todayDate; | ||
|
|
@@ -364,7 +364,7 @@ export default class SRPlugin extends Plugin { | |
| } | ||
|
|
||
| const dueUnix: number = window | ||
| .moment(frontmatter["sr-due"], ["YYYY-MM-DD", "DD-MM-YYYY", "ddd MMM DD YYYY"]) | ||
| .moment(frontmatter["sr-due"], ["YYYY-MM-DD-HH-mm", "YYYY-MM-DD", "DD-MM-YYYY", "ddd MMM DD YYYY"]) | ||
| .valueOf(); | ||
|
|
||
| for (const matchedNoteTag of matchedNoteTags) { | ||
|
|
@@ -511,7 +511,7 @@ export default class SRPlugin extends Plugin { | |
| delayBeforeReview = | ||
| now - | ||
| window | ||
| .moment(frontmatter["sr-due"], ["YYYY-MM-DD", "DD-MM-YYYY", "ddd MMM DD YYYY"]) | ||
| .moment(frontmatter["sr-due"], ["YYYY-MM-DD-HH-mm", "YYYY-MM-DD", "DD-MM-YYYY", "ddd MMM DD YYYY"]) | ||
| .valueOf(); | ||
| } | ||
|
|
||
|
|
@@ -527,7 +527,7 @@ export default class SRPlugin extends Plugin { | |
| ease = schedObj.ease; | ||
|
|
||
| const due = window.moment(now + interval * 24 * 3600 * 1000); | ||
| const dueString: string = due.format("YYYY-MM-DD"); | ||
| const dueString: string = due.format("YYYY-MM-DD-HH-mm"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest that the time component is only included if necessary. This would keep the HTML commands in the current format, and only the longer format when needed. |
||
|
|
||
| // check if scheduling info exists | ||
| if (SCHEDULING_INFO_REGEX.test(fileText)) { | ||
|
|
@@ -815,7 +815,7 @@ export default class SRPlugin extends Plugin { | |
| this.deckTree.insertFlashcard([...deckPath], cardObj); | ||
| } else if (i < scheduling.length) { | ||
| const dueUnix: number = window | ||
| .moment(scheduling[i][1], ["YYYY-MM-DD", "DD-MM-YYYY"]) | ||
| .moment(scheduling[i][1], ["YYYY-MM-DD-HH-mm", "YYYY-MM-DD", "DD-MM-YYYY"]) | ||
| .valueOf(); | ||
| const nDays: number = Math.ceil((dueUnix - now) / (24 * 3600 * 1000)); | ||
| if (!Object.prototype.hasOwnProperty.call(this.dueDatesFlashcards, nDays)) { | ||
|
|
@@ -847,7 +847,7 @@ export default class SRPlugin extends Plugin { | |
| continue; | ||
| } | ||
|
|
||
| if (dueUnix <= now) { | ||
| if (dueUnix <= now + this.data.settings.reviewBeforeDue * 24 * 3600 * 1000) { | ||
| cardObj.interval = interval; | ||
| cardObj.ease = ease; | ||
| cardObj.delayBeforeReview = now - dueUnix; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the
YYYY-MM-DD HH:mmformat better and more readable?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably suggest using one of the ISO 8601 formats, e.g.
YYYY-MM-DDTHH:mm(i.e. the literal T between the date and time)