UI-only formula field not evaluating Date field correctly

  • 1
  • Problem
  • Updated 2 years ago
  • Acknowledged
We have a ui-only Formula(Text) field that's used as a grouping on a chart. The formula is written as follows:

MONTH_NAME_SHORT({{CompletedDate__c}})+" "+DAY({{CompletedDate__c}})+", "+YEAR({{CompletedDate__c}})


For some reason it seems to be evaluated for CompletedDate__c minus one day. For example, if CompletedDate__c = "2015-03-01", then the formula evaluates to Feb 28, 2015.

Do you know why that might be the case?

Thanks,
Kartik Sethuraman
Photo of Kartik Sethuraman

Kartik Sethuraman

  • 798 Points 500 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hello Kartik -

I can't say for certain but the issue you are seeing might be similar or the same as https://community.skuid.com/skuid/topics/datetime-field-not-converting-correctly-based-on-user-timez....

In short, a "Date" field does have a time, it's just always 00:00:00.  Depending on your timezone setting, you would see 3/1/15 become 2/28/15.

Skuid Team - Could this be the same as the issue I mentioned in the other post?
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,220 Points 5k badge 2x thumb
Barry,

Yes, this is the same issue that you have previously brought up. 

Thanks!
Karen
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Good deal, thanks for confirming Karen!
Photo of Kartik Sethuraman

Kartik Sethuraman

  • 798 Points 500 badge 2x thumb
Hey Barry,

It does seem to be the same/similar issue- when I update the user's time zone to a GMT +X timezone, the dates are displaying correctly. The strange part to me though is that there's any time zone conversion happening at all for a date field. Especially since Skuid stores the date values as "2015-03-01" in the underlying model without any 0s for the time portion.

Thanks for the additional information! Hopefully the fix that's on its way for the issue you reported will resolve this one as well.

Thanks,
Kartik
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hey Kartik -

I updated my post with a link back to this post just to help ensure all scenarios are covered (date & datetime fields).

It's been a while since I dug in to the way skuid processes merge fields, etc. but I think the reason you are seeing this behavior even with date fields is that skuid converts the field value to its "data type" (in this case JS date object) via it's APIs in the skuid.time object, then formats it when outputting merge syntax, field renders, etc.  Since the javascript date object includes a time, it falls prey to the timezone issue. 
Photo of Kartik Sethuraman

Kartik Sethuraman

  • 798 Points 500 badge 2x thumb
Ahh that would make sense- thanks for the help!
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,220 Points 5k badge 2x thumb
Kartik~

I have been able to reproduce the error you described and have notified our developers of this bug. Thanks for reporting this to us!

Thanks!
Karen