seanlowe / obsidian-timelines

Create a timeline view of all notes with the specified combination of tags
https://seanlowe.github.io/obsidian-timelines/
MIT License
54 stars 2 forks source link

Issue with Sorting Negative Dates in the Timeline #104

Open jdiagarf opened 1 month ago

jdiagarf commented 1 month ago

Hello,

I wanted to mention that I'm having trouble sorting negative dates.

Here’s the situation: I have a note where I add the following div:

<div class="ob-timelines"
    data-title="December event"
    data-description=""
    data-classes=""
    data-color=""
    data-type=""
    data-start-date="-0218-12"
    data-end-date=""
    data-era="b. C."
    data-path=""
    data-tags="">
    December event
</div>

And another note where I have this div:

<div class="ob-timelines"
    data-title="June event"
    data-description=""
    data-classes=""
    data-color="green"
    data-type=""
    data-start-date="-0218-06"
    data-end-date=""
    data-era="b. C."
    data-path=""
    data-tags="">
    June event
</div>

However, when generating the timeline, the note corresponding to the December event is placed as the oldest, instead of the other way around (see attached screenshot).

screenshot

The code block I have in the note, where I generate the timeline, is as follows:

tags=CustomTag

I would greatly appreciate it if you could review this possible issue. I have spent a considerable amount of time going through the documentation, and unless I'm making a personal mistake, I believe I'm doing everything correctly, but I’m encountering the issue I described.

Thank you in advance.

seanlowe commented 1 month ago

Hmm.. I think I know why this is happening. I convert dates into nirmmalized strings of numbers, in which case -218-12 would be a smaller negative number than -218-6.. I'll look into it. Thanks for creating the issue!

jdiagarf commented 1 month ago

Hmm.. I think I know why this is happening. I convert dates into nirmmalized strings of numbers, in which case -218-12 would be a smaller negative number than -218-6.. I'll look into it. Thanks for creating the issue!

You're very welcome! Thank you for contributing such a valuable plugin to the community. Have a great day!