Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(angularjs): remove angular-moment #2154

Merged
merged 1 commit into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"angular-cookies": "~1.8.2",
"angular-drag-scroll": "^0.2.1",
"angular-messages": "^1.8.2",
"angular-moment": "~1.3.0",
"angular-permission": "~1.1.1",
"angular-resource": "^1.8.2",
"angular-sanitize": "^1.8.2",
Expand Down
5 changes: 0 additions & 5 deletions src/public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const moduleDependencies = [
'ngResource',
'ui.router',
'ui.bootstrap',
'angularMoment',
'vcRecaptcha',
'users',
'ngFileUpload',
Expand Down Expand Up @@ -55,7 +54,6 @@ require('angular-permission/dist/angular-permission')
require('@opengovsg/angular-recaptcha-fallback')
require('angular-resource')
require('angular-sanitize')
require('angular-moment')
require('angular-messages')

require('angular-ui-bootstrap')
Expand Down Expand Up @@ -85,9 +83,6 @@ const appName = 'FormSG'
// Add module dependencies
const app = angular.module(appName, moduleDependencies)

// Override moment using Angular's dependency injection
app.constant('moment', require('moment-timezone'))

// Setting HTML5 Location Mode
angular.module(appName).config([
'$locationProvider',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const { StatusCodes } = require('http-status-codes')
const get = require('lodash/get')
const moment = require('moment-timezone')
const { LogicType } = require('../../../../../types')
const UpdateFormService = require('../../../../services/UpdateFormService')
const UserService = require('../../../../services/UserService')
Expand Down Expand Up @@ -43,7 +44,6 @@ angular
'$uibModal',
'FormData',
'FormFields',
'moment',
'Toastr',
'$state',
'$window',
Expand All @@ -58,7 +58,6 @@ function AdminFormController(
$uibModal,
FormData,
FormFields,
moment,
Toastr,
$state,
$window,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict'

const get = require('lodash/get')
const moment = require('moment-timezone')

const BetaService = require('../../../../services/BetaService')

const UserService = require('../../../../services/UserService')
Expand All @@ -12,7 +14,6 @@ angular
'$scope',
'FormApi',
'$uibModal',
'moment',
'$state',
'$timeout',
'$window',
Expand All @@ -25,7 +26,6 @@ function ListFormsController(
$scope,
FormApi,
$uibModal,
moment,
$state,
$timeout,
$window,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const moment = require('moment-timezone')

const {
processDecryptedContent,
} = require('../../helpers/process-decrypted-content')
Expand All @@ -24,7 +26,6 @@ angular
'$timeout',
'$location',
'$anchorScroll',
'moment',
ViewResponsesController,
])

Expand All @@ -39,7 +40,6 @@ function ViewResponsesController(
$timeout,
$location,
$anchorScroll,
moment,
) {
const vm = this

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const moment = require('moment-timezone')

angular.module('forms').component('endPageComponent', {
templateUrl: 'modules/forms/base/componentViews/end-page.html',
bindings: {
Expand All @@ -13,11 +15,11 @@ angular.module('forms').component('endPageComponent', {
colorTheme: '@',
submissionId: '@',
},
controller: ['SpcpSession', '$window', 'moment', endPageController],
controller: ['SpcpSession', '$window', endPageController],
controllerAs: 'vm',
})

function endPageController(SpcpSession, $window, moment) {
function endPageController(SpcpSession, $window) {
const vm = this

vm.timestamp = moment().format('D MMM YYYY, HH:mm')
Expand Down