-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comprehensive date conversion #2093
base: main
Are you sure you want to change the base?
Conversation
A mapping of Japanese era dates to Gregorian calendar dates, created using conversion tables sourced from Japanese Wikipedia articles.
The file is renamed to better reflect its expanded scope, as it is going to support comprehensive date conversions, not just year-specific functionality.
This commit starts using the mapping of Japanese era dates to Gregorian calendar dates, enabling comprehensive date conversion. It includes accurate calculation of the time span of years and months for periods predating the adoption of the Gregorian calendar in Japan. Additionally, day-to-day conversion of Japanese era dates to Gregorian calendar dates was added.
f044884
to
dd7c428
Compare
This is amazing 🤩 I'll have a closer look after lunch but at first glance the main concern I have is that the content in |
I had a bit more of a look and it really looks great. Thank you so much for doing this. I think it really would be nice if we can somehow get the
I think (2) might be easier to manage once we have converted the rest of the popup to Preact (since we could wrap up all that async state in its own component) but I'm not sure we want to block merging this on that work. Maybe for now we can sneak in an extra But perhaps we should start by measuring how much that content script actually grows by including |
Thank you for having a closer look! To be honest, I didn't really have any good ideas how to integrate this reasonably large dataset in a nice way into the project, so I'm happy about any feedback in that regard.
According to the compiler output it grows from 664.396 KiB to 1.269 MiB, nearly doubling in size. So it's probably really not a good idea to keep the data there.
I guess, keeping just the era names in a separate
Personally, I would be fine with waiting a little longer and integrating it when the time is right, which would save us from writing potentially hacky code that is going to be removed anyway. However, if you think your proposed solution is easy enough to implement, I'd be happy to give it a try. |
Yes, that does sound like a bit too much.
I agree—I don't think the set of eras is going to change frequently enough that we need to worry about duplicating that information!
Thanks for being so patient. In that case I guess I should probably bump up the priority of the Preact conversion work a notch. Thank you again! |
As I really only want to mess with your priorities and schedule as little as possible, I would offer converting the metadata component myself. If I understand correctly, one can control very fine-grained what parts are using Preact. The problem is, I've never came into contact with React (and Tailwind) before. (Until now, I've been using exclusively Svelte for my reactivity needs.) So, I can't say whether I'll succeed or whether, in the end, it will be more work for you, caused by the need of the reviews being more extensive and detailed than usual. Let me know what you think about that. Aside from that, I've got some general questions about the transition to Preact:
|
In a sense. We've been doing a kind of bottom-up conversion. So we started by converting just one part of the kanji tab, and then its direct sibling, and gradually expanding until we covered the whole kanji entry. I imagine the next step would be to take the name entries and convert them over. Then word entries, then meta data, and then start to stitch it all together so we only have one root
I think you'll find it's not too hard, especially the name entries as they're quite simple and have almost no interactivity. The hardest part is probably the Tailwind part since the setup we're using is a bit funky for two reasons:
I often end up making the component support both Tailwind and the old styles initially and render both options side-by-side to check if they look the same. They don't need to be identical but they should be close.
Oh yeah, that's a major problem. I tried a bunch of ways to get React Cosmos to work with Preact but that was the only one that I could get to work at the time. I recently discovered that
I'm very interested in |
Thank you so much for all this very helpful information!
I started with replacing all hooks with signals in the content script here. I really like using them, managing global app state becomes super easy. The bundles size of the content script still increased about 12KiB, though. It seems like using the signal wrappers for use in components (e.g.
I'm going to start looking into that now :) |
See discussion at #2080.
Summary
This PR introduces a mapping of Japanese era dates to Gregorian calendar dates, enabling comprehensive date conversion.
It includes accurate calculation of the time span of years and months for periods predating the adoption of the Gregorian calendar in Japan.
Additionally, day-to-day conversion of Japanese era dates to Gregorian calendar dates was added.
Fixes #2080.