Skip to content

Commit

Permalink
Fix calendar ref which was causing issues
Browse files Browse the repository at this point in the history
This reference to the calendar function causes issues in many cases.
If you feed the function an epoch date (ms), it would spit out the calendar date of the current time.

This simple change fixes that issue and many others.
  • Loading branch information
GetNameSniped authored Sep 3, 2024
1 parent 5aa273c commit 72488dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/plugin/calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var calendar = require("dayjs/plugin/calendar");

dayjs.extend(calendar);

dayjs().calendar(dayjs("2008-01-01"));
dayjs("2008-01-01").calendar();
dayjs().calendar(null, {
sameDay: "[Today at] h:mm A", // The same day ( Today at 2:30 AM )
nextDay: "[Tomorrow at] h:mm A", // The next day ( Tomorrow at 2:30 AM )
Expand Down

1 comment on commit 72488dd

@GetNameSniped
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old way only caused issues with other input (not the currently provided date). It is not known at the moment why this happens but this pr fixes it.

Best practice is to do it the new way.

Please sign in to comment.