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.

`toRelativeCalendar` doesn't really work like you'd expect

See original GitHub issue

This is a little funny:

base = DateTime.local(2018, 12, 31);
base.plus({ days: 1 }).toRelativeCalendar({base}) //=> "next year"

This is technically correct, but I suspect most people would want that to say “tomorrow”. Same issue with the end of months.

The question is: when should it say next year?

  1. whenever it is next year? (current behavior)
  2. never?
  3. When it’s over 1 year in the future? (this is pretty weird IMO; in our 12/31 example, it would only say “next year” for one day at the end of next year")
  4. when it’s over N months in the future? For what N?

Same problem for months. And I haven’t even introduced weeks, which is surely similar.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:6
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
icambroncommented, Jan 1, 2020

Yes, we need a spec. I like the idea that the threshold matches the size of the unit. I don’t like the idea of overrides because I think it would be a confusing API. We can always add it later but we can’t take it back once we do. So I’d like to make this change without expanding the API surface area.

I don’t think this really requires a major version bump, either.

1reaction
Doaa-Ismaelcommented, Aug 31, 2021

It happens with me also … Is there any plan to fix it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

luxon 3.1.1 | Documentation
To create one from a native JS date, use DateTime.fromJSDate. Gregorian calendar and time: To examine the Gregorian properties of a DateTime individually...
Read more >
The Complete Guide to Day.js - Mirza Leka - Medium
Basically, it allows us to pass the date format and locale into the Day.js object. import * as customParseFormat from 'dayjs/plugin/ ...
Read more >
datetime - Calculate relative time in C# - Stack Overflow
As time passes, the timestamps will automatically update. ... called Humanizr on Nuget, and it actually works really well, and is in the...
Read more >
Reviews: Zookeeper - IMDb
A family comedy that doesn't work ... The Waterboy and Click, all starring Adam Sandler, to relative duds like Around the World in...
Read more >
Publication 523 (2021), Selling Your Home - IRS
Effective December 22, 2017, section 1400Z-2 provides a temporary ... as time you lived at home (even if you rented out your home...
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