Skip to content
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

[Reacticket] - zero-padded {year}{month}{day}{hour}{minute} - bug? #67

Open
CruxCraft opened this issue Nov 2, 2021 · 0 comments
Open

Comments

@CruxCraft
Copy link

CruxCraft commented Nov 2, 2021

{year}{month}{day}{hour}{minute}
produced:
2021112165

I don't know if that is saying it is Nov 2nd at 1:65 (65?)
OR if it is saying it is more likely saying Nov 2nd at 16:05 (more likely)

I could try adding separators just to see what it was intending to say, but all of those scenarios have flaws regardless

If you get the time, could you make it so that months, days, hours, & minutes have the preceding zero? So that January 7th @ 8:05am would be 2022 01 07 0805

datetime.today().strftime('%Y-%m-%d-%H:%M:%S')
'2022-01-07-08:05:59'

Could even add those seconds in if you wanted, if it's not too much trouble =]

EDIT:

        channel_name = (
            guild_settings["presetname"]["presets"][guild_settings["presetname"]["chosen"]]
            .replace("{user}", user.display_name)
            .replace("{userid}", str(user.id))
            .replace("{julian}", now.strftime("%j"))
            .replace("{year}", now.strftime("%Y"))
            .replace("{year_short}", now.strftime("%y"))
            .replace("{month}", now.strftime("%m"))
            .replace("{month_name}", now.strftime("%B"))
            .replace("{month_abr}", now.strftime("%b"))
            .replace("{day}", now.strftime("%d"))
            .replace("{day_name}", now.strftime("%A"))
            .replace("{day_abr}", now.strftime("%a"))
            .replace("{hour}", now.strftime("%H"))
            .replace("{minute}", now.strftime("%M"))
            .replace("{second}", now.strftime("%S"))
            .replace("{tzone}", now.strftime("%Z"))
            .replace("{random}", str(random.randint(1, 100000)))
        )[:100]

I looked at the source, & I think that would fix it... also added the julian date, abbreviated months & days, and short year

EDIT2: fixed my errors
I edited my local file and tested... works great!!

EDIT3:
I fumbled my way through my first pull request on Github. I think I tripled the number of steps it should have taken ¯_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant