-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
no way to format time-picker value to utc/gmt (instead of local time) #293
Comments
So after researching some more I found that by simply stripping the UTC timezone information (
This is what I'm using to convert the date string ( parseInt(format(parseISO(value.slice(0, -1)), 'T'), 10) ( I tested changing hour/timezone on my pc and the time stays the same (as intended) |
As far as I understand, you only want to format time to utc? Or you want to select time (hours, minute, second) as utc. |
Please provide a format pattern string & expected output string. |
let's take this timestamp:
|
You want to click at 9 AM (GMT) and get 9 AM (GMT) or click at 10 AM (local) and get 9 AM (GMT)? |
when I click 9 am I want to get 9 am. When I put a value in the vmodel I want it to be that value and not be changed to my local time. Basically what I want is a dumb time picker, that works like a dropdown. No conversions |
You can make a function for this that will set the value of your component in hours & minutes
|
Hi so have been having the same problem because I this gets the local time (with the +1 hour) right from the start but i found another way to solve this issue, I simply used value-format and formatted-value.
just posting here for the next person needing help on this matter :) |
|
@07akioni Can you add the same for a date picker? |
TuSimple/naive-ui version (版本)
2.14.0
Vue version (Vue 版本)
3.1.2
Browser and its version (浏览器及其版本)
Chrome 91.0.4472.114
System and its version (系统及其版本)
Windows 10
Node version (Node 版本)
Reappearance link (重现链接)
https://codesandbox.io/s/cool-monad-7we80?file=/src/Demo.vue
Reappearance steps (重现步骤)
Observe the formatted value
Expected results (期望的结果)
Being able to set the format to utc/gmt
Actual results (实际的结果)
The value is formatted using the user local time
Remarks (补充说明)
Here's a discussion about date-fns and utc formatting: date-fns/date-fns#1401
The text was updated successfully, but these errors were encountered: