Last 12 weeks · 0 commits
2 of 6 standards met
Repository: vercel/little-date. Description: A friendly formatter to make date ranges small & sweet Stars: 1963, Forks: 20. Primary language: TypeScript. Languages: TypeScript (100%). License: MIT. Latest release: v1.2.1 (3mo ago). Open PRs: 4, open issues: 4. Last activity: 3mo ago. Community health: 50%. Top contributors: timolins, hood, eltociear, feugy.
I couldn't find any linked page to the repo. It would be nice if there was a dedicated page that shows examples of the different date pickers.
The function currently uses minute precision to determine if a date range spans a full year. However, an issue arises when the end date is set to the start of the day (00:00:00) or other minutes, rather than 59 on the final date of the range. To accurately identify a full-year range, the function requires the end time to be 23:59:59. To improve accuracy, it's necessary to ignore the minute precision check for year-long ranges. Example When formatting a range from: Start Date: Mon Jan 01 2024 00:00:00 End Date: Tue Dec 31 2024 00:00:00 The function incorrectly formats this as a month range "Jan 1 - Dec 31" instead of "2024". This is because the function expects the end time to be exactly 23:59:59. Suggested Fix Update the code to skip minute-level checks for year and month ranges. Use broader checks like instead. Current Code: Updated Code: In addition to the year-long ranges, similar adjustments are needed for other periods such as months and quarters. The same approach can be applied to handle these periods more accurately.
Issue description Passing locale to the formatDateRange function only localizes time part of the range, date part remains in english. As a note. I'm also using with its localization, works good. Version: Recreate the bug: Insights After checking source code of the , i've found out that locale that passed into is only used for time formatting () and default function is used from . Locale needs to be passed to function too. At least, that's how I solved by modifying code locally.