TypeORMでPostgreSQLのtimestamp without timezoneから取得したUTC時刻がOSタイムゾーン分ズレたら
無理やり矯正するtransformerを@Column
に指定してみた
transformer: {
to: (value: Date) => {
if (value) {
value.setMinutes(value.getMinutes() + value.getTimezoneOffset());
}
return value;
},
from: (value: Date) => {
if (value) {
value.setMinutes(value.getMinutes() - value.getTimezoneOffset());
}
return value;
},
},
たぶん https://qiita.com/tokicat/items/534aba8f0f3e86870d62 の方がちゃんとしてる
Author And Source
この問題について(TypeORMでPostgreSQLのtimestamp without timezoneから取得したUTC時刻がOSタイムゾーン分ズレたら), 我々は、より多くの情報をここで見つけました https://qiita.com/pilot/items/947b6ca5f8ba1f6de04f著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .