Grapeでtimezoneを考慮して日付を返す場合は
この
What is the best way to emulate around_filter
when using Grape?のようにgrapeのbeforeとafterを使って設定するのが定石な気がしますが。
grape-jbuilderでjbuilderの中で書いた日付がbeforeで設定したtimezoneで表示してくれなかったので対応しました。
grapeのendpoint(controllerでいうactionみたいな)で返すとtimezoneが考慮されていますが、jbuilderの中では考慮されていないっぽい。
before -> grapeのendpointの処理 -> after -> jbuilderのrender
という順番で動いているからですね。
苦しいですがrenderの前後にtimezoneを変更するpatchをあてます。
|
|