Javascript中的strptime [英] strptime in Javascript

查看:139
本文介绍了Javascript中的strptime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个日期输入字段,该字段允许用户输入日期,并且我需要验证此输入(我已经进行了服务器端验证),但是技巧是格式取决于语言环境.我已经有一个将strptime格式字符串转换为用户首选项的系统,并且我想在JavaScript端使用相同的格式进行验证.

I have a date input field that allows the user to enter in a date and I need to validate this input (I already have server side validation), but the trick is that the format is locale dependent. I already have a system for translating the strptime format string to the the user's preference and I would like to use this same format for validating on the Javascript side.

是否有任何想法或指向Java中strptime()实现的链接?

Any ideas or links to a strptime() implementation in Javascript?

推荐答案

搜索了几天后,我发现该实现,尽管还不完整,但似乎可以处理我目前遇到的所有情况.

After a few days of googling I found this implementation which, although not complete, seems to handle all of the cases I have right now.

这篇关于Javascript中的strptime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆