org-scn-design-studio-community / sdkpackage

SDK Package of SCN Design Studio Community
Apache License 2.0
32 stars 29 forks source link

REALDATE can't handle February and formatWithMask always gets the previous day #185

Open donralz opened 6 years ago

donralz commented 6 years ago

Hey..` not sure if anyone checks this anymore, but I'm hitting some major errors with REALDATE.

(FYI. I'm posting with on March 30th, 2018)

Using the following code:

REALDATE_1.initializeWithInternalDate(APPLICATION.getInfo().dateNowInternalFormat);
APPLICATION.alert("normal: " + REALDATE_1.format("YYYYMMDD"));   // Returns 20180330 - as expected
APPLICATION.alert("Format with mask: " + REALDATE_1.formatWithMask("mmm d, yyyy"));  // Returns March 29, 2018 - always the previous date)

Not sure why, but when I use formatWithMask, it always gets the day before the date that comes back with all the other functions.

However, I can accommodate for that.... this next one is a mind trip though. Using the following code:

REALDATE_1.initializeWithInternalDate("20180215");
APPLICATION.alert("normal: " + REALDATE_1.format("YYYYMMDD"));  // returns 2018**03**15  - I put February 15th, and ended up with March 15th?
APPLICATION.alert("Format with mask: " + REALDATE_1.formatWithMask("mmm d, yyyy")); //  returns Mar 14, 2018 -- Also in March (and of course, the previous date)?!

I haven't tried every day in February, but most of them are coming back wrong. What gives?!