我可以使用以下代码在HTML中显示时区:
<span class="match-date">
{{match.match_date | date:'fullDate'}} at {{match.match_date | date:'shortTime'}} {{match.match_date | date:'Z'}}
</span>
导致:
Saturday, October 22, 2016 at 5:00 PM -0500
但是我希望它显示时区名称而不是偏移量,如下所示:
Saturday, October 22, 2016 at 5:00 PM CDT
我该如何做到这一点?
答案 0 :(得分:1)
这是一个使用角度矩的答案,
<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.0.8" data-semver="1.0.8" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<script data-require="moment.js@2.1.0" data-semver="2.1.0" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.1.0/moment.min.js"></script>
<!--<script src="angular-moment.min.js"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-moment/1.0.0/angular-moment.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app="app">
<div ng-controller="TestCtrl">
<h1>Hello Plunker!</h1>
<pre>{{ obj.dateStr | amDateFormat: 'h:mm a'}} {{timezone}}</pre>
</div>
</body>
</html>
Please run the above snippet
<强> require 'set'
verb_tag_set = Set.new ["VB", "VBD", "VBG", "VBN", "VBP", "VBZ", "MD"]
tagged_text = [["VB", "go"], ["VBG", "going"]]
verb_tag_set.map(&tagged_text.to_h.method(:[])).compact
#⇒ [ "go", "going" ]
强>