任何可以解析Intl.DateTimeFormat创建的字符串的javascript库?

任何可以解析Intl.DateTimeFormat创建的字符串的javascript库?,javascript,Javascript,是否有javascript库可以解析Intl.DateTimeFormat创建的字符串并给出日期 例如: options = { year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", weekday: "short", } var test_date = new Date(); cons

是否有javascript库可以解析Intl.DateTimeFormat创建的字符串并给出日期

例如:

  options = {
      year: "numeric",
      month: "short",
      day: "numeric",
      hour: "numeric",
      minute: "numeric",
      weekday: "short",
      }
  var test_date = new Date();
  console.log(new Intl.DateTimeFormat('hr', options).format(test_date));
  // note that test_date is just an example. 
  // We need to parse text created Intl.DateTimeFormat and give a Date.
将返回:

sub, 21. ožu 2020. 12:41
这是伟大的-它应该如何写

但是如何将它解析回日期呢

比如:

 Date.parse('sub, 21. ožu 2020. 12:41', options, 'hr') 
 // hr is locale
 // options are same a options given to Intl.DateTimeFormat
我们尝试了momentjs和'llll'格式,但遗憾的是momentjs语言环境与Google Chrome上的Intl.DateTimeFormat实现不同(即,点添加在错误的位置,日期缩写不正确,等等)。我们用“hr”、“sk”和其他几个词进行了测试,但没有运气:(


那么,是否有任何可以解析Intl.DateTimeFormat创建的字符串的javascript库?

@StefanAvramovic我们想解析它回到最新的对象。我已经更新了这个问题。你为什么需要解析它?只需保留
test\u Date
@kosh test\u Date只是一个例子。无论如何,重点是我们是parsing不是由我们的javascript创建的(即作为扩展运行或执行文本抓取)。看起来您的问题缺少这些细节。如果该文本不是由您创建的,您怎么会认为它是使用
Intl.DateTimeFormat
创建的?如果您正在进行扩展或抓取(具体是什么?),可能还有其他方法。请更新您的问题以更好地描述您的情况。