question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with documentation for isSameYear function

See original GitHub issue

There is an issue with the documentation for isSameYear function

The documentation does not show the third parameter for options, there for this returns false because the week does not starts on monday

The problem

💻 Code demonstrating the problem

import isSameYear from 'date-fns/isSameYear'

const start = new Date("2021-12-28") // a monday
const end = new Date("2022-01-02") // a sunday

🙁 Actual behavior

console.log(_.isSameWeek(start, end))
false

🙂 Expected behavior

console.log(_.isSameWeek(start, end), { weekStartsOn: 1 })
true

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fturmelcommented, May 31, 2022

@bjornwiberg I think you made a simple mistake here, Dec 28 2021 was a Tuesday and not a Monday. (EDIT: that wasn’t particularly relevant to the issue though, adding more details).

import { isSameWeek } from "date-fns";

const start = new Date(2021, 11, 27); // a Monday
const end = new Date(2022, 0, 2); // a Sunday

console.log(isSameWeek(start, end, { weekStartsOn: 1 })); // week starts on Monday
// true
image
console.log(isSameWeek(start, end)); // week starts on Sunday by default
// false
image
0reactions
bjornwibergcommented, Jun 1, 2022

yes i think thats the case

Read more comments on GitHub >

github_iconTop Results From Across the Web

date-fns - modern JavaScript date utility library
date-fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js. Documentation.
Read more >
Code documentation — Quality Assurance of ... - GitHub Pages
When your code is structured as functions or classes, these functional units can be efficiently documented using docstrings. Docstrings are specialised multi- ...
Read more >
Importance of Documentation | The Workstream - Atlassian
Companies that use documentation to catalog past projects, collect research, and share decisions benefit by reducing re-work that wastes precious time you ...
Read more >
Integrity of the Healthcare Record: Best Practices for EHR ...
This practice brief provides guidance for maintaining documentation integrity while using automated EHR functions. Ensuring Documentation Integrity.
Read more >
Principles for Nursing Documentation
These enduring issues inform and underline the principles and recommendations in this publication. © 2010 American Nurses Association. All rights reserved. No ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found