baramofme / notion-gcal-sync-appsscript

0 stars 0 forks source link

Add time in Users Timezone when during time conversion #19

Open baramofme opened 1 month ago

baramofme commented 1 month ago

image

image

first no timezone. second, during sync, add time by UTC. finally, notion display datetime as UTC.

Users can't calucate everytime. It's so confused

baramofme commented 1 month ago

first, timezone offset adjustment failed.

I misunderstoold.there's diferrences between my computer and google apps script location(GCP).

getTimezoneOffset is give me differecese between UTC and GCP server timezone. Not original time's timezone.

and There's no way to convert it ..??

I'm not alone

baramofme commented 1 month ago

There is no method make new Date().getTime() spit out millisecnods with user set Timezone.

No? Doesn't matter. too many times spend. It's not good for my real life. debugging ruins my life ...

OK, I choose easy way, cheat Date() object.

input time striong aprt from timezone part.

> new Date( '2024-08-08T15:54:00.000+09:00')
2024-08-08T06:54:00.000Z
>  new Date( '2024-08-08T15:54:00.000Z')
2024-08-08T15:54:00.000Z
>  new Date( '2024-08-08T15:54:00.000Z').toISOString()
'2024-08-08T15:54:00.000Z'
>  new Date( '2024-08-08T15:54:00.000Z').toISOString().replace( "Z", "+09:00")
'2024-08-08T15:54:00.000+09:00'

see? and working.

baramofme commented 1 month ago

Use longOffsetFormatter and LongOffseString to extract timezone part from date String

baramofme commented 1 month ago

Fixed