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

urgency-----Etc/GMT0 is Error #2108

Open
leemoria opened this issue Nov 2, 2022 · 3 comments
Open

urgency-----Etc/GMT0 is Error #2108

leemoria opened this issue Nov 2, 2022 · 3 comments

Comments

@leemoria
Copy link

leemoria commented Nov 2, 2022

current date is “08”,
so after set "hour(0)", date should show "08"

image

date is wrong
but if not 'ETC/GMT' (zero timezone),it is right
such as
Etc/GMT-1
image

not only set hour, set Date is wrong,too.

I compare Momentjs,
image

I'm very anxious for your answer
Thanks very much.

I want to solve this problem in this way. Can you take a look at ?
image

image

@leemoria leemoria changed the title Why Etc/GMT0 is Error urgency-----Etc/GMT0 is Error Nov 8, 2022
@BePo65
Copy link
Contributor

BePo65 commented Nov 9, 2022

fixed by pr #2118

@leemoria
Copy link
Author

leemoria commented Nov 9, 2022

fixed by pr #2118

@BePo65
I tried your modification in the local environment, but it didn't work

Use your Code ,My test:

image

image

@BePo65
Copy link
Contributor

BePo65 commented Nov 10, 2022

The difference between the 2 examples is that the example with 'GMT' creates´a dayjs object with 'utc mode', while the other does not (and should not!).

You should not look at nor use the internal variables (like '$d'), but the documented interface (like '.format()').

So what is the output of day.format()?

Just as a hint (but of course you know all this already 😃):

  • it is better not to use screenshots (that show exactly what is on your screen), but to to write the code into the comment field, as this avoids that people like me have to write the code themself (with all that typos etc.). The output of your tests can be copied e.g. as a comment into the code blocks.
  • using a Date object as an input to dayjs is not the simplest way to get a defined result. It would be easier to use a date and time string like '2022-11-08T08:10:23'

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

2 participants