renderDT format Date (french date)

Hi everyone,

I would like to know if there is a way to convert dates ("2020-06-26") in french date ("26-06-2020").
Keeping the as.Date() date format.

I read i can convert with format(x,"%d/%m/%Y")), but results appears in characters.
Problematic in my case cause i would like to filter dates in my shiny app with a renderDT output.

So, my expected result would be to have the following result but in french date.
If i use format(), i lose the slider to define periods in filter (because characters).

slider

I think if your 'locale' is set to France, then this would work.

library(DT)
#example data
x = strptime('2015-07-23 22:05:21', '%Y-%m-%d %H:%M:%S', tz = 'EST')
(x = x + seq(1, 1e6, length.out = 5))
d = data.frame(toLocaleDateString = x )

    datatable(d) %>%  
      formatDate(1,'toLocaleDateString')

# use DT:::DateMethods below to see the possible methods aside from toLocaleDateString
1 Like

Works good, thanks a lot, the slidebar is OK, and date appears in french format.

Remains one problematic, the "text filter" above remains with the standard format

SlideBarOK

I can't help you with that I'm afraid, could probably be addressed with javascript but my knowledge is far more on R than javascript.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.