Welcome Guest, Not a member yet? Register   Sign In
Advice on handling date preferences
#1

[eluser]gregormck[/eluser]
Hi there,

I'm building an app at the moment where I want to give users the option to choose their preferred date format. For example:

US users might want 07/28/2012

Where UK users might want 28/07/2012

My preference would be to handle dates regardless of preference in the same format in the controller and in the model - meaning that the controller will push a date to a view in the format of "28/07/2012", but then parse it to "07/28/2012" for a US user (as an example).

When it comes to inputting a date via a date picker for example the user will see "07/28/2012", but the form will post "28/07/2012" meaning I don't need to do any extra server side checks i.e. check date format preference.

Is this the "right" approach to take, or should I look to implement some server side date format preference checks (outside filtering, validation, etc.)?

The app will use dates a lot so I want to implement the right system design - just not sure about the best way to go about handling preferences. Any advice would be much appreciated.

Thanks,

Gregor



Messages In This Thread
Advice on handling date preferences - by El Forum - 07-18-2012, 12:32 PM
Advice on handling date preferences - by El Forum - 07-18-2012, 12:50 PM
Advice on handling date preferences - by El Forum - 07-18-2012, 01:10 PM
Advice on handling date preferences - by El Forum - 07-18-2012, 01:20 PM
Advice on handling date preferences - by El Forum - 07-24-2012, 03:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB