GWT: use DateTimeFormat on client and SimpleDateFormat on server

后端 未结 5 834
无人及你
无人及你 2020-12-17 09:34

I have a function that must work the same way on both client and server and it formats dates.

if (GWT.isClient())
{
  // Use DateTimeFormat
} else {
  // Use         


        
5条回答
  •  情歌与酒
    2020-12-17 10:20

    You have to tell Eclipse not to compile your super-source'd Java file. If you're using Maven, it's simply a matter of moving it to src/main/resources; otherwise, exclude your 'jre' package from Eclipse's build path.

    ...that being said, I'd rather super-source the class the uses the SimpleDateFormat/DateTimeFormat, and/or move that to a helper class that you'd super-source.

提交回复
热议问题