Comments (1)
Welcome, luigar!
First of all, excuse me for my belated response; it's been a complicated time!
After having a look at the code (as well as my pictures and dates), I must admit I never encountered the problem you're experiencing. That's why, after thinking of it, I concluded that it might be related to different time zones, as I kept in mind Europe/Madrid (Barcelona, to be more specific), but I didn't consider other options.
In all honesty, the getRelativeTimeString
function might be potentially problematic due to the way it handles dates and times - especially when it comes to different time zones. Could you please give the following alternative a try and tell me if it solves your problem?
export const getRelativeTimeString = (date: string) => {
const parsedDate = DateTime.fromISO(date, { zone: 'utc' }); // You'll have to explicitly set the zone here.
const relativeTime = parsedDate.toRelative();
// Formatting the date in a specific time zone might help, too. Let's say 'Europe/London' here, for instance.
const formattedDate = parsedDate.setZone('Europe/London').toLocaleString(DateTime.DATETIME_MED);
return `${relativeTime} (${formattedDate})`;
}
Perhaps we should explicitly handle time zones when parsing and formatting dates for more consistent behavior.
Let me know if it works for you; if that's not the case, we'll look for another solution!
Best wishes,
Judit
from takeyouthere.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from takeyouthere.